git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] blame: display a more helpful error message if the file was deleted

From
Alex Henrie <alexhenrie24@gmail.com>
Date
Jan 29, 2016, 03:09 UTC
Message-ID
<1454036971-26287-1-git-send-email-alexhenrie24@gmail.com>
`git blame 22414770 generate-cmdlist.perl` currently results in:
    fatal: cannot stat path '22414770': No such file or directory
This patch changes the error message to:
    fatal: ambiguous argument 'generate-cmdlist.perl': unknown revision
    or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'"

That way, the user knows to rewrite the command as `git blame 22414770 -- generate-cmdlist.perl`.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 builtin/blame.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 55bf5fa..9461a73 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2704,8 +2704,6 @@ parse_done:
 		argv[argc - 1] = "--";
 
 		setup_work_tree();
-		if (!file_exists(path))
-			die_errno("cannot stat path '%s'", path);
 	}
 
 	revs.disable_stdin = 1;
-- 
2.7.0
Next: Alex Henrie
Message 1 of 2 in “blame: display a more helpful error message if the file was deleted”
  1. blame: display a more helpful error message if the file was deletedAlex Henrie, Jan 29, 2016
  2. Alex HenrieJan 29, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.