diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2009-02-16 13:20:25 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-18 11:04:19 -0800 |
commit | 7c4c97c0ac0cd66861d0c2b8bd7a47ed3c523ea7 (patch) | |
tree | fc42dc10878370068d77dbbfb94cb2475561a0b1 /builtin-ls-files.c | |
parent | 81d3fe9f4871e42ebd1af0221fa091fe5476e2f7 (diff) | |
download | git-7c4c97c0ac0cd66861d0c2b8bd7a47ed3c523ea7.tar.gz git-7c4c97c0ac0cd66861d0c2b8bd7a47ed3c523ea7.tar.xz |
Turn the flags in struct dir_struct into a single variable
By having flags represented as bits in the new member variable 'flags',
it will be easier to use parse_options when dir_struct is involved.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-ls-files.c')
-rw-r--r-- | builtin-ls-files.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/builtin-ls-files.c b/builtin-ls-files.c index 9dec282fb..d36f80b3d 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -174,7 +174,8 @@ static void show_files(struct dir_struct *dir, const char *prefix) for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i]; int dtype = ce_to_dtype(ce); - if (excluded(dir, ce->name, &dtype) != dir->show_ignored) + if (excluded(dir, ce->name, &dtype) != + !!(dir->flags & DIR_SHOW_IGNORED)) continue; if (show_unmerged && !ce_stage(ce)) continue; @@ -189,7 +190,8 @@ static void show_files(struct dir_struct *dir, const char *prefix) struct stat st; int err; int dtype = ce_to_dtype(ce); - if (excluded(dir, ce->name, &dtype) != dir->show_ignored) + if (excluded(dir, ce->name, &dtype) != + !!(dir->flags & DIR_SHOW_IGNORED)) continue; if (ce->ce_flags & CE_UPDATE) continue; @@ -432,7 +434,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) continue; } if (!strcmp(arg, "-i") || !strcmp(arg, "--ignored")) { - dir.show_ignored = 1; + dir.flags |= DIR_SHOW_IGNORED; require_work_tree = 1; continue; } @@ -446,11 +448,11 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) continue; } if (!strcmp(arg, "--directory")) { - dir.show_other_directories = 1; + dir.flags |= DIR_SHOW_OTHER_DIRECTORIES; continue; } if (!strcmp(arg, "--no-empty-directory")) { - dir.hide_empty_directories = 1; + dir.flags |= DIR_HIDE_EMPTY_DIRECTORIES; continue; } if (!strcmp(arg, "-u") || !strcmp(arg, "--unmerged")) { @@ -542,7 +544,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) ps_matched = xcalloc(1, num); } - if (dir.show_ignored && !exc_given) { + if ((dir.flags & DIR_SHOW_IGNORED) && !exc_given) { fprintf(stderr, "%s: --ignored needs some exclude pattern\n", argv[0]); exit(1); |