git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: David AguilarNext: David Aguilar
Message 4 of 16 in “t7800-difftool: cleanup temporary repositories used by tests”
  1. 1/4 t7800-difftool: cleanup temporary repositories used by testsDavid Aguilar, Sep 19, 2021
  2. 2/4 difftool: add a missing space to the run_dir_diff() commentsDavid Aguilar, Sep 19, 2021
  3. 3/4 difftool: use a strbuf to create the tmpdir pathDavid Aguilar, Sep 19, 2021
  4. Jeff KingSep 19, 2021
  5. 3/4 difftool: use a strbuf to create the tmpdir pathDavid Aguilar, Sep 19, 2021
  6. Junio C HamanoSep 20, 2021
  7. Johannes SixtSep 19, 2021
  8. David AguilarSep 19, 2021
  9. Johannes SixtSep 19, 2021
  10. David AguilarSep 19, 2021
  11. Johannes SixtSep 19, 2021
  12. 4/4 difftool: fix symlink-file writing in dir-diff modeDavid Aguilar, Sep 19, 2021
  13. 4/4 difftool: fix symlink-file writing in dir-diff modeDavid Aguilar, Sep 19, 2021
  14. 4/4 difftool: fix symlink-file writing in dir-diff modeDavid Aguilar, Sep 19, 2021
  15. Ævar Arnfjörð BjarmasonSep 19, 2021
  16. Junio C HamanoSep 20, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.