{"thread":{"id":"43590","subject":"[PATCH] ls-files: Give hints when errors happen.","startedAt":"2006-11-30T11:28:28Z","lastAt":"2006-11-30T11:28:28Z","messageCount":1,"participants":["Andreas Ericsson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"295748","messageId":"20061130115908.942AF5BA19@nox.op5.se","threadId":"43590","inReplyTo":null,"subject":"[PATCH] ls-files: Give hints when errors happen.","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-11-30T11:28:28Z","receivedAt":"2006-11-30T11:28:28Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Without this patch \"git commit file.c file2.c\" produces the not\nso stellar output:\n\n\terror: pathspec 'file.c' did not match any.\n\terror: pathspec 'file2.c' did not match any.\n\nWith this patch, the output is changed to:\n\n\terror: pathspec 'file.c' did not match any file(s) known to git.\n\terror: pathspec 'file2.c' did not match any file(s) known to git.\n\tDid you forget to 'git add'?\n\nSigned-off-by: Andreas Ericsson <ae@op5.se>\n---\n builtin-ls-files.c |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-ls-files.c b/builtin-ls-files.c\nindex ad8c41e..bc79ce4 100644\n--- a/builtin-ls-files.c\n+++ b/builtin-ls-files.c\n@@ -487,10 +487,14 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)\n \t\tfor (num = 0; pathspec[num]; num++) {\n \t\t\tif (ps_matched[num])\n \t\t\t\tcontinue;\n-\t\t\terror(\"pathspec '%s' did not match any.\",\n+\t\t\terror(\"pathspec '%s' did not match any file(s) known to git.\",\n \t\t\t      pathspec[num] + prefix_offset);\n \t\t\terrors++;\n \t\t}\n+\n+\t\tif (errors)\n+\t\t\tfprintf(stderr, \"Did you forget to 'git add'?\\n\");\n+\n \t\treturn errors ? 1 : 0;\n \t}\n \n-- \n1.4.4.1.GIT\n"}]}