diff mbox series

[02/10] t9801: use `--` in preparation for default branch rename

Message ID 5849eda331e09732026f0432cf1040a4e973a702.1603135902.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Prepare for changing the default branch name main (last manual part) | expand

Commit Message

Johannes Schindelin Oct. 19, 2020, 7:31 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Seeing as we want to use `main` as the new default branch name used by
`git init`, and that `main` is used as directory name in t9801, let's
tighten the rev-list arguments to make it explicit when we are referring
to a ref instead of a directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9801-git-p4-branch.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Junio C Hamano Oct. 21, 2020, 10:19 p.m. UTC | #1
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> Seeing as we want to use `main` as the new default branch name used by
> `git init`, and that `main` is used as directory name in t9801, let's
> tighten the rev-list arguments to make it explicit when we are referring
> to a ref instead of a directory.

Interesting.  s/master/main/g would introduce "that name is both a
revision and a path" ambiguity?  An obvious alternative would be to
use a word that is not 'main' or 'master' for the path and that way
we will keep the current property that tests do not have to worry
about the rev/path ambiguity.  But given that even "git p4" should
be safe against rev/path ambiguity, I think this is good in the long
run---if "git p4" is not prepared to handle the ambiguity correctly,
then this approach may reveal such an existing breakage when the
branch name 'master' is replaced with 'main', and at that point, we
have to scramble and fix it (or rename the path from 'main' to
something else as a workaround).

Looking good.
diff mbox series

Patch

diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index 67ff2711f5..a3abd778f9 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -67,7 +67,7 @@  test_expect_success 'import main, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master >wc &&
+		git rev-list master -- >wc &&
 		test_line_count = 4 wc
 	)
 '
@@ -78,7 +78,7 @@  test_expect_success 'import branch1, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master >wc &&
+		git rev-list master -- >wc &&
 		test_line_count = 2 wc
 	)
 '
@@ -89,7 +89,7 @@  test_expect_success 'import branch2, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master >wc &&
+		git rev-list master -- >wc &&
 		test_line_count = 2 wc
 	)
 '
@@ -100,7 +100,7 @@  test_expect_success 'import depot, no branch detection' '
 	(
 		cd "$git" &&
 		git log --oneline --graph --decorate --all &&
-		git rev-list master >wc &&
+		git rev-list master -- >wc &&
 		test_line_count = 8 wc
 	)
 '
@@ -114,7 +114,7 @@  test_expect_success 'import depot, branch detection' '
 		git log --oneline --graph --decorate --all &&
 
 		# 4 main commits
-		git rev-list master >wc &&
+		git rev-list master -- >wc &&
 		test_line_count = 4 wc &&
 
 		# 3 main, 1 integrate, 1 on branch2
@@ -137,7 +137,7 @@  test_expect_success 'import depot, branch detection, branchList branch definitio
 		git log --oneline --graph --decorate --all &&
 
 		# 4 main commits
-		git rev-list master >wc &&
+		git rev-list master -- >wc &&
 		test_line_count = 4 wc &&
 
 		# 3 main, 1 integrate, 1 on branch2