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

Re: print errors from git-update-ref

From
Junio C Hamano <junkio@cox.net>
Date
Jul 24, 2006, 06:06 UTC
Message-ID
<7vk663h6zi.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<81b0412b0607180613t603551b8t865b407c40ab8aef@mail.gmail.com>
"Alex Riesen" <raa.lkml@gmail.com> writes:
Show 11 quoted lines
> ...otherwise it not clear what happened when update-ref fails.
>
> E.g., git checkout -b a/b/c HEAD would print nothing if refs/heads/a
> exists and is a directory (it does return 1, so scripts checking for
> return code should be ok).
>
> I'm attaching two patches, because I'm not quite sure where it should
> be done: git-checkout is the least intrusive, but only builtin-update-ref.c
> has enough info to help user to resolve the problem (errno is ENOTDIR,
> which is selfexplanatory). And I happen to use git-update-ref directly
> sometimes.

My gut feeling is that complaining from update-ref is fine, but I am still tired after a long week and not thinking straight, so I will not be applying this tonight.

git-applypatch, git-am, and git-branch would be helped by update-ref complaining.

Porcelains?

BTW, I wonder what happens when .git/logs/refs/a is a directory (by mistake or malice), .git/refs/a does not exist, and the user does "git checkout -b a/b/c HEAD". Or when .git/logs/refs/a/b/c does exist but is not writable. My preference is just warn but do not interrupt the primary operation, since ref-log is just an optional part of the system, but that would probably lead to confusion, so we might be better off erroring the caller out in such a case. Opinions?

git-resolve does not check exit value from update-ref, which is *BAD*, but we should be deprecating it anyway.

git-reset has the same problem of not checking the exit status from update ref. Worse yet, it calls update-ref with wrong parameter ($@ in its parameter should be $*).

Patches to fix these two and half problems should be trivial but I won't be doing that myself tonight.

Previous: Alex RiesenNext: Shawn Pearce
Message 2 of 7 in “print errors from git-update-ref”
  1. Alex RiesenJul 18, 2006
  2. Junio C HamanoJul 24, 2006
  3. Shawn PearceJul 27, 2006
  4. Johannes SchindelinJul 27, 2006
  5. Shawn PearceJul 28, 2006
  6. Junio C HamanoJul 28, 2006
  7. Shawn PearceJul 29, 2006

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.