Skip to content

Commit

Permalink
ls-files: Give hints when errors happen.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andreas Ericsson authored and Junio C Hamano committed Dec 2, 2006
1 parent 67c08ce commit ced7b82
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin-ls-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ced7b82

Please sign in to comment.