Please sign in to comment.
pathspec: warn on empty strings as pathspec
An empty string as a pathspec element matches all paths. A buggy script, however, could accidentally assign an empty string to a variable that then gets passed to a Git command invocation, e.g.: path=... compute a path to be removed in $path ... git rm -r "$paht" which would unintentionally remove all paths in the current directory. The fix for this issue requires a two-step approach. As there may be existing scripts that knowingly use empty strings in this manner, the first step simply gives a warning that (1) tells that an empty string will become an invalid pathspec element and (2) asks the user to use "." if they mean to match all. For step two, a follow-up patch several release cycles later will remove the warning and throw an error instead. This patch is the first step. Signed-off-by: Emily Xie <firstname.lastname@example.org> Reported-by: David Turner <email@example.com> Mentored-by: Michail Denchev <firstname.lastname@example.org> Thanks-to: Sarah Sharp <email@example.com> and James Sharp <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com>
- Loading branch information...
Showing with 19 additions and 2 deletions.