Skip to content

Commit 7933611

Browse files
szedergitster
authored andcommitted
t3701-add-interactive: tighten the check of trace output
The test 'add -p does not expand argument lists' in 't3701-add-interactive.sh', added in 7288e12 (add--interactive: do not expand pathspecs with ls-files, 2017-03-14), checks the GIT_TRACE of 'git add -p' to ensure that the name of a tracked file wasn't passed around as argument to any of the commands executed as a result of undesired pathspec expansion. This check is done with 'grep' using the filename on its own as the pattern, which is too loose a pattern, and would match any occurrences of the filename in the trace output, not just those as command arguments. E.g. if a developer were to litter the index handling code with trace_printf()s printing, among other things, the name of the just processed cache entry, then that pattern would mistakenly match these as well, and would fail the test. Tighten this 'grep' pattern to only match trace lines that show the executed commands. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fc54c1a commit 7933611

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t3701-add-interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ test_expect_success 'add -p does not expand argument lists' '
497497
# update it, but we want to be sure that our "." pathspec
498498
# was not expanded into the argument list of any command.
499499
# So look only for "not-changed".
500-
! grep not-changed trace.out
500+
! grep -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out
501501
'
502502

503503
test_expect_success 'hunk-editing handles custom comment char' '

0 commit comments

Comments
 (0)