Thread (14 messages) flat view 14 messages, 4 authors, 2021-09-19

Re: [PATCH 3/4] difftool: use a strbuf to create the tmpdir path

From: Jeff King <hidden>
Date: 2021-09-19 02:17:31

On Sat, Sep 18, 2021 at 06:57:28PM -0700, David Aguilar wrote:
+	/* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help