diff: convert flags to be stored in bitfields

We cannot add many more flags to the diff machinery due to the
limitations of the number of flags that can be stored in a single
unsigned int.  In order to allow for more flags to be added to the diff
machinery in the future this patch converts the flags to be stored in
bitfields in 'struct diff_flags'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2017-10-31 11:19:05 -07:00
committed by Junio C Hamano
parent c9f348e926
commit 02f2f56bc3
6 changed files with 67 additions and 48 deletions

View File

@ -912,11 +912,12 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
* submodules which were manually staged, which would
* be really confusing.
*/
int diff_flags = DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;
struct diff_flags flags = DIFF_FLAGS_INIT;
flags.OVERRIDE_SUBMODULE_CONFIG = 1;
if (ignore_submodule_arg &&
!strcmp(ignore_submodule_arg, "all"))
diff_flags |= DIFF_OPT_IGNORE_SUBMODULES;
commitable = index_differs_from(parent, diff_flags, 1);
flags.IGNORE_SUBMODULES = 1;
commitable = index_differs_from(parent, &flags, 1);
}
}
strbuf_release(&committer_ident);