Skip to content

Commit 9d58c4a

Browse files
drafnelgitster
authored andcommitted
t/t9802: explicitly name the upstream branch to use as a base
Prior to commit fa83a33, the 'git checkout' DWIMery would create a new local branch if the specified branch name did not exist and it matched exactly one ref in the "remotes" namespace. It searched the "remotes" namespace for matching refs using a simple comparison of the trailing portion of the remote ref names. This approach could sometimes produce false positives or negatives. Since fa83a33, the DWIMery more strictly excludes the remote name from the ref comparison by iterating through the remotes that are configured in the .gitconfig file. This has the side-effect that any refs that exist in the "remotes" namespace, but do not match the destination side of any remote refspec, will not be used by the DWIMery. This change in behavior breaks the tests in t9802 which relied on the old behavior of searching all refs in the remotes namespace, since the git-p4 script does not configure any remotes in the .gitconfig. Let's work around this in these tests by explicitly naming the upstream branch to base the new local branch on when calling 'git checkout'. Signed-off-by: Brandon Casey <[email protected]> Acked-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2c48420 commit 9d58c4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t9802-git-p4-filetype.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test_expect_success 'gitattributes setting eol=lf produces lf newlines' '
9595
git init &&
9696
echo "* eol=lf" >.gitattributes &&
9797
git p4 sync //depot@all &&
98-
git checkout master &&
98+
git checkout -b master p4/master &&
9999
test_cmp "$cli"/f-unix-orig f-unix &&
100100
test_cmp "$cli"/f-win-as-lf f-win
101101
)
@@ -109,7 +109,7 @@ test_expect_success 'gitattributes setting eol=crlf produces crlf newlines' '
109109
git init &&
110110
echo "* eol=crlf" >.gitattributes &&
111111
git p4 sync //depot@all &&
112-
git checkout master &&
112+
git checkout -b master p4/master &&
113113
test_cmp "$cli"/f-unix-as-crlf f-unix &&
114114
test_cmp "$cli"/f-win-orig f-win
115115
)

0 commit comments

Comments
 (0)