{"thread":{"id":"32388","subject":"[PATCH v3] git-completion.bash: add support for path completion","startedAt":"2012-12-18T17:25:10Z","lastAt":"2012-12-18T20:29:50Z","messageCount":5,"participants":["Manlio Perillo","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"205135","messageId":"1355851510-13438-1-git-send-email-manlio.perillo@gmail.com","threadId":"32388","inReplyTo":null,"subject":"[PATCH v3] git-completion.bash: add support for path completion","fromName":"Manlio Perillo","fromEmail":"manlio.perillo@gmail.com","sentAt":"2012-12-18T17:25:10Z","receivedAt":"2012-12-18T17:25:10Z","isPatch":true,"sender":{"key":"manlio.perillo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6217088?v=4"},"body":"The git-completion.bash script did not implemented full, git aware,\nsupport for completion, for git commands that operate on files within\nthe current working directory or the index.\n\nFor these commands, only long options completion was available.\nAs an example:\n\n\tgit add <TAB>\n\nwill suggest all files in the current working directory, including\nignored files and files that have not been modified.\n\nFull support for completion is now implemented, for git commands where\nthe non-option arguments always refer to paths within the current\nworking directory or the index, as the follow:\n\n* the path completion for the \"git mv\", \"git rm\" and \"git ls-tree\"\n  commands will suggest all cached files.\n\n* the path completion for the \"git add\" command will suggest all\n  untracked and modified files.  Ignored files are excluded.\n\n* the path completion for the \"git clean\" command will suggest all\n  untracked files.  Ignored files are excluded.\n\n* the path completion for the \"git commit\" command will suggest all\n  files that have been modified from the HEAD.\n\nFor all affected commands, completion will always stop at directory\nboundary.  Only standard ignored files are excluded, using the\n--exclude-standard option of the ls-files command.\n\nSigned-off-by: Manlio Perillo <manlio.perillo@gmail.com>\n---\n contrib/completion/git-completion.bash | 112 ++++++++++++++++++++++++++++-----\n 1 file changed, 97 insertions(+), 15 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0b77eb1..923ef37 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -13,6 +13,7 @@\n #    *) .git/remotes file names\n #    *) git 'subcommands'\n #    *) tree paths within 'ref:path/to/file' expressions\n+#    *) file paths within current working directory and index\n #    *) common --long-options\n #\n # To use these routines:\n@@ -233,6 +234,59 @@ __gitcomp_nl ()\n \tCOMPREPLY=($(compgen -P \"${2-}\" -S \"${4- }\" -W \"$1\" -- \"${3-$cur}\"))\n }\n \n+# Perl filter used to process path list returned by ls-files and\n+# diff-index --name-only commands, in order to list file names\n+# relative to a specified directory, and append a slash to directory\n+# names.\n+# The script expects the prefix path in the \"pfx\" environ variable.\n+# The output must be processed with the uniq filter, to remove\n+# duplicate directories.\n+# XXX remove duplicates in the Perl script ?\n+__git_index_file_list_filter='$pfx = $ENV{\"pfx\"};\n+\t\t\t$idx = index($_, $pfx);\n+\t\t\tif ($idx == 0) {\n+\t\t\t\t$_ = substr $_, length($pfx);\n+\t\t\t\t@segments = split(\"/\", $_);\n+\t\t\t\tif ($segments[1]) {\n+\t\t\t\t\tprint $segments[0], \"/\\n\"\n+\t\t\t\t} else {\n+\t\t\t\t\tprint $segments[0], \"\\n\"\n+\t\t\t\t}\n+\t\t\t}'\n+\n+# __git_files accepts 1 or 2 arguments:\n+# 1: A string for file index status mode (\"c\", \"m\", \"d\", \"o\"), as\n+#    supported by git ls-files command.  This is required.\n+# 2: An optional directory path.  If provided, only files within the\n+#    specified directory are listed.  Sub directories are never recursed.\n+#    Path must have a trailing slash.\n+__git_files ()\n+{\n+\tlocal dir=\"$(__gitdir)\" flags=\"-${1}\"\n+\n+\tif [ -d \"$dir\" ]; then\n+\t\tgit --git-dir=\"$dir\" ls-files --exclude-standard ${flags} ${pfx} \\\n+\t\t\t| pfx=$2 perl -ne \"${__git_index_file_list_filter}\" \\\n+\t\t\t| uniq\n+\t\treturn\n+\tfi\n+}\n+\n+# __git_commit_files accepts 1 optional argument: a directory path.\n+# If provided, only files within the specified directory are listed.\n+# Sub directories are never recursed.  Path must have a trailing slash.\n+__git_commit_files ()\n+{\n+\tlocal dir=\"$(__gitdir)\"\n+\n+\tif [ -d \"$dir\" ]; then\n+\t\tgit --git-dir=\"$dir\" diff-index --name-only HEAD \\\n+\t\t\t| pfx=$1 perl -ne \"${__git_index_file_list_filter}\" \\\n+\t\t\t| uniq\n+\t\treturn\n+\tfi\n+}\n+\n __git_heads ()\n {\n \tlocal dir=\"$(__gitdir)\"\n@@ -430,6 +484,25 @@ __git_complete_revlist_file ()\n }\n \n \n+# __git_complete_index_file requires 1 argument, the file index\n+# status mode\n+_git_complete_index_file ()\n+{\n+\tlocal pfx cur_=\"$cur\" flags=${1}\n+\tcase \"$cur_\" in\n+\t\t?*/*)\n+\t\t\tpfx=\"${cur_%/*}\"\n+\t\t\tcur_=\"${cur_##*/}\"\n+\t\t\tpfx=\"${pfx}/\"\n+\n+\t\t\t__gitcomp_nl \"$(__git_files ${flags} ${pfx})\" \"$pfx\" \"$cur_\" \"\"\n+\t\t\t;;\n+\t\t*)\n+\t\t\t__gitcomp_nl \"$(__git_files ${flags})\" \"\" \"$cur_\" \"\"\n+\t\t\t;;\n+\tesac\n+}\n+\n __git_complete_file ()\n {\n \t__git_complete_revlist_file\n@@ -770,8 +843,6 @@ _git_apply ()\n \n _git_add ()\n {\n-\t__git_has_doubledash && return\n-\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp \"\n@@ -780,7 +851,8 @@ _git_add ()\n \t\t\t\"\n \t\treturn\n \tesac\n-\tCOMPREPLY=()\n+\t# XXX should we check for --update and --all options ?\n+\t_git_complete_index_file \"om\"\n }\n \n _git_archive ()\n@@ -930,15 +1002,14 @@ _git_cherry_pick ()\n \n _git_clean ()\n {\n-\t__git_has_doubledash && return\n-\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp \"--dry-run --quiet\"\n \t\treturn\n \t\t;;\n \tesac\n-\tCOMPREPLY=()\n+\t# XXX should we check for -x option ?\n+\t_git_complete_index_file \"o\"\n }\n \n _git_clone ()\n@@ -969,7 +1040,7 @@ _git_clone ()\n \n _git_commit ()\n {\n-\t__git_has_doubledash && return\n+\tlocal pfx cur_=${cur}\n \n \tcase \"$cur\" in\n \t--cleanup=*)\n@@ -997,8 +1068,20 @@ _git_commit ()\n \t\t\t--verbose --quiet --fixup= --squash=\n \t\t\t\"\n \t\treturn\n+\t\t;;\n+\t?*/*)\n+\t\tpfx=\"${cur_%/*}\"\n+\t\tcur_=\"${cur_##*/}\"\n+\t\tpfx=\"${pfx}/\"\n+\n+\t\t__gitcomp_nl \"$(__git_commit_files ${pfx})\" \"$pfx\" \"$cur_\" \"\"\n+\t\treturn\n+\t\t;;\n+\t*)\n+\t\t__gitcomp_nl \"$(__git_commit_files)\" \"\" \"$cur_\" \"\"\n+\t\treturn\n+\t\t;;\n \tesac\n-\tCOMPREPLY=()\n }\n \n _git_describe ()\n@@ -1216,8 +1299,6 @@ _git_init ()\n \n _git_ls_files ()\n {\n-\t__git_has_doubledash && return\n-\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp \"--cached --deleted --modified --others --ignored\n@@ -1230,7 +1311,9 @@ _git_ls_files ()\n \t\treturn\n \t\t;;\n \tesac\n-\tCOMPREPLY=()\n+\t# XXX ignore options like --modified and always suggest all cached\n+\t# files.\n+\t_git_complete_index_file \"c\"\n }\n \n _git_ls_remote ()\n@@ -1362,7 +1445,8 @@ _git_mv ()\n \t\treturn\n \t\t;;\n \tesac\n-\tCOMPREPLY=()\n+\t# XXX needs more work\n+\t_git_complete_index_file \"c\"\n }\n \n _git_name_rev ()\n@@ -2068,15 +2152,13 @@ _git_revert ()\n \n _git_rm ()\n {\n-\t__git_has_doubledash && return\n-\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp \"--cached --dry-run --ignore-unmatch --quiet\"\n \t\treturn\n \t\t;;\n \tesac\n-\tCOMPREPLY=()\n+\t_git_complete_index_file \"c\"\n }\n \n _git_shortlog ()\n-- \n1.8.1.rc1.18.g9db0d25\n"},{"id":"205138","messageId":"7v1uengsbm.fsf@alter.siamese.dyndns.org","threadId":"32388","inReplyTo":"1355851510-13438-1-git-send-email-manlio.perillo@gmail.com","subject":"Re: [PATCH v3] git-completion.bash: add support for path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-18T17:53:33Z","receivedAt":"2012-12-18T17:53:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"[jch: cc'ed git-completion experts to review implementation details]\n\nManlio Perillo <manlio.perillo@gmail.com> writes:\n\n> The git-completion.bash script did not implemented full, git aware,\n> support for completion, for git commands that operate on files within\n> the current working directory or the index.\n>\n> For these commands, only long options completion was available.\n\nI find the \"long options completion\" is a misleading phrase.  It\nsounds as if you changed the current completion that does not\ncomplete \"git commit -<TAB>\" but does \"git commit --<TAB>\" to\ncomplete the short options (e.g. \"git commit -c\"), but I do not\nthink that is the topic of this patch.\n\n> As an example:\n>\n> \tgit add <TAB>\n>\n> will suggest all files in the current working directory, including\n> ignored files and files that have not been modified.\n>\n> Full support for completion is now implemented, for git commands where\n\ns/Full.*implemented/Support more comprehensive completion/; or\nsomething, talking in the imperative mood (i.e. as if you are giving\nthe order to the codebase to do something).\n\n> the non-option arguments always refer to paths within the current\n> working directory or the index, as the follow:\n>\n> * the path completion for the \"git mv\", \"git rm\" and \"git ls-tree\"\n>   commands will suggest all cached files.\n\nI thought you dropped \"git mv\" in this round.\n\n> * the path completion for the \"git add\" command will suggest all\n>   untracked and modified files.  Ignored files are excluded.\n>\n> * the path completion for the \"git clean\" command will suggest all\n>   untracked files.  Ignored files are excluded.\n>\n> * the path completion for the \"git commit\" command will suggest all\n>   files that have been modified from the HEAD.\n>\n> For all affected commands, completion will always stop at directory\n> boundary.  Only standard ignored files are excluded, using the\n> --exclude-standard option of the ls-files command.\n\nI read \"always stop at directory boundary\" to mean that\n\n\tgit cmd t<TAB>\n\nwill give us \"t/ tag.c\" (assuming there is a new or modified file in\nt/ and tag.c is the only modified file at the root level that begins\nwith \"t\") and then\n\n\tgit cmd t/<TAB>\n\nwill likewise show the files and top-level subdirectories within t/\ndirectory.  That would be great.\n\n> Signed-off-by: Manlio Perillo <manlio.perillo@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 112 ++++++++++++++++++++++++++++-----\n>  1 file changed, 97 insertions(+), 15 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 0b77eb1..923ef37 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -13,6 +13,7 @@\n>  #    *) .git/remotes file names\n>  #    *) git 'subcommands'\n>  #    *) tree paths within 'ref:path/to/file' expressions\n> +#    *) file paths within current working directory and index\n>  #    *) common --long-options\n>  #\n>  # To use these routines:\n> @@ -233,6 +234,59 @@ __gitcomp_nl ()\n>  \tCOMPREPLY=($(compgen -P \"${2-}\" -S \"${4- }\" -W \"$1\" -- \"${3-$cur}\"))\n>  }\n>  \n> +# Perl filter used to process path list returned by ls-files and\n> +# diff-index --name-only commands, in order to list file names\n> +# relative to a specified directory, and append a slash to directory\n> +# names.\n> +# The script expects the prefix path in the \"pfx\" environ variable.\n> +# The output must be processed with the uniq filter, to remove\n> +# duplicate directories.\n> +# XXX remove duplicates in the Perl script ?\n\nSurely, that will remove one fork/exec with pipeline.  I am not sure\nwhat the performance implication of using Perl here, but because we\ndo not have to stick to POSIX shell in this file, the completion\nexperts would be able to help rewriting this logic as a pure bash\nscript.\n\n> +__git_index_file_list_filter='$pfx = $ENV{\"pfx\"};\n> +\t\t\t$idx = index($_, $pfx);\n> +\t\t\tif ($idx == 0) {\n> +\t\t\t\t$_ = substr $_, length($pfx);\n> +\t\t\t\t@segments = split(\"/\", $_);\n> +\t\t\t\tif ($segments[1]) {\n> +\t\t\t\t\tprint $segments[0], \"/\\n\"\n> +\t\t\t\t} else {\n> +\t\t\t\t\tprint $segments[0], \"\\n\"\n> +\t\t\t\t}\n> +\t\t\t}'\n> +\n> +# __git_files accepts 1 or 2 arguments:\n> +# 1: A string for file index status mode (\"c\", \"m\", \"d\", \"o\"), as\n> +#    supported by git ls-files command.  This is required.\n> +# 2: An optional directory path.  If provided, only files within the\n> +#    specified directory are listed.  Sub directories are never recursed.\n> +#    Path must have a trailing slash.\n> +__git_files ()\n> +{\n> +\tlocal dir=\"$(__gitdir)\" flags=\"-${1}\"\n> +\n> +\tif [ -d \"$dir\" ]; then\n> +\t\tgit --git-dir=\"$dir\" ls-files --exclude-standard ${flags} ${pfx} \\\n> +\t\t\t| pfx=$2 perl -ne \"${__git_index_file_list_filter}\" \\\n> +\t\t\t| uniq\n\nThis is purely a style thing (note that style suggestions are not\noptional), but\n\n        the data source command |\n        a filter command |\n        another filter command\n\nis easier to read and can be spelled without the backslash.  The\nsame comment applies to git-commit-files as well.\n\nThanks.\n"},{"id":"205143","messageId":"50D0BC32.2020401@gmail.com","threadId":"32388","inReplyTo":"7v1uengsbm.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v3] git-completion.bash: add support for path completion","fromName":"Manlio Perillo","fromEmail":"manlio.perillo@gmail.com","sentAt":"2012-12-18T18:55:46Z","receivedAt":"2012-12-18T18:55:46Z","isPatch":true,"sender":{"key":"manlio.perillo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6217088?v=4"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nIl 18/12/2012 18:53, Junio C Hamano ha scritto:\n> [jch: cc'ed git-completion experts to review implementation details]\n> \n> Manlio Perillo <manlio.perillo@gmail.com> writes:\n> \n>> The git-completion.bash script did not implemented full, git aware,\n>> support for completion, for git commands that operate on files within\n>> the current working directory or the index.\n>>\n>> For these commands, only long options completion was available.\n> \n> I find the \"long options completion\" is a misleading phrase.  It\n> sounds as if you changed the current completion that does not\n> complete \"git commit -<TAB>\" but does \"git commit --<TAB>\" to\n> complete the short options (e.g. \"git commit -c\"), but I do not\n> think that is the topic of this patch.\n> \n\nIt does not sound misleading to me.\nI'm saying that the git-completion.bash script only implemented\ncompletion for long options, but not for file names in the current\nworking directory.\n\nDo you think I should rewrite the subject and the log message introduction?\n\nAs an example, something like this in the subject:\n\n  git-completion.bash: improve some git commands completion\n\nand in the message:\n\n  The git-completion.bash script did not implemented full, git aware,\n  support for completion, for git commands that operate on files within\n  the current working directory or the index.\n\n  As an example:\n\n ...\n\nI'm still not fully satisfied with it, however.\nIt still requires reading the full message to understand the changes\nimplemented.\n\n>> As an example:\n>>\n>> \tgit add <TAB>\n>>\n>> will suggest all files in the current working directory, including\n>> ignored files and files that have not been modified.\n>>\n>> Full support for completion is now implemented, for git commands where\n> \n> s/Full.*implemented/Support more comprehensive completion/; or\n> something, talking in the imperative mood (i.e. as if you are giving\n> the order to the codebase to do something).\n> \n\nOk.\n\n>> the non-option arguments always refer to paths within the current\n>> working directory or the index, as the follow:\n>>\n>> * the path completion for the \"git mv\", \"git rm\" and \"git ls-tree\"\n>>   commands will suggest all cached files.\n> \n> I thought you dropped \"git mv\" in this round.\n> \n\nWell, no.\nBut the current implementation should not cause problems.\nAlso note that I added support for ls-files, too.\n\nThere are some XXX marks in the code, but I think that the changes\nalways improve the old behaviour.\n\n> [...]\n>> For all affected commands, completion will always stop at directory\n>> boundary.  Only standard ignored files are excluded, using the\n>> --exclude-standard option of the ls-files command.\n> \n> I read \"always stop at directory boundary\" to mean that\n> \n> \tgit cmd t<TAB>\n> \n> will give us \"t/ tag.c\" (assuming there is a new or modified file in\n> t/ and tag.c is the only modified file at the root level that begins\n> with \"t\") and then\n> \n> \tgit cmd t/<TAB>\n> \n> will likewise show the files and top-level subdirectories within t/\n> directory.  That would be great.\n> \n\nYes, this is how it works, bugs excluded (I'm not a bash/perl expert).\n\n\n> [...]\n>> +# Perl filter used to process path list returned by ls-files and\n>> +# diff-index --name-only commands, in order to list file names\n>> +# relative to a specified directory, and append a slash to directory\n>> +# names.\n>> +# The script expects the prefix path in the \"pfx\" environ variable.\n>> +# The output must be processed with the uniq filter, to remove\n>> +# duplicate directories.\n>> +# XXX remove duplicates in the Perl script ?\n> \n> Surely, that will remove one fork/exec with pipeline.  I am not sure\n> what the performance implication of using Perl here, but because we\n> do not have to stick to POSIX shell in this file, the completion\n> experts would be able to help rewriting this logic as a pure bash\n> script.\n> \n\nOk. I'll wait for a review from git-completion experts.\n\nNote that the performance is the reason why I suggested, in a previous\nemail, that git should have some more options to format data in custom ways.\nAs an example, there is no way to tell ls-files to not recurse\ndirectories, and there is no way to also get the file type.\n\nA --no-recurse option, and a change in the code to make, as an example\n\n  git ls-files --stage --modified\n\nto honor the --modified option,  will probably make it possible to use a\nsimple sed filter (there is still the problem that, unlike ls-tree,\nls-files shows the complete file path).\n\n> [...]\n>> +__git_files ()\n>> +{\n>> +\tlocal dir=\"$(__gitdir)\" flags=\"-${1}\"\n>> +\n>> +\tif [ -d \"$dir\" ]; then\n>> +\t\tgit --git-dir=\"$dir\" ls-files --exclude-standard ${flags} ${pfx} \\\n>> +\t\t\t| pfx=$2 perl -ne \"${__git_index_file_list_filter}\" \\\n>> +\t\t\t| uniq\n> \n> This is purely a style thing (note that style suggestions are not\n> optional), but\n> \n>         the data source command |\n>         a filter command |\n>         another filter command\n> \n> is easier to read and can be spelled without the backslash.  The\n> same comment applies to git-commit-files as well.\n> \n\nI agree.\n\nBut I was copying the style currently used in the script\n(see the __git_complete_revlist_file function).\n\nNote that I plan to do a small code refactorization, since I need the\nls-tree support code from __git_complete_revlist_file function for a\nfuture change. I can fix these style issues in that patch.\n\nI plan to improve completion support for checkout and reset commands,\ntoo (currently only the commit/tree-ish argument is autocompleted, but\nnot the path).\n\n\nRegards  Manlio\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niEYEARECAAYFAlDQvDIACgkQscQJ24LbaUTT9wCgh6jtbhdQ7GNIkqCq34QjXdIs\nw9QAnjz2VjPFm4n2ICkcWWEsqWDWM+Hm\n=8/Ad\n-----END PGP SIGNATURE-----\n"},{"id":"205148","messageId":"7vpq27f9m7.fsf@alter.siamese.dyndns.org","threadId":"32388","inReplyTo":"50D0BC32.2020401@gmail.com","subject":"Re: [PATCH v3] git-completion.bash: add support for path completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-18T19:22:56Z","receivedAt":"2012-12-18T19:22:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Manlio Perillo <manlio.perillo@gmail.com> writes:\n\n> Il 18/12/2012 18:53, Junio C Hamano ha scritto:\n>> [jch: cc'ed git-completion experts to review implementation details]\n>> \n>> Manlio Perillo <manlio.perillo@gmail.com> writes:\n>> \n>>> The git-completion.bash script did not implemented full, git aware,\n>>> support for completion, for git commands that operate on files within\n>>> the current working directory or the index.\n>>>\n>>> For these commands, only long options completion was available.\n>> \n>> I find the \"long options completion\" is a misleading phrase.  It\n>> sounds as if you changed the current completion that does not\n>> complete \"git commit -<TAB>\" but does \"git commit --<TAB>\" to\n>> complete the short options (e.g. \"git commit -c\"), but I do not\n>> think that is the topic of this patch.\n>> \n>\n> It does not sound misleading to me.\n> I'm saying that the git-completion.bash script only implemented\n> completion for long options, but not for file names in the current\n> working directory.\n>\n> Do you think I should rewrite the subject and the log message introduction?\n\nThe subject sounds fine; it is just \"It only does long options\"\nsounded as if it were viewing the lack of \"short options\" support as\nan issue.  In other words, my knee-jerk answer to \"long options, as\nopposed to what???\" question was \"short options\", not \"files\".\n\nIf the phrase were \"It only does options\", the question would become\n\"options as opposed to what???\", which may have given me a chance to\nguess \"files\" as the answer to that question.\n\n> As an example, something like this in the subject:\n>\n>   git-completion.bash: improve some git commands completion\n\nI think the original is better; you do not touch any \"options\",\neither long or short.  You are improving \"paths\", and the original\nis much clearer on that point.\n\n>\n> and in the message:\n>\n>   The git-completion.bash script did not implemented full, git aware,\n>   support for completion, for git commands that operate on files within\n\nWith s/for completion/to complete paths/, it would be perfect.  You\ndo not touch options, and this new log message does not talk about\nit.  Much nicer than the one that was posted.\n\n> Note that the performance is the reason why I suggested, in a previous\n> email, that git should have some more options to format data in custom ways.\n> As an example, there is no way to tell ls-files to not recurse\n> directories, and there is no way to also get the file type.\n\nTo ls-files, no-recurse is an idiotic thing to ask.  The index is a\nflat structure that is read as a whole.  There is no recursion\ninvolved.\n"},{"id":"205153","messageId":"50D0D23E.3010104@gmail.com","threadId":"32388","inReplyTo":"7vpq27f9m7.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v3] git-completion.bash: add support for path completion","fromName":"Manlio Perillo","fromEmail":"manlio.perillo@gmail.com","sentAt":"2012-12-18T20:29:50Z","receivedAt":"2012-12-18T20:29:50Z","isPatch":true,"sender":{"key":"manlio.perillo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6217088?v=4"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nIl 18/12/2012 20:22, Junio C Hamano ha scritto:\n> [...]\n>> Note that the performance is the reason why I suggested, in a previous\n>> email, that git should have some more options to format data in custom ways.\n>> As an example, there is no way to tell ls-files to not recurse\n>> directories, and there is no way to also get the file type.\n> \n> To ls-files, no-recurse is an idiotic thing to ask.  The index is a\n> flat structure that is read as a whole.  There is no recursion\n> involved.\n\nWhat about an option like --as-tree, so that ls-files will list the\nfiles as they were in a tree, instead of a flat structure ?\n\n\nThanks  Manlio\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niEYEARECAAYFAlDQ0j4ACgkQscQJ24LbaURXoACffQ4iz6MsoeffEZEBib1b1KF8\nNZsAoIUXa7OonWyFxfJ35mukBK/sddGr\n=0nO7\n-----END PGP SIGNATURE-----\n"}]}