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

[PATCH 1/2] t2000: consolidate second scenario into a single test block

From
Zakariyah Ali via GitGitGadget <gitgitgadget@gmail.com>
Date
May 23, 2026, 11:07 UTC
Message-ID
<4da209249227f6a824cc34c8697d1ed79dfa18e0.1779534462.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2256.git.git.1779534462.gitgitgadget@gmail.com>
From: Zakariyah Ali <zakariyahali100@gmail.com>

Now that the test script has been modernised, consolidate the eight separate test_expect_success blocks that together form the second test scenario (setup, tree writes, checkout, symlink creation, and final state check) into one self-contained block.

This makes it easier to read: data set-up, the operations being tested, and the expected outcome are now all in one place.

Helped-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Zakariyah Ali <zakariyahali100@gmail.com>
---
 t/t2000-conflict-when-checking-files-out.sh | 55 ++++-----------------
 1 file changed, 9 insertions(+), 46 deletions(-)
diff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh
index af199d8191..43ec901f9e 100755
--- a/t/t2000-conflict-when-checking-files-out.sh
+++ b/t/t2000-conflict-when-checking-files-out.sh
@@ -83,59 +83,22 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '
 # path path3 is occupied by a non-directory.  With "-f" it should remove
 # the symlink path3 and create directory path3 and file path3/file1.
 
-test_expect_success 'prepare path2/file0 and index' '
+test_expect_success 'checkout-index -f resolves symlink conflict on leading path' '
 	mkdir path2 &&
 	date >path2/file0 &&
-	git update-index --add path2/file0
-'
-
-test_expect_success 'write tree with path2/file0' '
-	tree1=$(git write-tree)
-'
-
-test_debug 'show_files $tree1'
-
-test_expect_success 'prepare path3/file1 and index' '
+	git update-index --add path2/file0 &&
+	tree1=$(git write-tree) &&
 	mkdir path3 &&
 	date >path3/file1 &&
-	git update-index --add path3/file1
-'
-
-test_expect_success 'write tree with path3/file1' '
-	tree2=$(git write-tree)
-'
-
-test_debug 'show_files $tree2'
-
-test_expect_success 'read previously written tree and checkout.' '
+	git update-index --add path3/file1 &&
+	tree2=$(git write-tree) &&
 	rm -fr path3 &&
 	git read-tree -m $tree1 &&
-	git checkout-index -f -a
-'
-
-test_debug 'show_files $tree1'
-
-test_expect_success 'add a symlink' '
-	test_ln_s_add path2 path3
-'
-
-test_expect_success 'write tree with symlink path3' '
-	tree3=$(git write-tree)
-'
-
-test_debug 'show_files $tree3'
-
-# Morten says "Got that?" here.
-# Test begins.
-
-test_expect_success 'read previously written tree and checkout.' '
+	git checkout-index -f -a &&
+	test_ln_s_add path2 path3 &&
+	tree3=$(git write-tree) &&
 	git read-tree $tree2 &&
-	git checkout-index -f -a
-'
-
-test_debug 'show_files $tree2'
-
-test_expect_success 'checking out conflicting path with -f' '
+	git checkout-index -f -a &&
 	test_path_is_dir_not_symlink path2 &&
 	test_path_is_dir_not_symlink path3 &&
 	test_path_is_file_not_symlink path2/file0 &&
-- 
gitgitgadget
Previous: Zakariyah Ali via GitGitGadgetNext: Zakariyah Ali via GitGitGadget
Message 2 of 4 in “t2000: modernize path checks to use helper functions”
  1. 0/2 [GSoC Patch] t2000: modernize path checks to use helper functionsZakariyah Ali via GitGitGadget, May 23, 2026
  2. 1/2 t2000: consolidate second scenario into a single test blockZakariyah Ali via GitGitGadget, May 23, 2026
  3. 2/2 t2000: cleanup unused debug code and variablesZakariyah Ali via GitGitGadget, May 23, 2026
  4. Junio C HamanoMay 24, 2026

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.