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
This commit is contained in:
@ -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)
|
||||
return;
|
||||
|
||||
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)
|
||||
find_unique_abbrev(ce->sha1,abbrev),
|
||||
ce_stage(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)
|
||||
continue;
|
||||
|
||||
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.",
|
||||
name);
|
||||
errors++;
|
||||
|
Reference in New Issue
Block a user