Merge lp:~cjwatson/launchpad/codeimport-git-xenial into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18385
Proposed branch: lp:~cjwatson/launchpad/codeimport-git-xenial
Merge into: lp:launchpad
Diff against target: 21 lines (+3/-1)
1 file modified
lib/lp/codehosting/codeimport/worker.py (+3/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/codeimport-git-xenial
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+324104@code.launchpad.net

Commit message

Fix git-to-git code imports on xenial.

Deleting the remote-tracking refs after the fetch now requires
'refs/remotes/source/**' rather than 'refs/remotes/source/*' following
changes to git's wildcard-matching implementation.

As a result of this bug having been live on production for a few days, we
also need to delete any such refs that may exist before fetching, as the
conflict between refs on disk and refs in the remote seems to confuse git in
some cases.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/codehosting/codeimport/worker.py'
2--- lib/lp/codehosting/codeimport/worker.py 2016-11-14 18:29:17 +0000
3+++ lib/lp/codehosting/codeimport/worker.py 2017-05-16 12:22:56 +0000
4@@ -1103,6 +1103,8 @@
5 self._logger.info("Fetching remote repository.")
6 try:
7 self._runGit("config", "gc.auto", "0", cwd="repository")
8+ # Remove any stray remote-tracking refs from the last time round.
9+ self._deleteRefs("repository", "refs/remotes/source/**")
10 self._runGit(
11 "remote", "add", "source", self.source_details.url,
12 cwd="repository")
13@@ -1117,7 +1119,7 @@
14 self._runGit("remote", "rm", "source", cwd="repository")
15 # XXX cjwatson 2016-11-03: For some reason "git remote rm"
16 # doesn't actually remove the refs.
17- self._deleteRefs("repository", "refs/remotes/source/*")
18+ self._deleteRefs("repository", "refs/remotes/source/**")
19 except subprocess.CalledProcessError as e:
20 self._logger.info("Unable to fetch remote repository: %s" % e)
21 return CodeImportWorkerExitCode.FAILURE_INVALID