git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] t/t9802: explicitly name the upstream branch to use as a base

From
BCBrandon Casey <bcasey@nvidia.com>
Date
Jun 18, 2013, 01:40 UTC
Message-ID
<1371519650-17869-2-git-send-email-bcasey@nvidia.com>
In-Reply-To
<1371519650-17869-1-git-send-email-bcasey@nvidia.com>
From: Brandon Casey <drafnel@gmail.com>

Prior to commit fa83a33b, 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 fa83a33b, 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 <drafnel@gmail.com>
---
 t/t9802-git-p4-filetype.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index eeefa67..b0d1d94 100755
--- a/t/t9802-git-p4-filetype.sh
+++ b/t/t9802-git-p4-filetype.sh
@@ -95,7 +95,7 @@ test_expect_success 'gitattributes setting eol=lf produces lf newlines' '
 		git init &&
 		echo "* eol=lf" >.gitattributes &&
 		git p4 sync //depot@all &&
-		git checkout master &&
+		git checkout -b master p4/master &&
 		test_cmp "$cli"/f-unix-orig f-unix &&
 		test_cmp "$cli"/f-win-as-lf f-win
 	)
@@ -109,7 +109,7 @@ test_expect_success 'gitattributes setting eol=crlf produces crlf newlines' '
 		git init &&
 		echo "* eol=crlf" >.gitattributes &&
 		git p4 sync //depot@all &&
-		git checkout master &&
+		git checkout -b master p4/master &&
 		test_cmp "$cli"/f-unix-as-crlf f-unix &&
 		test_cmp "$cli"/f-win-orig f-win
 	)
-- 
1.8.2.415.g63cec41
Previous: Brandon CaseyNext: Pete Wyckoff
Message 2 of 5 in “builtin/checkout.c: don't leak memory in check_tracking_name”
  1. 1/2 builtin/checkout.c: don't leak memory in check_tracking_nameBrandon Casey, Jun 18, 2013
  2. 2/2 t/t9802: explicitly name the upstream branch to use as a baseBrandon Casey, Jun 18, 2013
  3. Pete WyckoffJun 18, 2013
  4. Junio C HamanoJun 18, 2013
  5. Jeff KingJun 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.