Re: [PATCH] ls-files: allow relative pathspec
Clemens Buchacher <drizzd@aon.at> writes:
Show 27 quoted lines
> git ls-files used to error out if given paths which point outside
> the current working directory, such as '../'. We now allow such
> paths and the output is analogous to git grep -l.
>
> Signed-off-by: Clemens Buchacher <drizzd@aon.at>
> ---
> builtin/ls-files.c | 61 +++++++++++++++++++++++++++++-----------------------
> t/t7010-setup.sh | 12 +++------
> 2 files changed, 38 insertions(+), 35 deletions(-)
>
> diff --git a/builtin/ls-files.c b/builtin/ls-files.c
> index c0fbcdc..441da81 100644
> --- a/builtin/ls-files.c
> +++ b/builtin/ls-files.c
> ...
> @@ -177,19 +185,19 @@ static int show_one_ru(struct string_list_item *item, void *cbdata)
> printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
> find_unique_abbrev(ui->sha1[i], abbrev),
> i + 1);
> - write_name_quoted(path + offset, stdout, line_terminator);
> + write_name(path, len);
> }
> return 0;
> }
>
> -static void show_ru_info(const char *prefix)
> +static void show_ru_info()Show 6 quoted lines
> @@ -265,7 +273,7 @@ static void prune_cache(const char *prefix)
> active_nr = last;
> }
>
> -static const char *verify_pathspec(const char *prefix)
> +static const char *verify_pathspec(const char* prefix)
Please don't; this is not C++.
Show 9 quoted lines
> @@ -456,9 +461,10 @@ static int option_parse_exclude_standard(const struct option *opt,
> return 0;
> }
>
> -int cmd_ls_files(int argc, const char **argv, const char *prefix)
> +int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
> {
> int require_work_tree = 0, show_tag = 0;
> + const char *max_prefix;This variable is used uninitialized when pathspec is NULL, I think.
Other than that, the patch feels sane. Thanks.