aboutsummaryrefslogtreecommitdiffstats
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-26 22:53:13 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-26 22:53:13 -0800
commitd539de9f25920f099e4e56b0acbb4ebf246ff0f4 (patch)
tree8453048a2a8f5a8a84d66e5c8dfd4784bdec49b6 /diff-lib.c
parent3fa7c3da379bb47a0e7a52ffc13cb366add880a2 (diff)
parent721ceec1ad12625e90b395fd0be0fae9049ebc22 (diff)
downloadgit-d539de9f25920f099e4e56b0acbb4ebf246ff0f4.tar.gz
Merge branch 'jl/diff-submodule-ignore'
* jl/diff-submodule-ignore: Teach diff --submodule that modified submodule directory is dirty git diff: Don't test submodule dirtiness with --ignore-submodules Make ce_uptodate() trustworthy again
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/diff-lib.c b/diff-lib.c
index ec2e2ac005..d7e13cb177 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -161,7 +161,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
- if ((ce_uptodate(ce) && !S_ISGITLINK(ce->ce_mode)) || ce_skip_worktree(ce))
+ if (ce_uptodate(ce) || ce_skip_worktree(ce))
continue;
/* If CE_VALID is set, don't look at workdir for file removal */
@@ -179,6 +179,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
}
changed = ce_match_stat(ce, &st, ce_option);
if (S_ISGITLINK(ce->ce_mode)
+ && !DIFF_OPT_TST(&revs->diffopt, IGNORE_SUBMODULES)
&& (!changed || (revs->diffopt.output_format & DIFF_FORMAT_PATCH))
&& is_submodule_modified(ce->name)) {
changed = 1;
@@ -220,7 +221,7 @@ static int get_stat_data(struct cache_entry *ce,
const unsigned char **sha1p,
unsigned int *modep,
int cached, int match_missing,
- unsigned *dirty_submodule, int output_format)
+ unsigned *dirty_submodule, struct diff_options *diffopt)
{
const unsigned char *sha1 = ce->sha1;
unsigned int mode = ce->ce_mode;
@@ -241,7 +242,8 @@ static int get_stat_data(struct cache_entry *ce,
}
changed = ce_match_stat(ce, &st, 0);
if (S_ISGITLINK(ce->ce_mode)
- && (!changed || (output_format & DIFF_FORMAT_PATCH))
+ && !DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES)
+ && (!changed || (diffopt->output_format & DIFF_FORMAT_PATCH))
&& is_submodule_modified(ce->name)) {
changed = 1;
*dirty_submodule = 1;
@@ -270,7 +272,7 @@ static void show_new_file(struct rev_info *revs,
* the working copy.
*/
if (get_stat_data(new, &sha1, &mode, cached, match_missing,
- &dirty_submodule, revs->diffopt.output_format) < 0)
+ &dirty_submodule, &revs->diffopt) < 0)
return;
diff_index_show_file(revs, "+", new, sha1, mode, dirty_submodule);
@@ -287,7 +289,7 @@ static int show_modified(struct rev_info *revs,
unsigned dirty_submodule = 0;
if (get_stat_data(new, &sha1, &mode, cached, match_missing,
- &dirty_submodule, revs->diffopt.output_format) < 0) {
+ &dirty_submodule, &revs->diffopt) < 0) {
if (report_missing)
diff_index_show_file(revs, "-", old,
old->sha1, old->ce_mode, 0);