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

[PATCH 4/5] t7800: fix tests when difftool uses --no-symlinks

From
John Keeping <john@keeping.me.uk>
Date
Mar 29, 2013, 11:28 UTC
Message-ID
<7c54c9df46d8c0bcd0290c4c307001b36421fcb3.1364555970.git.john@keeping.me.uk>
In-Reply-To
<cover.1364555970.git.john@keeping.me.uk>

When 'git difftool --dir-diff' is using --no-symlinks (either explicitly or implicitly because it's running on Windows), any working tree files that have been copied to the temporary directory are copied back after the difftool completes.

Because an earlier test uses "git add .", the "output" file used by tests is tracked by Git and the following sequence occurs during some tests:

1) the shell opens "output" to redirect the difftool output
2) difftool copies the empty "output" to the temporary directory
3) difftool runs "ls" which writes to "output"
4) difftool copies the empty "output" file back over the output of the
   command
5) the output file doesn't contain the expected output, causing the
   test to fail

Instead of adding all changes, explicitly add only the files that the test is using, allowing later tests to write their result files into the working tree.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
Changes since v2:
- Fix grammar issues in commit message
- Remove the final paragraph of the commit message since this is now
  addressed by patch 2/5 in this series
 t/t7800-difftool.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 9fd09db..df443a9 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -314,7 +314,7 @@ test_expect_success PERL 'setup change in subdirectory' '
 	git commit -m "added sub/sub" &&
 	echo test >>file &&
 	echo test >>sub/sub &&
-	git add . &&
+	git add file sub/sub &&
 	git commit -m "modified both"
 '
 
-- 
1.8.2.411.g65a544e
Previous: John KeepingNext: John Keeping
Message 8 of 9 in “difftool improvements”
  1. 0/5 difftool improvementsJohn Keeping, Mar 29, 2013
  2. 1/5 t7800: move '--symlinks' specific test to the endJohn Keeping, Mar 29, 2013
  3. 2/5 difftool: don't overwrite modified filesJohn Keeping, Mar 29, 2013
  4. Junio C HamanoMar 29, 2013
  5. John KeepingMar 29, 2013
  6. 2/5 difftool: don't overwrite modified filesJohn Keeping, Mar 29, 2013
  7. 3/5 t7800: don't hide grep outputJohn Keeping, Mar 29, 2013
  8. 4/5 t7800: fix tests when difftool uses --no-symlinksJohn Keeping, Mar 29, 2013
  9. 5/5 t7800: run --dir-diff tests with and without symlinksJohn Keeping, Mar 29, 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.