Re: [PATCH 3/4] difftool: use a strbuf to create the tmpdir path
- From
Jeff King <peff@peff.net>
- Date
- Sep 19, 2021, 02:17 UTC
- Message-ID
- <YUaduDIYoW8Fo+5s@coredump.intra.peff.net>
- In-Reply-To
- <20210919015729.98323-3-davvid@gmail.com>
On Sat, Sep 18, 2021 at 06:57:28PM -0700, David Aguilar wrote:
Show 5 quoted lines
> + /* Remove trailing slashes when $TMPDIR ends in '/'. */
> + while (tmpdir.len > 0 && tmpdir.buf[tmpdir.len - 1] == '/') {
> + strbuf_setlen(&tmpdir, tmpdir.len - 1);
> + }
> + strbuf_addstr(&tmpdir, "/git-difftool.XXXXXX");It sounds like this should remove any directory separator (so on Windows, it should also drop backslashes). You can use is_dir_sep() for that, but better still, you can then do:
strbuf_trim_trailing_dir_sep(&tmpdir);
-Peff