Performance optimization for detection of modified submodules
In the worst case is_submodule_modified() got called three times for
each submodule. The information we got from scanning the whole
submodule tree the first time can be reused instead.
New parameters have been added to diff_change() and diff_addremove(),
the information is stored in a new member of struct diff_filespec. Its
value is then reused instead of calling is_submodule_modified() again.
When no explicit "-dirty" is needed in the output the call to
is_submodule_modified() is not necessary when the submodules HEAD
already disagrees with the ref of the superproject, as this alone
marks it as modified. To achieve that, get_stat_data() got an extra
argument.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jens Lehmann15 years agocommitted byJunio C Hamano
@ -2032,7 +2032,7 @@ static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
@@ -2032,7 +2032,7 @@ static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
char *data = xmalloc(100), *dirty = "";
/* Are we looking at the work tree? */
if (!s->sha1_valid && is_submodule_modified(s->path))
if (!s->sha1_valid && s->dirty_submodule)
dirty = "-dirty";
len = snprintf(data, 100,
@ -3719,7 +3719,7 @@ int diff_result_code(struct diff_options *opt, int status)
@@ -3719,7 +3719,7 @@ int diff_result_code(struct diff_options *opt, int status)