Without this patch in case of a merge, duplicated parents are omitted in first line output, but still listed in following parents information. Signed-off-by: Marco Costalba <mcostalba@xxxxxxxxx> --- Following the hint of someone I submit this patch. Please take it as a wish of not reverting the patch ;-) log-tree.c | 25 +++++++++++++++++-------- revision.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/log-tree.c b/log-tree.c index 24aea6b..e5d40fe 100644 --- a/log-tree.c +++ b/log-tree.c @@ -6,11 +6,11 @@ struct decoration name_decoration = { "object names" }; -static void clear_tmp_mark(struct commit_list *p) +static void clear_flag(struct commit_list *p, unsigned int flag) { while (p) { struct commit *c = p->item; - c->object.flags &= ~TMP_MARK; + c->object.flags &= ~flag; p = p->next; } } @@ -23,7 +23,7 @@ static void show_parents( * be used locally, but the user should clean * things up after it is done with them. */ - clear_tmp_mark(commit->parents); + clear_flag(commit->parents, TMP_MARK); for (p = commit->parents; p ; p = p->next) { struct commit *parent = p->item; if (parent->object.flags & TMP_MARK) @@ -31,7 +31,7 @@ static void show_parents(struct printf(" %s", diff_unique_abbrev(parent->object.sha1, abbrev)); parent->object.flags |= TMP_MARK; } - clear_tmp_mark(commit->parents); + clear_flag(commit->parents, TMP_MARK); } static void show_decorations(struct commit *commit) @@ -391,16 +391,24 @@ static int log_tree_diff( /* If we show individual diffs, show the parent info */ log->parent = parents->item; } - showed_log = 0; + clear_flag(parents, TMP_MARK_2); + for (;;) { struct commit *parent = parents->item; - diff_tree_sha1(parent->object.sha1, sha1, "", &opt->diffopt); - log_tree_diff_flush(opt); + /* TMP_MARK_2 is a general purpose flag that can + * be used locally nested with TMP_MARK, but the user + * should clean things up after it is done with them. + */ + if (!opt->parents || !(parent->object.flags & TMP_MARK_2)) { - showed_log |= !opt->loginfo; + diff_tree_sha1(parent->object.sha1, sha1, "", &opt->diffopt); + log_tree_diff_flush(opt); // will use TMP_MARK + showed_log |= !opt->loginfo; + parent->object.flags |= TMP_MARK_2; + } /* Set up the log info for the next parent, if any.. */ parents = parents->next; if (!parents) @@ -408,6 +416,7 @@ static int log_tree_diff( log->parent = parents->item; opt->loginfo = log; } + clear_flag(parents, TMP_MARK_2); return showed_log; } diff --git a/revision.h b/revision.h index f46b4d5..403507f 100644 --- a/revision.h +++ b/revision.h @@ -10,6 +10,7 @@ #define CHILD_SHOWN (1u<<6) #define ADDED (1u<<7) /* Parents already parsed and added? */ #define SYMMETRIC_LEFT (1u<<8) +#define TMP_MARK_2 (1u<<9) /* for isolated cases; clean after use */ struct rev_info; struct log_info; -- 1.5.3.rc0.65.g39a4d-dirty - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html