]> git.ipfire.org Git - thirdparty/git.git/commit
difftool: create a tmpdir path without repeated slashes
authorDavid Aguilar <davvid@gmail.com>
Fri, 1 Oct 2021 01:37:53 +0000 (18:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Oct 2021 01:48:51 +0000 (18:48 -0700)
commit4ac9f15492b69ef3a0334ca66b1ef4be00c79b47
treeca3fbd829dbf1b5ccfad7e598dbe2548aa6247f5
parent77bd616367905437fe6181611e0c65fe23160ea1
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>
builtin/difftool.c
t/t7800-difftool.sh