Re: [PATCH] pathspec: prevent empty strings as pathspecs

2016-06-19 Thread Emily Xie
Thanks for the quick responses on this patch! In response to Junio: > "At least you would need two-step process to introduce a change like > this to warn the people whose tools and workflows you are breaking. > That is, (1) in one release, you add code to only detect the case > you will be changi

Re: [PATCH] pathspec: prevent empty strings as pathspecs

2016-06-18 Thread Junio C Hamano
David Turner writes: > The help for rev-parse --show-prefix says: > "When the command is invoked from a subdirectory, show the path of > the current directory relative to the top-level directory." > > This doesn't say what it does when invoked at the top-level. Maybe we > should just change it t

Re: [PATCH] pathspec: prevent empty strings as pathspecs

2016-06-18 Thread David Turner
On 06/18/2016 11:10 PM, Junio C Hamano wrote: Emily Xie writes: For any command that takes a pathspec, passing an empty string will execute the command on all files in the current directory. This results in unexpected behavior. For example, git add "" adds all files to staging, while git rm -r

Re: [PATCH] pathspec: prevent empty strings as pathspecs

2016-06-18 Thread Junio C Hamano
Emily Xie writes: > For any command that takes a pathspec, passing an empty string will > execute the command on all files in the current directory. This > results in unexpected behavior. For example, git add "" adds all > files to staging, while git rm -rf "" recursively removes all files > from

Re: [PATCH] pathspec: prevent empty strings as pathspecs

2016-06-18 Thread Eric Sunshine
On Sat, Jun 18, 2016 at 9:49 PM, David Turner wrote: > On Sat, 2016-06-18 at 20:57 -0400, Emily Xie wrote: >> + while (argv[n]) { >> + if (*argv[n] == '\0') { >> + die("Empty string is not a valid pathspec."); >> + } > > nit: git style doesn't use {}

Re: [PATCH] pathspec: prevent empty strings as pathspecs

2016-06-18 Thread David Turner
On Sat, 2016-06-18 at 20:57 -0400, Emily Xie wrote: > For any command that takes a pathspec, passing an empty string will > execute the command on all files in the current directory. This > results in unexpected behavior. For example, git add "" adds all > files to staging, while git rm -rf "" recu

[PATCH] pathspec: prevent empty strings as pathspecs

2016-06-18 Thread Emily Xie
For any command that takes a pathspec, passing an empty string will execute the command on all files in the current directory. This results in unexpected behavior. For example, git add "" adds all files to staging, while git rm -rf "" recursively removes all files from the working tree and index. T