git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] ls-files: Give hints when errors happen.
@ 2006-11-30 11:28 Andreas Ericsson
  0 siblings, 0 replies; only message in thread
From: Andreas Ericsson @ 2006-11-30 11:28 UTC (permalink / raw
  To: git

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>
---
 builtin-ls-files.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index ad8c41e..bc79ce4 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;
 	}
 
-- 
1.4.4.1.GIT

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-11-30 11:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30 11:28 [PATCH] ls-files: Give hints when errors happen Andreas Ericsson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).