* [BUG] git-log shows first parent and repeated last for octopus merge
@ 2006-10-18 11:11 Jakub Narebski
2006-10-18 13:53 ` Johannes Schindelin
2006-10-18 16:35 ` A Large Angry SCM
0 siblings, 2 replies; 6+ messages in thread
From: Jakub Narebski @ 2006-10-18 11:11 UTC (permalink / raw)
To: git
When trying to find how many merges and how many octopus merges (merges with
more than two parents) are in git.git repository I have encountered the
following strange output of git-log:
1000:jnareb@roke:~/git> git log --parents --full-history --max-count=1 \
211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e <last parent repeated>
Merge: d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b...
[...]
while git-show gives correct output
1005:jnareb@roke:~/git> git show 211232bae64bcc60bbf5d1b5e5b2344c22ed767e
commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e
Merge: fc54a9c... 9e30dd7... c4b83e6... 6602659... b28858b...
[...]
Same with git-rev-list, also shows correct output:
1005:jnareb@roke:~/git> git rev-list --header --parents --max-count=1 \
211232bae64bcc60bbf5d1b5e5b2344c22ed767e
211232bae64bcc60bbf5d1b5e5b2344c22ed767e [...]
tree cdafa88fa4ed7fcc7bb6c64d62e2d7c4d3b65e42
parent fc54a9c30ccad3fde5890d2c0ca2e2acc0848fbc
parent 9e30dd7c0ecc9f10372f31539d0122db97418353
parent c4b83e618f1df7d8ecc9392fa40e5bebccbe6b5a
parent 660265909fc178581ef327076716dfd3550e6e7b
parent b28858bf65d4fd6d8bb070865518ec43817fe7f3
[...]
1008:jnareb@roke:~/git> git --version
git version 1.4.2.1
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] git-log shows first parent and repeated last for octopus merge
2006-10-18 11:11 [BUG] git-log shows first parent and repeated last for octopus merge Jakub Narebski
@ 2006-10-18 13:53 ` Johannes Schindelin
2006-10-18 14:02 ` Jakub Narebski
2006-10-18 19:02 ` [BUG] git-log shows first parent and repeated last for octopus merge Junio C Hamano
2006-10-18 16:35 ` A Large Angry SCM
1 sibling, 2 replies; 6+ messages in thread
From: Johannes Schindelin @ 2006-10-18 13:53 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Hi,
On Wed, 18 Oct 2006, Jakub Narebski wrote:
> When trying to find how many merges and how many octopus merges (merges with
> more than two parents) are in git.git repository I have encountered the
> following strange output of git-log:
>
> 1000:jnareb@roke:~/git> git log --parents --full-history --max-count=1 \
> 211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
> commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e <last parent repeated>
> Merge: d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b...
> [...]
This happens because a//b rewrites the history, i.e. the parents are
edited. IMHO it makes no sense at all to show the parents in such a case,
since they are bogus.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] git-log shows first parent and repeated last for octopus merge
2006-10-18 13:53 ` Johannes Schindelin
@ 2006-10-18 14:02 ` Jakub Narebski
2006-10-18 14:26 ` [PATCH] When rewriting parents, cull duplicates Johannes Schindelin
2006-10-18 19:02 ` [BUG] git-log shows first parent and repeated last for octopus merge Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-10-18 14:02 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin wrote:
> On Wed, 18 Oct 2006, Jakub Narebski wrote:
>
> > When trying to find how many merges and how many octopus merges (merges with
> > more than two parents) are in git.git repository I have encountered the
> > following strange output of git-log:
> >
> > 1000:jnareb@roke:~/git> git log --parents --full-history --max-count=1 \
> > 211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
> > commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e <last parent repeated>
> > Merge: d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b...
> > [...]
>
> This happens because a//b rewrites the history, i.e. the parents are
> edited. IMHO it makes no sense at all to show the parents in such a case,
> since they are bogus.
Or rather it has no sense to _repeat_ rewritten parent the number of times
the commit has parents originally. Compare git-log and git-rev-list results:
1010:jnareb@roke:~/git> git rev-list --full-history --header --parents \
--max-count=2 211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
211232bae64bcc60bbf5d1b5e5b2344c22ed767e d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f
tree cdafa88fa4ed7fcc7bb6c64d62e2d7c4d3b65e42
parent fc54a9c30ccad3fde5890d2c0ca2e2acc0848fbc
parent 9e30dd7c0ecc9f10372f31539d0122db97418353
parent c4b83e618f1df7d8ecc9392fa40e5bebccbe6b5a
parent 660265909fc178581ef327076716dfd3550e6e7b
parent b28858bf65d4fd6d8bb070865518ec43817fe7f3
author Junio C Hamano <junkio@cox.net> 1115335014 -0700
committer Junio C Hamano <junkio@cox.net> 1115335014 -0700
Octopus merge of the following five patches.
Update git-apply-patch-script for symbolic links.
Make git-prune-script executable again.
Do not write out new index if nothing has changed.
diff-cache shows differences for unmerged paths without --cache.
Update diff engine for symlinks stored in the cache.
Signed-off-by: Junio C Hamano <junkio@cox.net>
d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f 54c26fb9d0cdff94c7717125d0a222b324bfea8a
[...]
1014:jnareb@roke:~/git> PAGER= git log --full-history --parents \
--max-count=2 211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f
Merge: d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b...
Author: Junio C Hamano <junkio@cox.net>
Date: Thu May 5 16:16:54 2005 -0700
Octopus merge of the following five patches.
Update git-apply-patch-script for symbolic links.
Make git-prune-script executable again.
Do not write out new index if nothing has changed.
diff-cache shows differences for unmerged paths without --cache.
Update diff engine for symlinks stored in the cache.
Signed-off-by: Junio C Hamano <junkio@cox.net>
commit d0d0d0bd3c2c4591ffbc292d7e082e8ad8f2057f 54c26fb9d0cdff94c7717125d0a222b324bfea8a 54c26fb9d0cdff94c7717125d0a222b324bfea8a
[...]
--
Jakub Narebski
Poland
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] When rewriting parents, cull duplicates
2006-10-18 14:02 ` Jakub Narebski
@ 2006-10-18 14:26 ` Johannes Schindelin
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2006-10-18 14:26 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Earlier, when calling
git log --parents some-ref -- path/file
it was possible that in case of merges, multiple parents would be
rewritten as the _same_ commit, which would happily be printed
multiple times.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Subject: Re: [BUG] git-log shows first parent and repeated last
for octopus merge
On Wed, 18 Oct 2006, Jakub Narebski wrote:
> Johannes Schindelin wrote:
> > On Wed, 18 Oct 2006, Jakub Narebski wrote:
> >
> > > When trying to find how many merges and how many octopus
> > > merges (merges with more than two parents) are in git.git
> > > repository I have encountered the following strange output
> > > of git-log:
> > >
> > > 1000:jnareb@roke:~/git> git log --parents --full-history \
> > > --max-count=1 211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
> > > commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e <...>
> > > Merge: d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b...
> > > [...]
> >
> > This happens because a//b rewrites the history, i.e. the
> > parents are edited. IMHO it makes no sense at all to show the
> > parents in such a case, since they are bogus.
>
> Or rather it has no sense to _repeat_ rewritten parent the
> number of times the commit has parents originally.
Here you are.
revision.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/revision.c b/revision.c
index 280e92b..8a2ca52 100644
--- a/revision.c
+++ b/revision.c
@@ -1086,12 +1086,23 @@ static int rewrite_one(struct rev_info *
}
}
+static int parent_is_duplicate(struct commit_list *parents,
+ struct commit_list *current)
+{
+ for (; parents != current; parents = parents->next)
+ if (parents->item == current->item)
+ return 1;
+ return 0;
+}
+
static void rewrite_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list **pp = &commit->parents;
while (*pp) {
struct commit_list *parent = *pp;
- if (rewrite_one(revs, &parent->item) < 0) {
+ if (rewrite_one(revs, &parent->item) < 0 ||
+ /* cull duplicates */
+ parent_is_duplicate(commit->parents, parent)) {
*pp = parent->next;
continue;
}
--
1.4.2.4.g21cef-dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [BUG] git-log shows first parent and repeated last for octopus merge
2006-10-18 11:11 [BUG] git-log shows first parent and repeated last for octopus merge Jakub Narebski
2006-10-18 13:53 ` Johannes Schindelin
@ 2006-10-18 16:35 ` A Large Angry SCM
1 sibling, 0 replies; 6+ messages in thread
From: A Large Angry SCM @ 2006-10-18 16:35 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Jakub Narebski wrote:
> When trying to find how many merges and how many octopus merges (merges with
> more than two parents) are in git.git repository I have encountered the
> following strange output of git-log:
Maybe the following will find what you're looking for:
git-rev-list master --parents \
|sed -e 's/[0-9a-f]\{40\}//' -e 's/ [0-9a-f]\{40\}/*/g' \
|sort \
|uniq -c
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] git-log shows first parent and repeated last for octopus merge
2006-10-18 13:53 ` Johannes Schindelin
2006-10-18 14:02 ` Jakub Narebski
@ 2006-10-18 19:02 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2006-10-18 19:02 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi,
>
> On Wed, 18 Oct 2006, Jakub Narebski wrote:
>
>> When trying to find how many merges and how many octopus merges (merges with
>> more than two parents) are in git.git repository I have encountered the
>> following strange output of git-log:
>>
>> 1000:jnareb@roke:~/git> git log --parents --full-history --max-count=1 \
>> 211232bae64bcc60bbf5d1b5e5b2344c22ed767e -- a//b
>> commit 211232bae64bcc60bbf5d1b5e5b2344c22ed767e <last parent repeated>
>> Merge: d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b... d0d0d0b...
>> [...]
>
> This happens because a//b rewrites the history, i.e. the parents are
> edited. IMHO it makes no sense at all to show the parents in such a case,
> since they are bogus.
If the command line did not have --full-history, I would agree
with you. The caller explicitly told us not to remove side
branches that do not end up modifying the paths, and also told
us, with --parent, to show parenthood information after removing
intermediate commits that do not change the tree shape (with
respect to the specified paths).
So it is showing what the user asked -- the user may not have
understood what he was asking, but that is a separate problem, I
would think.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-10-18 19:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 11:11 [BUG] git-log shows first parent and repeated last for octopus merge Jakub Narebski
2006-10-18 13:53 ` Johannes Schindelin
2006-10-18 14:02 ` Jakub Narebski
2006-10-18 14:26 ` [PATCH] When rewriting parents, cull duplicates Johannes Schindelin
2006-10-18 19:02 ` [BUG] git-log shows first parent and repeated last for octopus merge Junio C Hamano
2006-10-18 16:35 ` A Large Angry SCM
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).