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>
This commit is contained in:

committed by
Junio C Hamano

parent
f17a5d3494
commit
e3d42c4773
10
diff.h
10
diff.h
@ -14,12 +14,13 @@ typedef void (*change_fn_t)(struct diff_options *options,
|
||||
unsigned old_mode, unsigned new_mode,
|
||||
const unsigned char *old_sha1,
|
||||
const unsigned char *new_sha1,
|
||||
const char *fullpath);
|
||||
const char *fullpath,
|
||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule);
|
||||
|
||||
typedef void (*add_remove_fn_t)(struct diff_options *options,
|
||||
int addremove, unsigned mode,
|
||||
const unsigned char *sha1,
|
||||
const char *fullpath);
|
||||
const char *fullpath, unsigned dirty_submodule);
|
||||
|
||||
typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
|
||||
struct diff_options *options, void *data);
|
||||
@ -177,13 +178,14 @@ extern void diff_addremove(struct diff_options *,
|
||||
int addremove,
|
||||
unsigned mode,
|
||||
const unsigned char *sha1,
|
||||
const char *fullpath);
|
||||
const char *fullpath, unsigned dirty_submodule);
|
||||
|
||||
extern void diff_change(struct diff_options *,
|
||||
unsigned mode1, unsigned mode2,
|
||||
const unsigned char *sha1,
|
||||
const unsigned char *sha2,
|
||||
const char *fullpath);
|
||||
const char *fullpath,
|
||||
unsigned dirty_submodule1, unsigned dirty_submodule2);
|
||||
|
||||
extern void diff_unmerge(struct diff_options *,
|
||||
const char *path,
|
||||
|
Reference in New Issue
Block a user