Skip to content

Commit 7a03e10

Browse files
EliahKaganclaude
andcommitted
Document init script behavior when multiple remotes have master
When master is locally absent and more than one remote has it, "git checkout master --" refuses to disambiguate (even if those remote-tracking branches all agree on a commit), so the script falls back to creating master at HEAD. The reflog populated by the resets below then traces HEAD's history rather than a remote master's. This is harmless -- master is reset to __testing_point__ either way -- but unintuitive. Add a comment so a reader of the script does not have to discover this from a confusing run. Closes #2145. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 830471c commit 7a03e10

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

init-tests-after-clone.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ fi
3939
# This also keeps track of where we are, so we can get back here.
4040
git tag __testing_point__
4141

42-
# The tests need a branch called master.
42+
# The tests need a branch called master. If master is locally absent but more
43+
# than one remote has it, "git checkout master --" fails (even if all those
44+
# remote-tracking branches point to the same commit), and we fall back to
45+
# creating master at HEAD. The reflog from the resets below then traces HEAD's
46+
# history rather than a remote master's, but master is reset to
47+
# __testing_point__ either way.
4348
git checkout master -- || git checkout -b master
4449

4550
# The tests need a reflog history on the master branch.

0 commit comments

Comments
 (0)