Skip to content

Commit

Permalink
tree-diff: no need to call "full" diff_tree_sha1 from show_path()
Browse files Browse the repository at this point in the history
As described in previous commit, when recursing into sub-trees, we can
use lower-level tree walker, since its interface is now sha1 based.

The change is ok, because diff_tree_sha1() only invokes
ll_diff_tree_sha1(), and also, if base is empty, try_to_follow_renames().
But base is not empty here, as we have added a path and '/' before
recursing.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Kirill Smelkov authored and Junio C Hamano committed Mar 27, 2014
1 parent 52894e7 commit b9081a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tree-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include "diffcore.h"
#include "tree.h"


static int ll_diff_tree_sha1(const unsigned char *old, const unsigned char *new,
const char *base_str, struct diff_options *opt);

/*
* Compare two tree entries, taking into account only path/S_ISDIR(mode),
* but not their sha1's.
Expand Down Expand Up @@ -118,8 +122,8 @@ static void show_path(struct strbuf *base, struct diff_options *opt,

if (recurse) {
strbuf_addch(base, '/');
diff_tree_sha1(t1 ? t1->entry.sha1 : NULL,
t2 ? t2->entry.sha1 : NULL, base->buf, opt);
ll_diff_tree_sha1(t1 ? t1->entry.sha1 : NULL,
t2 ? t2->entry.sha1 : NULL, base->buf, opt);
}

strbuf_setlen(base, old_baselen);
Expand Down

0 comments on commit b9081a6

Please sign in to comment.