From: Jeff King <peff@peff.net>
To: David Aguilar <davvid@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, markus.heidelberg@web.de,
jnareb@gmail.com, j.sixt@viscovery.net
Subject: Re: [PATCH v2 2/2] diff: generate prettier filenames when using GIT_EXTERNAL_DIFF
Date: Thu, 28 May 2009 13:44:36 -0400 [thread overview]
Message-ID: <20090528174436.GA12723@coredump.intra.peff.net> (raw)
In-Reply-To: <1243491077-27738-2-git-send-email-davvid@gmail.com>
On Wed, May 27, 2009 at 11:11:17PM -0700, David Aguilar wrote:
> +int git_mkstemps(char *path, size_t n, const char *template, int suffix_len);
FWIW, I find this name not very descriptive. From the name, I would
expect it to do the exact same thing as mkstemps, but be our own
personal implementation. But it is actually a wrapper that behaves
somewhat differently. So I wonder if "mkstemps_tmpdir" or something
would be a better name.
> + if (pretty_filename) {
> + /* Generate "XXXXXX_filename" */
Is there a reason _not_ to always just use the pretty filename? It looks
like you turn it on for external diff, but off for textconv. I don't
think there is a reason not to use it for textconv.
Is there some other code path that changes it that I'm missing?
> + int pretty_filename = 1;
> + temp_one = prepare_temp_file(name, one, pretty_filename);
> + temp_two = prepare_temp_file(othername, two, pretty_filename);
I think this reads much better as just:
temp_one = prepare_temp_file(name, one, 1);
temp_two = prepare_temp_file(othername, two, 1);
Then it eliminates one bit of state for the reader to keep track of; I
don't have to wonder if pretty_filename might ever change. If I care
about what the '1' means, I can go look at the definition of
prepare_temp_file (or if you really want to make it more
self-documenting, make it a "flags" field and set the
USE_PRETTY_FILENAME flag).
However, I suspect that all callers should use pretty filenames, and
then this bit would just go away.
> + int pretty_filename = 0;
>
> - temp = prepare_temp_file(spec->path, spec);
> + temp = prepare_temp_file(spec->path, spec, pretty_filename);
Ditto here.
-Peff
next prev parent reply other threads:[~2009-05-28 17:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-28 6:11 [PATCH v2 1/2] compat: add a mkstemps() compatibility function David Aguilar
2009-05-28 6:11 ` [PATCH v2 2/2] diff: generate prettier filenames when using GIT_EXTERNAL_DIFF David Aguilar
2009-05-28 17:44 ` Jeff King [this message]
2009-05-28 21:30 ` David Aguilar
2009-05-28 22:06 ` Jeff King
2009-05-28 7:07 ` [PATCH v2 1/2] compat: add a mkstemps() compatibility function Johannes Sixt
2009-05-28 9:31 ` David Aguilar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090528174436.GA12723@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=jnareb@gmail.com \
--cc=markus.heidelberg@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).