Code

Make Pthread link flags configurable
[git.git] / builtin-ls-files.c
index 54cb2518dbbfed70dcbe1b5a2112f79c78bfd6a6..b48327db950e5d8a54045f4956fa92b7879227bc 100644 (file)
@@ -78,7 +78,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
        int offset = prefix_offset;
 
        if (len >= ent->len)
-               die("git-ls-files: internal error - directory entry not superset of prefix");
+               die("git ls-files: internal error - directory entry not superset of prefix");
 
        if (pathspec && !pathspec_match(pathspec, ps_matched, ent->name, len))
                return;
@@ -91,39 +91,10 @@ static void show_other_files(struct dir_struct *dir)
 {
        int i;
 
-
-       /*
-        * Skip matching and unmerged entries for the paths,
-        * since we want just "others".
-        *
-        * (Matching entries are normally pruned during
-        * the directory tree walk, but will show up for
-        * gitlinks because we don't necessarily have
-        * dir->show_other_directories set to suppress
-        * them).
-        */
        for (i = 0; i < dir->nr; i++) {
                struct dir_entry *ent = dir->entries[i];
-               int len, pos;
-               struct cache_entry *ce;
-
-               /*
-                * Remove the '/' at the end that directory
-                * walking adds for directory entries.
-                */
-               len = ent->len;
-               if (len && ent->name[len-1] == '/')
-                       len--;
-               pos = cache_name_pos(ent->name, len);
-               if (0 <= pos)
-                       continue;       /* exact match */
-               pos = -pos - 1;
-               if (pos < active_nr) {
-                       ce = active_cache[pos];
-                       if (ce_namelen(ce) == len &&
-                           !memcmp(ce->name, ent->name, len))
-                               continue; /* Yup, this one exists unmerged */
-               }
+               if (!cache_name_is_other(ent->name, ent->len))
+                       continue;
                show_dir_entry(tag_other, ent);
        }
 }
@@ -183,13 +154,13 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
        int offset = prefix_offset;
 
        if (len >= ce_namelen(ce))
-               die("git-ls-files: internal error - cache entry not superset of prefix");
+               die("git ls-files: internal error - cache entry not superset of prefix");
 
        if (pathspec && !pathspec_match(pathspec, ps_matched, ce->name, len))
                return;
 
        if (tag && *tag && show_valid_bit &&
-           (ce->ce_flags & htons(CE_VALID))) {
+           (ce->ce_flags & CE_VALID)) {
                static char alttag[4];
                memcpy(alttag, tag, 3);
                if (isalpha(tag[0]))
@@ -210,7 +181,7 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
        } else {
                printf("%s%06o %s %d\t",
                       tag,
-                      ntohl(ce->ce_mode),
+                      ce->ce_mode,
                       abbrev ? find_unique_abbrev(ce->sha1,abbrev)
                                : sha1_to_hex(ce->sha1),
                       ce_stage(ce));
@@ -243,7 +214,7 @@ static void show_files(struct dir_struct *dir, const char *prefix)
                                continue;
                        if (show_unmerged && !ce_stage(ce))
                                continue;
-                       if (ce->ce_flags & htons(CE_UPDATE))
+                       if (ce->ce_flags & CE_UPDATE)
                                continue;
                        show_ce_entry(ce_stage(ce) ? tag_unmerged : tag_cached, ce);
                }
@@ -319,7 +290,7 @@ static const char *verify_pathspec(const char *prefix)
        }
 
        if (prefix_offset > max || memcmp(prev, prefix, prefix_offset))
-               die("git-ls-files: cannot generate relative filenames containing '..'");
+               die("git ls-files: cannot generate relative filenames containing '..'");
 
        prefix_len = max;
        return max ? xmemdupz(prev, max) : NULL;
@@ -352,7 +323,7 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
                struct cache_entry *ce = active_cache[i];
                if (!ce_stage(ce))
                        continue;
-               ce->ce_flags |= htons(CE_STAGEMASK);
+               ce->ce_flags |= CE_STAGEMASK;
        }
 
        if (prefix) {
@@ -381,7 +352,7 @@ void overlay_tree_on_cache(const char *tree_name, const char *prefix)
                         */
                        if (last_stage0 &&
                            !strcmp(last_stage0->name, ce->name))
-                               ce->ce_flags |= htons(CE_UPDATE);
+                               ce->ce_flags |= CE_UPDATE;
                }
        }
 }
@@ -423,7 +394,7 @@ int report_path_error(const char *ps_matched, const char **pathspec, int prefix_
 }
 
 static const char ls_files_usage[] =
-       "git-ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
+       "git ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
        "[ --ignored ] [--exclude=<pattern>] [--exclude-from=<file>] "
        "[ --exclude-per-directory=<filename> ] [--exclude-standard] "
        "[--full-name] [--abbrev] [--] [<file>]*";
@@ -437,7 +408,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
        memset(&dir, 0, sizeof(dir));
        if (prefix)
                prefix_offset = strlen(prefix);
-       git_config(git_default_config);
+       git_config(git_default_config, NULL);
 
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];