diff options
author | Junio C Hamano <junkio@cox.net> | 2007-04-21 17:21:10 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-21 17:21:10 -0700 |
commit | afb5b6a24bd333d298d10acac731f1c127bbb82d (patch) | |
tree | 9c403d4fa96f00d172e5b0a95602b68be839086f /builtin-ls-files.c | |
parent | 99ebd06c18fdb7f8274db6cca456a95942916bb6 (diff) | |
parent | 1c3e5c4ebc326c5c70350d3f4dc7f2b29e813480 (diff) | |
download | git-afb5b6a24bd333d298d10acac731f1c127bbb82d.tar.gz |
Merge branch 'lt/gitlink'
* lt/gitlink:
Tests for core subproject support
Expose subprojects as special files to "git diff" machinery
Fix some "git ls-files -o" fallout from gitlinks
Teach "git-read-tree -u" to check out submodules as a directory
Teach git list-objects logic to not follow gitlinks
Fix gitlink index entry filesystem matching
Teach "git-read-tree -u" to check out submodules as a directory
Teach git list-objects logic not to follow gitlinks
Don't show gitlink directories when we want "other" files
Teach git-update-index about gitlinks
Teach directory traversal about subprojects
Fix thinko in subproject entry sorting
Teach core object handling functions about gitlinks
Teach "fsck" not to follow subproject links
Add "S_IFDIRLNK" file mode infrastructure for git links
Add 'resolve_gitlink_ref()' helper function
Avoid overflowing name buffer in deep directory structures
diff-lib: use ce_mode_from_stat() rather than messing with modes manually
Diffstat (limited to 'builtin-ls-files.c')
-rw-r--r-- | builtin-ls-files.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/builtin-ls-files.c b/builtin-ls-files.c index 74a6acacc1..f7c066b24b 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -89,20 +89,38 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent) 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++) { - /* We should not have a matching entry, but we - * may have an unmerged entry for this path. - */ struct dir_entry *ent = dir->entries[i]; - int pos = cache_name_pos(ent->name, ent->len); + 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) - die("bug in show-other-files"); + continue; /* exact match */ pos = -pos - 1; if (pos < active_nr) { ce = active_cache[pos]; - if (ce_namelen(ce) == ent->len && - !memcmp(ce->name, ent->name, ent->len)) + if (ce_namelen(ce) == len && + !memcmp(ce->name, ent->name, len)) continue; /* Yup, this one exists unmerged */ } show_dir_entry(tag_other, ent); |