summaryrefslogtreecommitdiff
path: root/builtin-ls-files.c
diff options
context:
space:
mode:
authorAndreas Ericsson <ae@op5.se>2006-11-30 12:28:28 +0100
committerJunio C Hamano <junkio@cox.net>2006-12-01 21:55:45 -0800
commitced7b828fadbf3d6de49d75392f1516b4ceb4491 (patch)
treed316e234ab2c58ef4667786cf733d6a4893dcfd6 /builtin-ls-files.c
parent67c08ce14fb488562666ab896541ad75f1bdcca6 (diff)
downloadgit-ced7b828fadbf3d6de49d75392f1516b4ceb4491.tar.gz
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>
Diffstat (limited to 'builtin-ls-files.c')
-rw-r--r--builtin-ls-files.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index ad8c41e731..bc79ce40fc 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -487,10 +487,14 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
for (num = 0; pathspec[num]; num++) {
if (ps_matched[num])
continue;
- error("pathspec '%s' did not match any.",
+ error("pathspec '%s' did not match any file(s) known to git.",
pathspec[num] + prefix_offset);
errors++;
}
+
+ if (errors)
+ fprintf(stderr, "Did you forget to 'git add'?\n");
+
return errors ? 1 : 0;
}