@matheusbsbs / matheus-bagliano / commits / ced7b828fa
Fork 0

ls-files: Give hints when errors happen.

Without this patch "git commit file.c file2.c" produces the not so stellar output: error: pathspec 'file.c' did not match any. error: pathspec 'file2.c' did not match any. With this patch, the output is changed to: error: pathspec 'file.c' did not match any file(s) known to git. error: pathspec 'file2.c' did not match any file(s) known to git. Did you forget to 'git add'? Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>

Andreas Ericsson committed Nov 30, 2006 at 12:28 UTC ced7b828fadbf3d6de49d75392f1516b4ceb4491
1 file changed +5 -1
builtin-ls-files.c
+5 -1
@@ -487,10 +487,14 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
487 for (num = 0; pathspec[num]; num++) {
488 if (ps_matched[num])
489 continue;
490 - error("pathspec '%s' did not match any.",
490 + error("pathspec '%s' did not match any file(s) known to git.",
491 pathspec[num] + prefix_offset);
492 errors++;
493 }
494 +
495 + if (errors)
496 + fprintf(stderr, "Did you forget to 'git add'?\n");
497 +
498 return errors ? 1 : 0;
499 }
500