From: Duy Nguyen <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: David Kastrup <dak@gnu.org>, Vincent van Ravesteijn <vfr@lyx.org>,
Francis Stephens <francisstephens@gmail.com>
Subject: Re: Confusing git log --- First time bug submission please advise on best practices
Date: Fri, 7 Feb 2014 17:26:20 +0700 [thread overview]
Message-ID: <20140207102619.GA27616@lanh> (raw)
In-Reply-To: <CAJaBJzKy0b8MBuB_X_4n8E2=q=CyrpxOyFFrgv_2CQ19pkNmwQ@mail.gmail.com>
On Fri, Feb 07, 2014 at 09:43:46AM +0000, Francis Stephens wrote:
> Thanks for your clear response. I can see where I went wrong now.
Maybe something like this would help avoid confusion a bit in the
future? This toy patch puts a horizontal line as a break between two
commits if they are not related, so we can clearly see linear commit
segments.
--graph definitely helps, but it's too many threads for topic-based
development model like git.git that I avoid it most of the time.
-- 8< --
diff --git a/log-tree.c b/log-tree.c
index 08970bf..7841bf2 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -795,6 +795,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
int log_tree_commit(struct rev_info *opt, struct commit *commit)
{
+ static struct commit_list *last_parents;
struct log_info log;
int shown;
@@ -805,6 +806,17 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
if (opt->line_level_traverse)
return line_log_print(opt, commit);
+ if (last_parents) {
+ struct commit_list *p = last_parents;
+ int got_parent = 0;
+ for (; p && !got_parent; p = p->next)
+ got_parent = !hashcmp(p->item->object.sha1,
+ commit->object.sha1);
+ if (!got_parent)
+ printf("______________________________________________________________________\n");
+ free_commit_list(last_parents);
+ last_parents = NULL;
+ }
shown = log_tree_diff(opt, commit, &log);
if (!shown && opt->loginfo && opt->always_show_header) {
log.parent = NULL;
@@ -813,5 +825,6 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
}
opt->loginfo = NULL;
maybe_flush_or_die(stdout, "stdout");
+ last_parents = copy_commit_list(commit->parents);
return shown;
}
-- 8< --
>
> On Thu, Feb 6, 2014 at 4:10 PM, David Kastrup <dak@gnu.org> wrote:
> > Vincent van Ravesteijn <vfr@lyx.org> writes:
> >
> >> The commits that are in the log for master and which are not in the
> >> log for originssh/master are merged in at "6833fd4 (HEAD, master);
> >> Completed merge".
> >>
> >> As "git log" can only present the commits in a linear way, it shows
> >> the commits from the ancentry of both parents of HEAD in a reverse
> >> chronological order. This means that the commits from the two
> >> ancestries are mixed and commits that are shown after each other don't
> >> have to be parent and child. See the documentation of "git log" and
> >> the section "Commit Ordering": "By default, the commits are shown in
> >> reverse chronological order."
> >
> > git log --graph can help with getting a better picture.
next prev parent reply other threads:[~2014-02-07 10:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 14:02 Confusing git log --- First time bug submission please advise on best practices Francis Stephens
2014-02-06 16:08 ` Vincent van Ravesteijn
2014-02-06 16:10 ` David Kastrup
2014-02-07 9:43 ` Francis Stephens
2014-02-07 10:26 ` Duy Nguyen [this message]
2014-02-07 11:37 ` demerphq
2014-02-08 13:50 ` [PATCH] log: add --show-linear-break to help see non-linear history Nguyễn Thái Ngọc Duy
2014-03-17 12:51 ` [PATCH v2] log: add --nonlinear-barrier " Nguyễn Thái Ngọc Duy
2014-03-17 19:09 ` Eric Sunshine
2014-03-17 20:32 ` Junio C Hamano
2014-03-18 11:46 ` Duy Nguyen
2014-03-18 19:08 ` Junio C Hamano
2014-03-20 5:44 ` [PATCH v3 1/2] object.h: centralize object flag allocation Nguyễn Thái Ngọc Duy
2014-03-20 5:44 ` [PATCH v3 2/2] log: add --show-linear-break to help see non-linear history Nguyễn Thái Ngọc Duy
2014-03-20 19:15 ` Junio C Hamano
2014-03-21 1:02 ` Duy Nguyen
2014-03-25 13:23 ` [PATCH v4 1/2] object.h: centralize object flag allocation Nguyễn Thái Ngọc Duy
2014-03-25 13:23 ` [PATCH v4 2/2] log: add --show-linear-break to help see non-linear history Nguyễn Thái Ngọc Duy
2014-03-25 22:30 ` Junio C Hamano
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=20140207102619.GA27616@lanh \
--to=pclouds@gmail.com \
--cc=dak@gnu.org \
--cc=francisstephens@gmail.com \
--cc=git@vger.kernel.org \
--cc=vfr@lyx.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).