coccicheck: use --all-includes by default
[gitweb.git] / builtin / ls-files.c
index dedf02dc702d1cc94399f45869e5d01d2f0eecb9..197f153f501e4498122896d4e1242d4c5e1651cc 100644 (file)
@@ -118,7 +118,8 @@ static void show_killed_files(struct dir_struct *dir)
                                 */
                                pos = cache_name_pos(ent->name, ent->len);
                                if (0 <= pos)
-                                       die("bug in show-killed-files");
+                                       die("BUG: killed-file %.*s not found",
+                                               ent->len, ent->name);
                                pos = -pos - 1;
                                while (pos < active_nr &&
                                       ce_stage(active_cache[pos]))
@@ -186,7 +187,7 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)
                printf("%s%06o %s %d\t",
                       tag,
                       ce->ce_mode,
-                      find_unique_abbrev(ce->sha1,abbrev),
+                      find_unique_abbrev(ce->oid.hash,abbrev),
                       ce_stage(ce));
        }
        write_eolinfo(ce, ce->name);
@@ -379,14 +380,6 @@ static const char * const ls_files_usage[] = {
        NULL
 };
 
-static int option_parse_z(const struct option *opt,
-                         const char *arg, int unset)
-{
-       line_terminator = unset ? '\n' : '\0';
-
-       return 0;
-}
-
 static int option_parse_exclude(const struct option *opt,
                                const char *arg, int unset)
 {
@@ -428,9 +421,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
        struct exclude_list *el;
        struct string_list exclude_list = STRING_LIST_INIT_NODUP;
        struct option builtin_ls_files_options[] = {
-               { OPTION_CALLBACK, 'z', NULL, NULL, NULL,
-                       N_("paths are separated with NUL character"),
-                       PARSE_OPT_NOARG, option_parse_z },
+               /* Think twice before adding "--nul" synonym to this */
+               OPT_SET_INT('z', NULL, &line_terminator,
+                       N_("paths are separated with NUL character"), '\0'),
                OPT_BOOL('t', NULL, &show_tag,
                        N_("identify the file status with tags")),
                OPT_BOOL('v', NULL, &show_valid_bit,