Skip to contentSkip to conversation

p4: respect init.defaultBranch

PATCH In review Johannes Schindelin via GitGitGadget 2 participants 2 messages Nov 8, 2020 – Nov 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 p4: respect init.defaultBranch

From: Johannes Schindelin <[email protected]>

In git p4 clone, we hard-code the branch name master instead of looking what the _actual_ initial branch name is. Let's fix that.

---
p4: respect init.defaultBranch

Just something I noticed while working on the big master -> main rename in the test suite.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-782%2Fdscho%2Fgit-p4-and-init.defaultBranch-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-782/dscho/git-p4-and-init.defaultBranch-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/782

 git-p4.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-p4.py +1 -1
index 4433ca53de..52ddb1d7b2 100755
@@ -4186,7 +4186,7 @@ def run(self, args):
 
         # create a master branch and check out a work tree
         if gitBranchExists(self.branch):
-            system([ "git", "branch", "master", self.branch ])
+            system([ "git", "branch", currentGitBranch(), self.branch ])
             if not self.cloneBare:
                 system([ "git", "checkout", "-f" ])
         else:

base-commit: 7f7ebe054af6d831b999d6c2241b9227c4e4e08d

Signature · 1 line
gitgitgadget
#1 lore raw

"Johannes Schindelin via GitGitGadget" <[email protected]>

Quoted 7 lines · writes:

From: Johannes Schindelin <[email protected]>

In git p4 clone, we hard-code the branch name master instead of looking what the _actual_ initial branch name is. Let's fix that.

---

Makes sense. Will queue. Thanks.

Quoted 27 lines

p4: respect init.defaultBranch

Just something I noticed while working on the big master -> main rename in the test suite.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-782%2Fdscho%2Fgit-p4-and-init.defaultBranch-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-782/dscho/git-p4-and-init.defaultBranch-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/782

 git-p4.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-p4.py +1 -1
index 4433ca53de..52ddb1d7b2 100755
@@ -4186,7 +4186,7 @@ def run(self, args):
 
         # create a master branch and check out a work tree
         if gitBranchExists(self.branch):
-            system([ "git", "branch", "master", self.branch ])
+            system([ "git", "branch", currentGitBranch(), self.branch ])
             if not self.cloneBare:
                 system([ "git", "checkout", "-f" ])
         else:

base-commit: 7f7ebe054af6d831b999d6c2241b9227c4e4e08d