threads / patch / 7371

patchgit-log --reflog -p --full-history: Show commit diffs instead of faked diffs

Subject: [PATCH] git-log --reflog -p --full-history: Show commit diffs instead of faked diffs

## tl;dr

One message between Mar 23, 2007 and Mar 23, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Mar 23, 2007, 20:21 UTC · lore

With `--reflog` and `-p`, git-log will show diffs according to the reflog history, while adding `--full-history` will produce the true commit diffs.

In other words, `git-log -g -p HEAD` will show the diff between HEAD@{n+1} and HEAD@{n} with each commit HEAD@{n}.

In contrast, `git-log -g -p --full-history HEAD`, will show the diff between HEAD@{n}^ and HEAD@{n} with each commit HEAD@{n}.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 revision.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to revision.c +3 −0
diff --git a/revision.c b/revision.c
index f23c1d5..edd7dfd 100644
--- a/revision.c
+++ b/revision.c
@@ -1197,6 +1197,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
 	do {
 		struct commit_list *entry = revs->commits;
 		struct commit *commit = entry->item;
+		struct commit_list *parents = commit->parents;
 
 		revs->commits = entry->next;
 		free(entry);
@@ -1215,6 +1216,8 @@ static struct commit *get_revision_1(struct rev_info *revs)
 				continue;
 			add_parents_to_list(revs, commit, &revs->commits);
 		}
+		if (revs->reflog_info && !revs->simplify_history)
+			commit->parents = parents;
 		if (commit->object.flags & SHOWN)
 			continue;
 
-- 
1.5.1.rc1.2356.g2054

← back to recent threads