{"thread":{"id":"3343","subject":"[PATCH] Detect misspelled pathspec to git-add","startedAt":"2006-02-15T09:14:54Z","lastAt":"2006-02-15T10:45:05Z","messageCount":2,"participants":["Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"16201","messageId":"7v1wy5m19t.fsf@assigned-by-dhcp.cox.net","threadId":"3343","inReplyTo":null,"subject":"[PATCH] Detect misspelled pathspec to git-add","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-15T09:14:54Z","receivedAt":"2006-02-15T09:14:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is in the same spirit as an earlier patch for git-commit.\nIt does an extra ls-files to avoid complaining when a fully\ntracked directory name is given on the command line (otherwise\n--others restriction would say the pathspec does not match).\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * I noticed this when I accidentally said \"git add /a/b/c\"\n   when I meant \"git add a/b/c\", and I did not notice it until\n   I said \"git commit\" which said \"Nothing to commit.\"\n\n   It does one extra ls-files only if any pathspec is given; I\n   am hoping this slight performance hit is tolerated.  I think\n   people who does \"git add .\" all the time to mean \"add\n   everything I added anywhere since I did git add last time\"\n   deserve it ;-).\n\n   Comments?\n\n git-add.sh |   11 +++++++++++\n 1 files changed, 11 insertions(+), 0 deletions(-)\n\nca28a7e03232b9a3b66df8519d9ee827882c83c1\ndiff --git a/git-add.sh b/git-add.sh\nindex f719b4b..13fad82 100755\n--- a/git-add.sh\n+++ b/git-add.sh\n@@ -24,6 +24,17 @@ while : ; do\n   shift\n done\n \n+# Check misspelled pathspec\n+case \"$#\" in\n+0)\t;;\n+*)\n+\tgit-ls-files --error-unmatch --others --cached -- \"$@\" >/dev/null || {\n+\t\techo >&2 \"Maybe you misspelled it?\"\n+\t\texit 1\n+\t}\n+\t;;\n+esac\n+\n if test -f \"$GIT_DIR/info/exclude\"\n then\n \tgit-ls-files -z \\\n-- \n1.2.0.gcfba7\n"},{"id":"16207","messageId":"Pine.LNX.4.63.0602151144360.9480@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3343","inReplyTo":"7v1wy5m19t.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Detect misspelled pathspec to git-add","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-02-15T10:45:05Z","receivedAt":"2006-02-15T10:45:05Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 15 Feb 2006, Junio C Hamano wrote:\n\n>    Comments?\n\nI like it.\n\nCiao,\nDscho\n"}]}