← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/codeimport-git-xenial into lp:launchpad.

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.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/codeimport-git-xenial/+merge/324104
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/codeimport-git-xenial into lp:launchpad.
=== modified file 'lib/lp/codehosting/codeimport/worker.py'
--- lib/lp/codehosting/codeimport/worker.py	2016-11-14 18:29:17 +0000
+++ lib/lp/codehosting/codeimport/worker.py	2017-05-16 12:22:56 +0000
@@ -1103,6 +1103,8 @@
         self._logger.info("Fetching remote repository.")
         try:
             self._runGit("config", "gc.auto", "0", cwd="repository")
+            # Remove any stray remote-tracking refs from the last time round.
+            self._deleteRefs("repository", "refs/remotes/source/**")
             self._runGit(
                 "remote", "add", "source", self.source_details.url,
                 cwd="repository")
@@ -1117,7 +1119,7 @@
             self._runGit("remote", "rm", "source", cwd="repository")
             # XXX cjwatson 2016-11-03: For some reason "git remote rm"
             # doesn't actually remove the refs.
-            self._deleteRefs("repository", "refs/remotes/source/*")
+            self._deleteRefs("repository", "refs/remotes/source/**")
         except subprocess.CalledProcessError as e:
             self._logger.info("Unable to fetch remote repository: %s" % e)
             return CodeImportWorkerExitCode.FAILURE_INVALID


Follow ups