{"thread":{"id":"15229","subject":"[PATCH] git-p4: Fix checkout bug when using --import-local.","startedAt":"2008-08-27T22:36:12Z","lastAt":"2008-08-28T07:29:06Z","messageCount":2,"participants":["Tor Arvid Lund","Simon Hausmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"88804","messageId":"1219876572-24736-1-git-send-email-torarvid@gmail.com","threadId":"15229","inReplyTo":null,"subject":"[PATCH] git-p4: Fix checkout bug when using --import-local.","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2008-08-27T22:36:12Z","receivedAt":"2008-08-27T22:36:12Z","isPatch":true,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"When this option is passed to git p4 clone, the checkout at the end would\npreviously fail. This patch fixes it by optionally creating the master branch\nfrom refs/heads/p4/master, which is the correct one for this option.\n\nSigned-off-by: Tor Arvid Lund <torarvid@gmail.com>\n---\n contrib/fast-import/git-p4 |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex 46136d4..c4b8b4c 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -1733,8 +1733,12 @@ class P4Clone(P4Sync):\n         if not P4Sync.run(self, depotPaths):\n             return False\n         if self.branch != \"master\":\n-            if gitBranchExists(\"refs/remotes/p4/master\"):\n-                system(\"git branch master refs/remotes/p4/master\")\n+            if self.importIntoRemotes:\n+                masterbranch = \"refs/remotes/p4/master\"\n+            else:\n+                masterbranch = \"refs/heads/p4/master\"\n+            if gitBranchExists(masterbranch):\n+                system(\"git branch master %s\" % masterbranch)\n                 system(\"git checkout -f\")\n             else:\n                 print \"Could not detect main branch. No checkout/master branch created.\"\n-- \n1.6.0.GIT\n"},{"id":"88986","messageId":"200808280929.07898.simon@lst.de","threadId":"15229","inReplyTo":"1219876572-24736-1-git-send-email-torarvid@gmail.com","subject":"Re: [PATCH] git-p4: Fix checkout bug when using --import-local.","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2008-08-28T07:29:06Z","receivedAt":"2008-08-28T07:29:06Z","isPatch":true,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Thursday 28 August 2008 00:36:12 Tor Arvid Lund wrote:\n> When this option is passed to git p4 clone, the checkout at the end would\n> previously fail. This patch fixes it by optionally creating the master\n> branch from refs/heads/p4/master, which is the correct one for this option.\n>\n> Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>\n\nGood catch :)\n\nAcked-By: Simon Hausmann <simon@lst.de>\n\n\n\nSimon\n\n>  contrib/fast-import/git-p4 |    8 ++++++--\n>  1 files changed, 6 insertions(+), 2 deletions(-)\n>\n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index 46136d4..c4b8b4c 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -1733,8 +1733,12 @@ class P4Clone(P4Sync):\n>          if not P4Sync.run(self, depotPaths):\n>              return False\n>          if self.branch != \"master\":\n> -            if gitBranchExists(\"refs/remotes/p4/master\"):\n> -                system(\"git branch master refs/remotes/p4/master\")\n> +            if self.importIntoRemotes:\n> +                masterbranch = \"refs/remotes/p4/master\"\n> +            else:\n> +                masterbranch = \"refs/heads/p4/master\"\n> +            if gitBranchExists(masterbranch):\n> +                system(\"git branch master %s\" % masterbranch)\n>                  system(\"git checkout -f\")\n>              else:\n>                  print \"Could not detect main branch. No checkout/master\n> branch created.\"\n"}]}