@matheusbsbs / matheus-bagliano / commits / f9162f6a4c
Fork 0

Always pass a sha1 for the initial parent so that git-fast-import doesn't think it's creating a new branch from itself. It's a sensible error in general but in the case of incremental imports we have to apply force :)

Always pass a sha1 for the initial parent so that git-fast-import doesn't think it's creating a new branch from itself. It's a sensible error in general but in the case of incremental imports we have to apply force :) Signed-off-by: Simon Hausmann <simon@lst.de>

Simon Hausmann committed May 17, 2007 at 09:02 UTC f9162f6a4cc9f4af3e527412b364a8eda4502920
1 file changed +4 -3
contrib/fast-import/git-p4
+4 -3
@@ -865,7 +865,7 @@ class P4Sync(Command):
865 self.previousDepotPath = ""
866
867 if len(self.branch) == 0:
868 - self.branch = "p4"
868 + self.branch = "refs/remotes/p4"
869
870 if len(args) == 0:
871 if not gitBranchExists(self.branch) and gitBranchExists("origin"):
@@ -878,11 +878,12 @@ class P4Sync(Command):
878 p4Change = int(p4Change) + 1
879 self.depotPath = self.previousDepotPath
880 self.changeRange = "@%s,#head" % p4Change
881 - self.initialParent = self.branch
881 + self.initialParent = mypopen("git rev-parse %s" % self.branch).read()[:-1]
882 if not self.silent:
883 print "Performing incremental import into %s git branch" % self.branch
884
885 - self.branch = "refs/heads/" + self.branch
885 + if not self.branch.startswith("refs/"):
886 + self.branch = "refs/heads/" + self.branch
887
888 if len(self.depotPath) != 0:
889 self.depotPath = self.depotPath[:-1]