With Git 2.30 (Q1 2021), "git
(man) p4" now honors init.defaultBranch
configuration.
That could be an alternative solution to detect-branches
or --branch
:
See commit 1b09d19 (08 Nov 2020) by Johannes Schindelin (dscho
).
(Merged by Junio C Hamano -- gitster
-- in commit ca8870d, 11 Nov 2020)
p4
: respect init.defaultBranch
Signed-off-by: Johannes Schindelin
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.
Furthermore:
With Git 2.37 (Q3 2022), git p4 sync --branch
is more complete:
See commit 17f273f (04 Apr 2022) by Tao Klerks (TaoK
).
(Merged by Junio C Hamano -- gitster
-- in commit af3a320, 20 May 2022)
git-p4
: support explicit sync of arbitrary existing git-p4
refs
Signed-off-by: Tao Klerks
With the --branch
argument of the sync subcommand, git-p4
enables you to import a perforce branch/path to an arbitrary Git ref, using a full ref path, or to refs/remotes/p4/*
or refs/heads/p4/*
, depending on --import-local
, using a short ref name.
However, when you later want to explicitly sync such a given ref to pick up subsequent p4
changes, it only works if the ref was placed in the p4
path and has only one path component (no "/").
This limitation results from a bad assumption in the existing-branch sync logic, and also means you cannot individually sync branches detected by --detect-branches
, as these also get a "/
" in their names.
Fix git p4 sync --branch
, when called with an existing ref, so that it works correctly regardless of whether the ref is in the p4
path or not, and (in the case of refs in the p4
path) regardless of whether it has a "/
" in its short name or not.