path: root/builtin/ls-files.c
diff options
authorJunio C Hamano <>2013-07-22 18:24:11 (GMT)
committerJunio C Hamano <>2013-07-22 18:24:11 (GMT)
commit988f98f61fc80021311c2d161084c03a55f7354d (patch)
treeb38485fc5a6b4e4fd70c37cf93e76cdeaae6a6b8 /builtin/ls-files.c
parentc714f9fd8addc752aaaf1f97bb2be311d9156def (diff)
parentabd4284bc62127a2db69c8c81501a56bb29284c8 (diff)
Merge branch 'jx/clean-interactive'
Add "interactive" mode to "git clean". The early part to refactor relative path related helper functions looked sensible. * jx/clean-interactive: test: run testcases with POSIX absolute paths on Windows test: add t7301 for git-clean--interactive git-clean: add documentation for interactive git-clean git-clean: add ask each interactive action git-clean: add select by numbers interactive action git-clean: add filter by pattern interactive action git-clean: use a git-add-interactive compatible UI git-clean: add colors to interactive git-clean git-clean: show items of del_list in columns git-clean: add support for -i/--interactive git-clean: refactor git-clean into two phases write_name{_quoted_relative,}(): remove redundant parameters quote_path_relative(): remove redundant parameter quote.c: substitute path_relative with relative_path path.c: refactor relative_path(), not only strip prefix test: add test cases for relative_path
Diffstat (limited to 'builtin/ls-files.c')
1 files changed, 11 insertions, 7 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 80fff23..5cf3e31 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -46,10 +46,14 @@ static const char *tag_modified = "";
static const char *tag_skip_worktree = "";
static const char *tag_resolve_undo = "";
-static void write_name(const char* name, size_t len)
+static void write_name(const char *name)
- write_name_quoted_relative(name, len, prefix, prefix_len, stdout,
- line_terminator);
+ /*
+ * With "--full-name", prefix_len=0; this caller needs to pass
+ * an empty string in that case (a NULL is good for "").
+ */
+ write_name_quoted_relative(name, prefix_len ? prefix : NULL,
+ stdout, line_terminator);
static void show_dir_entry(const char *tag, struct dir_entry *ent)
@@ -63,7 +67,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
fputs(tag, stdout);
- write_name(ent->name, ent->len);
+ write_name(ent->name);
static void show_other_files(struct dir_struct *dir)
@@ -163,7 +167,7 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)
- write_name(ce->name, ce_namelen(ce));
+ write_name(ce->name);
if (debug_mode) {
const struct stat_data *sd = &ce->ce_stat_data;
@@ -198,7 +202,7 @@ static void show_ru_info(void)
printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
find_unique_abbrev(ui->sha1[i], abbrev),
i + 1);
- write_name(path, len);
+ write_name(path);
@@ -391,7 +395,7 @@ int report_path_error(const char *ps_matched, const char **pathspec, const char
if (found_dup)
- name = quote_path_relative(pathspec[num], -1, &sb, prefix);
+ name = quote_path_relative(pathspec[num], prefix, &sb);
error("pathspec '%s' did not match any file(s) known to git.",