threads / patch / 15229

patchgit-p4: Fix checkout bug when using --import-local.

Subject: [PATCH] git-p4: Fix checkout bug when using --import-local.

## tl;dr

2 messages between Aug 27, 2008 and Aug 28, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Tor Arvid Lund· Aug 27, 2008, 22:36 UTC · lore

When this option is passed to git p4 clone, the checkout at the end would previously fail. This patch fixes it by optionally creating the master branch from refs/heads/p4/master, which is the correct one for this option.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
---
 contrib/fast-import/git-p4 |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
Show changes to contrib/fast-import/git-p4 +6 −2
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 46136d4..c4b8b4c 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -1733,8 +1733,12 @@ class P4Clone(P4Sync):
         if not P4Sync.run(self, depotPaths):
             return False
         if self.branch != "master":
-            if gitBranchExists("refs/remotes/p4/master"):
-                system("git branch master refs/remotes/p4/master")
+            if self.importIntoRemotes:
+                masterbranch = "refs/remotes/p4/master"
+            else:
+                masterbranch = "refs/heads/p4/master"
+            if gitBranchExists(masterbranch):
+                system("git branch master %s" % masterbranch)
                 system("git checkout -f")
             else:
                 print "Could not detect main branch. No checkout/master branch created."
-- 
1.6.0.GIT
Simon Hausmann· Aug 28, 2008, 07:29 UTC · re: Tor Arvid Lund · lore

Re: [PATCH] git-p4: Fix checkout bug when using --import-local.

On Thursday 28 August 2008 00:36:12 Tor Arvid Lund wrote:
Show 5 quoted lines
> When this option is passed to git p4 clone, the checkout at the end would
> previously fail. This patch fixes it by optionally creating the master
> branch from refs/heads/p4/master, which is the correct one for this option.
>
> Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Good catch :)
Acked-By: Simon Hausmann <simon@lst.de>
Simon
Show 23 quoted lines
>  contrib/fast-import/git-p4 |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index 46136d4..c4b8b4c 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -1733,8 +1733,12 @@ class P4Clone(P4Sync):
>          if not P4Sync.run(self, depotPaths):
>              return False
>          if self.branch != "master":
> -            if gitBranchExists("refs/remotes/p4/master"):
> -                system("git branch master refs/remotes/p4/master")
> +            if self.importIntoRemotes:
> +                masterbranch = "refs/remotes/p4/master"
> +            else:
> +                masterbranch = "refs/heads/p4/master"
> +            if gitBranchExists(masterbranch):
> +                system("git branch master %s" % masterbranch)
>                  system("git checkout -f")
>              else:
>                  print "Could not detect main branch. No checkout/master
> branch created."

← back to recent threads