git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 26, 2010, 05:07 UTC
Message-ID
<7v1vczqmhw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100522163525.GA12420@localhost>
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()
s/info()/info(void)/;
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.
Previous: Clemens BuchacherNext: Clemens Buchacher
Message 2 of 3 in “ls-files: allow relative pathspec”
  1. ls-files: allow relative pathspecClemens Buchacher, May 22, 2010
  2. Junio C HamanoMay 26, 2010
  3. ls-files: allow relative pathspecClemens Buchacher, May 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.