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

Re: git add / update-cache --add fails.

From
ECEd L Cashin <ecashin@coraid.com>
Date
Apr 27, 2005, 16:48 UTC
Message-ID
<87ll74go7o.fsf@coraid.com>
In-Reply-To
<E1DQcOc-00054l-00@gondolin.me.apana.org.au>
Herbert Xu <herbert@gondor.apana.org.au> writes:
Show 8 quoted lines
> Rhys Hardwick <rhys@rhyshardwick.co.uk> wrote:
>> 
>> rhys@metatron:~/repo/learning.repo$ strace update-cache --add w1d4p1.c
> ...
>> open("w1d4p1.c", O_RDONLY)              = -1 ENOENT (No such file or 
>> directory)
>
> The file that you're trying to add doesn't exist.
Maybe the user should be informed as soon as update-cache knows that?
update-cache.c: 11388582a830a6161d1c769aa8616bed6f593b8a
--- a/update-cache.c
+++ b/update-cache.c
@@ -98,6 +98,7 @@ static int add_file_to_cache(char *path)
 
 	fd = open(path, O_RDONLY);
 	if (fd < 0) {
+		fprintf(stderr, "update-cache Error: %s\n", strerror(errno));
 		if (errno == ENOENT) {
 			if (allow_remove)
 				return remove_file_from_cache(path);



By the way, I created that patch with "git diff" in my git-pasky
working directory.  Strangely, I had to redirect standard error to the
same place as standard output in order to get the filename in the diff
output.  I didn't check why the filename is on standard error,
though.
-- 
  Ed L Cashin <ecashin@coraid.com>
Previous: Herbert XuNext: Petr Baudis
Message 8 of 14 in “git add / update-cache --add fails.”
  1. Rhys HardwickApr 25, 2005
  2. Rhys HardwickApr 25, 2005
  3. Rhys HardwickApr 25, 2005
  4. Chris WedgwoodApr 25, 2005
  5. Linus TorvaldsApr 26, 2005
  6. Rhys HardwickApr 26, 2005
  7. Herbert XuApr 27, 2005
  8. Ed L CashinApr 27, 2005
  9. Petr BaudisApr 27, 2005
  10. Ed L CashinApr 27, 2005
  11. Paul JacksonApr 28, 2005
  12. Petr BaudisApr 28, 2005
  13. Paul JacksonApr 28, 2005
  14. Junio C HamanoApr 26, 2005

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.