difftool: create a tmpdir path without repeated slashes
The paths generated by difftool are passed to user-facing diff tools. Using paths with repeated slashes in them is a cosmetic blemish that is exposed to users and can be avoided. Use a strbuf to create the buffer used for the dir-diff tmpdir. Strip trailing slashes from the value read from TMPDIR to avoid repeated slashes in the generated paths. Adjust the error handling to avoid leaking strbufs and to avoid returning -1 to cmd_main(). Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
77bd616367
commit
4ac9f15492
@ -453,6 +453,13 @@ run_dir_diff_test 'difftool --dir-diff' '
|
||||
grep "^file$" output
|
||||
'
|
||||
|
||||
run_dir_diff_test 'difftool --dir-diff avoids repeated slashes in TMPDIR' '
|
||||
TMPDIR="${TMPDIR:-/tmp}////" \
|
||||
git difftool --dir-diff $symlinks --extcmd echo branch >output &&
|
||||
grep -v // output >actual &&
|
||||
test_line_count = 1 actual
|
||||
'
|
||||
|
||||
run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
|
||||
git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
|
||||
grep "^sub$" output &&
|
||||
|
Reference in New Issue
Block a user