Re: [PATCH] ls-files: allow relative pathspec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clemens Buchacher <drizzd@xxxxxx> writes:

> 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@xxxxxx>
> ---
>  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()

s/info()/info(void)/;

> @@ -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++.

> @@ -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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]