ce_match_stat, run_diff_files: use symbolic constants for readability
ce_match_stat() can be told: (1) to ignore CE_VALID bit (used under "assume unchanged" mode) and perform the stat comparison anyway; (2) not to perform the contents comparison for racily clean entries and report mismatch of cached stat information; using its "option" parameter. Give them symbolic constants. Similarly, run_diff_files() can be told not to report anything on removed paths. Also give it a symbolic constant for that. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
16
diff-lib.c
16
diff-lib.c
@ -173,9 +173,10 @@ static int is_in_index(const char *path)
|
||||
}
|
||||
|
||||
static int handle_diff_files_args(struct rev_info *revs,
|
||||
int argc, const char **argv, int *silent)
|
||||
int argc, const char **argv,
|
||||
unsigned int *options)
|
||||
{
|
||||
*silent = 0;
|
||||
*options = 0;
|
||||
|
||||
/* revs->max_count == -2 means --no-index */
|
||||
while (1 < argc && argv[1][0] == '-') {
|
||||
@ -192,7 +193,7 @@ static int handle_diff_files_args(struct rev_info *revs,
|
||||
revs->diffopt.no_index = 1;
|
||||
}
|
||||
else if (!strcmp(argv[1], "-q"))
|
||||
*silent = 1;
|
||||
*options |= DIFF_SILENT_ON_REMOVED;
|
||||
else
|
||||
return error("invalid option: %s", argv[1]);
|
||||
argv++; argc--;
|
||||
@ -305,9 +306,9 @@ int setup_diff_no_index(struct rev_info *revs,
|
||||
|
||||
int run_diff_files_cmd(struct rev_info *revs, int argc, const char **argv)
|
||||
{
|
||||
int silent_on_removed;
|
||||
unsigned int options;
|
||||
|
||||
if (handle_diff_files_args(revs, argc, argv, &silent_on_removed))
|
||||
if (handle_diff_files_args(revs, argc, argv, &options))
|
||||
return -1;
|
||||
|
||||
if (revs->diffopt.no_index) {
|
||||
@ -329,13 +330,14 @@ int run_diff_files_cmd(struct rev_info *revs, int argc, const char **argv)
|
||||
perror("read_cache");
|
||||
return -1;
|
||||
}
|
||||
return run_diff_files(revs, silent_on_removed);
|
||||
return run_diff_files(revs, options);
|
||||
}
|
||||
|
||||
int run_diff_files(struct rev_info *revs, int silent_on_removed)
|
||||
int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
{
|
||||
int entries, i;
|
||||
int diff_unmerged_stage = revs->max_count;
|
||||
int silent_on_removed = option & DIFF_SILENT_ON_REMOVED;
|
||||
|
||||
if (diff_unmerged_stage < 0)
|
||||
diff_unmerged_stage = 2;
|
||||
|
Reference in New Issue
Block a user