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

Re: [PATCH 02/16] list-files: make :(glob) pathspec default

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 12, 2015, 21:10 UTC
Message-ID
<xmqqwq2l2a70.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1425896314-10941-3-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 17 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  builtin/list-files.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/builtin/list-files.c b/builtin/list-files.c
> index ac33f13..b99f2b7 100644
> --- a/builtin/list-files.c
> +++ b/builtin/list-files.c
> @@ -65,6 +65,8 @@ int cmd_list_files(int argc, const char **argv, const char *cmd_prefix)
>  {
>  	struct string_list result = STRING_LIST_INIT_NODUP;
>  
> +	setenv(GIT_GLOB_PATHSPECS_ENVIRONMENT, "1", 0);
> +
>  	if (argc == 2 && !strcmp(argv[1], "-h"))
>  		usage_with_options(ls_usage, ls_options);
Yikes.

I do not have enough info at this step in the series to judge if it is sensible to force the :(glob) interpretation as default, but is it something we would want to do commonly to flip the default per Git subcommand? If so, using the environment feels like a clunky way to do that.

How about a two-patch clean-up before this step?
 (1) remove the handling of literal_global and friends that peek
     into various environment variables from prefix_pathspec(),
     which is a function that is repeatedly called for each pathspec
     element given from the command line, and move that logic to
     parse_pathspec(); pass necessary information down to
     prefix_pathspec() as parameter(s);
 (2) allow parse_pathspec() so that the caller can say "the default,
     when there is no environment variable given by the end user to
     tell us otherwise, is to :(glob)".
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 5 of 29 in “nd/list-files redesign”
  1. 00/16 nd/list-files redesignNguyễn Thái Ngọc Duy, Mar 9, 2015
  2. 01/16 list-files: command skeletonNguyễn Thái Ngọc Duy, Mar 9, 2015
  3. Junio C HamanoMar 12, 2015
  4. 02/16 list-files: make :(glob) pathspec defaultNguyễn Thái Ngọc Duy, Mar 9, 2015
  5. Junio C HamanoMar 12, 2015
  6. Duy NguyenMar 14, 2015
  7. 03/16 list-files: show paths relative to cwdNguyễn Thái Ngọc Duy, Mar 9, 2015
  8. Junio C HamanoMar 12, 2015
  9. Junio C HamanoMar 12, 2015
  10. Duy NguyenMar 14, 2015
  11. Junio C HamanoMar 15, 2015
  12. Duy NguyenMar 15, 2015
  13. 04/16 list-files: add tag to each entry, filter duplicate tagsNguyễn Thái Ngọc Duy, Mar 9, 2015
  14. Junio C HamanoMar 12, 2015
  15. 05/16 list-files: add --[no-]column, -C and -1Nguyễn Thái Ngọc Duy, Mar 9, 2015
  16. 06/16 list-files: add --max-depth and -RNguyễn Thái Ngọc Duy, Mar 9, 2015
  17. 07/16 list-files: show directories as well as filesNguyễn Thái Ngọc Duy, Mar 9, 2015
  18. Eric SunshineMar 10, 2015
  19. Duy NguyenMar 10, 2015
  20. 08/16 list-files: add --colorNguyễn Thái Ngọc Duy, Mar 9, 2015
  21. 09/16 list-files: add -F/--classifyNguyễn Thái Ngọc Duy, Mar 9, 2015
  22. 10/16 list-files: new indicator '&' for submodules when -F is usedNguyễn Thái Ngọc Duy, Mar 9, 2015
  23. 11/16 list-files: add --cached and --othersNguyễn Thái Ngọc Duy, Mar 9, 2015
  24. 12/16 list-files: add --ignoredNguyễn Thái Ngọc Duy, Mar 9, 2015
  25. 13/16 list-files: add --unmergedNguyễn Thái Ngọc Duy, Mar 9, 2015
  26. 14/16 list-files: add file modification options -[admADM]Nguyễn Thái Ngọc Duy, Mar 9, 2015
  27. 15/16 list-files: delete redundant cached entriesNguyễn Thái Ngọc Duy, Mar 9, 2015
  28. Eric SunshineMar 10, 2015
  29. 16/16 list-files: make alias 'ls' default to 'list-files'Nguyễn Thái Ngọc Duy, Mar 9, 2015

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.