summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-02 15:10:46 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-02 15:10:46 -0700
commit48799d1c6b9cfb0279afbfe3420cbcd53c24907c (patch)
tree30d16fe0cc263fae60b0cc782614d923f1db8184 /log-tree.c
parent76d1ab30a3ad1c3bf406efb60c55b00a566f9050 (diff)
parentd1b9b76734d2ec31d41ba6e7beddab7c880dff85 (diff)
downloadgit-48799d1c6b9cfb0279afbfe3420cbcd53c24907c.tar.gz
Merge branch 'tr/log-tree-optim'
Optimize "log" that shows the difference between the parent and the child. * tr/log-tree-optim: Avoid loading commits twice in log with diffs
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/log-tree.c b/log-tree.c
index 92bb2bf48e..7cc7d598e7 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -709,11 +709,14 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
{
int showed_log;
struct commit_list *parents;
- unsigned const char *sha1 = commit->object.sha1;
+ unsigned const char *sha1;
if (!opt->diff && !DIFF_OPT_TST(&opt->diffopt, EXIT_WITH_STATUS))
return 0;
+ parse_commit(commit);
+ sha1 = commit->tree->object.sha1;
+
/* Root commit? */
parents = commit->parents;
if (!parents) {
@@ -736,7 +739,9 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
* parent, showing summary diff of the others
* we merged _in_.
*/
- diff_tree_sha1(parents->item->object.sha1, sha1, "", &opt->diffopt);
+ parse_commit(parents->item);
+ diff_tree_sha1(parents->item->tree->object.sha1,
+ sha1, "", &opt->diffopt);
log_tree_diff_flush(opt);
return !opt->loginfo;
}
@@ -749,7 +754,9 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
for (;;) {
struct commit *parent = parents->item;
- diff_tree_sha1(parent->object.sha1, sha1, "", &opt->diffopt);
+ parse_commit(parent);
+ diff_tree_sha1(parent->tree->object.sha1,
+ sha1, "", &opt->diffopt);
log_tree_diff_flush(opt);
showed_log |= !opt->loginfo;