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

Re: [PATCH v3] diff: generate prettier filenames when using GIT_EXTERNAL_DIFF

From
Junio C Hamano <gitster@pobox.com>
Date
May 26, 2009, 06:12 UTC
Message-ID
<7vr5ycqtog.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1243316165-99065-1-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 15 quoted lines
> Naturally, prep_temp_blob() did not care about filenames.
> As a result, scripts that use GIT_EXTERNAL_DIFF ended up
> with filenames such as ".diff_XXXXXX".
>
> This specializes the GIT_EXTERNAL_DIFF code to generate
> prettier filenames.
>
> Diffing "name.ext" now generates "name.XXXX.ext".
> Diffing files with no extension now generates "name_XXXX".
>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
>
> I renamed a few variables and unrolled the inner loop in
> git_mkstemps() since the last patch to make things easier to read/review.
Thanks.

I actually think using mkstemps() where the function is natively available, and using compat/mkstemps.c implementation where it is not, is a saner approach.

It would make the implementation of git_mkstemps() easier to read, because the interface to mkstemps(), even though it may not be in POSIX (nor in glibc), is a well known quantity and people do not need to follow into its implementation when they want to follow the logic of higher level code.

Previous: David AguilarNext: Markus Heidelberg
Message 4 of 7 in “diff: generate prettier filenames when using GIT_EXTERNAL_DIFF”
  1. diff: generate prettier filenames when using GIT_EXTERNAL_DIFFDavid Aguilar, May 26, 2009
  2. Stephen BoydMay 26, 2009
  3. David AguilarMay 26, 2009
  4. Junio C HamanoMay 26, 2009
  5. Markus HeidelbergMay 26, 2009
  6. David AguilarMay 26, 2009
  7. Junio C HamanoMay 26, 2009

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.