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

Re: [PATCH 3/3] Make old sha1 optional with git update-ref -d

From
Karl Hasselström <kha@treskal.com>
Date
May 26, 2008, 14:09 UTC
Message-ID
<20080526140931.GA18440@diana.vm.bytemark.co.uk>
In-Reply-To
<alpine.DEB.1.00.0805261149310.30431@racer>
On 2008-05-26 11:51:12 +0100, Johannes Schindelin wrote:
Show 14 quoted lines
> On Sun, 25 May 2008, Karl Hasselström wrote:
>
> > Giving the old sha1 is already optional when changing a ref, and
> > it's quite handy when running update-ref manually. So make it
> > optional for deleting a ref too.
>
> Isn't this a bit dangerous, especially given that there is
> potentially _no_ reflog as a safeguard?
>
> So no, it is not the same as when changing a ref.
>
> I am mildly negative on this (having lost some remote branches,
> because they were deleted _together with the reflogs_ by "git push
> bla :x"),

Deleting the wrong thing is never a fun experience. The thing is, this patch doesn't really make it any easier to delete the wrong thing. Before, you'd

  git update-ref -d <ref> <some-other-way-to-point-to-the-same-commit>
if you wanted to play it safe, and
  git update-ref -d <ref> <ref>

if you thought you knew what you were doing. All this patch does is make the second usage mode easier to type.

(One might argue that a user who doesn't know what she's doing will have an easier time shooting herself in the foot when the oldvalue is optional, but I was under the impression that ease of use without consulting the man page shouldn't be a factor when designing the plumbing UI.)

I do agree with you that branch deletion is one of the more "dangerous" operations in git. But I don't think making update-ref hard to use is the answer there; what we'd really need is for old reflogs to stay around for a while before being deleted.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Johannes Schindelin
Message 8 of 8 in “Make old sha1 optional with git update-ref -d”
  1. 0/3 Make old sha1 optional with git update-ref -dKarl Hasselström, May 25, 2008
  2. 1/3 Add some tests for git update-ref -dKarl Hasselström, May 25, 2008
  3. 2/3 Clean up builtin-update-ref's option parsingKarl Hasselström, May 25, 2008
  4. Junio C HamanoMay 25, 2008
  5. Karl HasselströmMay 25, 2008
  6. 3/3 Make old sha1 optional with git update-ref -dKarl Hasselström, May 25, 2008
  7. Johannes SchindelinMay 26, 2008
  8. Karl HasselströmMay 26, 2008

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.