From: Jeff King <peff@peff.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] Add a 'source' decorator for commits
Date: Tue, 28 Oct 2008 01:45:40 -0400 [thread overview]
Message-ID: <20081028054539.GA23195@sigill.intra.peff.net> (raw)
In-Reply-To: <alpine.LFD.2.00.0810271306230.3386@nehalem.linux-foundation.org>
On Mon, Oct 27, 2008 at 01:07:10PM -0700, Linus Torvalds wrote:
> We already support decorating commits by tags or branches that point to
> them, but especially when we are looking at multiple branches together,
> we sometimes want to see _how_ we reached a particular commit.
I think this is a cool feature, but I have a few questions/complaints:
- Does it make sense to have this _in addition_ to --decorate (since
for any commit with a --decorate field, it would likely be the same
as --source)? Should it be a different type of decorate instead,
like --decorate=source or --decorate=branch?
- Should this be triggered by the "%d" --pretty=format specifier? This
two-liner:
diff --git a/pretty.c b/pretty.c
index f6ff312..bdaad19 100644
--- a/pretty.c
+++ b/pretty.c
@@ -487,6 +487,8 @@ static void format_decoration(struct strbuf *sb, const struct commit *commit)
const char *prefix = " (";
load_ref_decorations();
+ if (commit->util)
+ printf("%s", (char *)commit->util);
d = lookup_decoration(&name_decoration, &commit->object);
while (d) {
strbuf_addstr(sb, prefix);
works, but:
- it doesn't check revs->show_source, so is it possible that
commit->util is being used for something else?
- using '%d' automatically turns on --decorate, so you end up with
both the --source and --decorate values. More sensible semantics
would be "%d turns on --decorate, unless you have done
--decorate=<explicit format>".
Alternatively, this should just be "%b" or "%S".
- If you don't specify --all, you just get "HEAD" for everything.
Which makes sense when you consider the implementation, but I think
is probably a bit confusing for users.
> Of course, if the commit is reachable through multiple sources (which is
> common), our particular choice of "first" reachable is entirely random
> and depends on the particular path we happened to follow.
Hmm. It would be nice to keep even a simple counter to get a "distance"
from the ref and choose the one with the smallest distance (I think we
can get away without the complex rules that git-describe uses, since we
are not interested in describing the full commit, but rather finding a
"likely" branch).
However, that would require making multiple passes over the commit
graph, which might impact the startup speed.
-Peff
next prev parent reply other threads:[~2008-10-28 5:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-27 20:05 [PATCH 0/2] Random patches from my tree Linus Torvalds
2008-10-27 20:06 ` [PATCH 1/2] Add file delete/create info when we overflow rename_limit Linus Torvalds
2008-10-27 20:07 ` [PATCH 2/2] Add a 'source' decorator for commits Linus Torvalds
2008-10-28 5:45 ` Jeff King [this message]
2008-10-28 13:11 ` Pierre Habouzit
2008-10-28 13:19 ` Pierre Habouzit
2008-10-28 19:46 ` Jeff King
2008-10-28 19:53 ` Jeff King
2008-10-28 20:09 ` Pierre Habouzit
2008-10-28 20:27 ` Jeff King
2008-10-28 15:17 ` Linus Torvalds
2008-10-28 17:21 ` Linus Torvalds
2008-10-28 19:29 ` Jeff King
2008-10-27 20:37 ` [PATCH 0/2] Random patches from my tree Linus Torvalds
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=20081028054539.GA23195@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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).