git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] logging branch deletion to help recovering from mistakes
Date: Tue, 7 Dec 2010 10:14:19 -0800	[thread overview]
Message-ID: <AANLkTimnp3xCHp_3E7ry-5OQL3PFnYh=H8PhfzMN307C@mail.gmail.com> (raw)
In-Reply-To: <20101207170623.GB21749@sigill.intra.peff.net>

On Tue, Dec 7, 2010 at 9:06 AM, Jeff King <peff@peff.net> wrote:
> On Mon, Dec 06, 2010 at 10:28:53PM -0800, Junio C Hamano wrote:
>
>> > Should this special log be mentioned in git-update-ref.txt or
>> > gitrepository-layout.txt?
>>
>> Perhaps, but I wasn't sure if this patch itself is a good idea to begin
>> with.  Not the problem it tries to solve, but its approach.
>>
>> For example, this cannot be shown with "reflog show" or "log -g" due to
>> the way these frontends locate the reflog file to read (the logic wants to
>> have an underlying ref).
>
> Yeah, I think this is not _quite_ what people want in this area. A base
> requirement from past discussions, I think, is that the whole reflog of
> the deleted branch be saved rather than just the tip. And then "reflog
> show" would make a lot more sense on such saved reflogs.

Yup, that's what I recall too, folks (including myself) want to
save the reflog of the deleted branch, so it can be recovered if
the branch itself were to be recovered with an --undelete option.

> I'm not sure in practice how important that distinction is, as we are
> not saving deleted branch reflogs _at all_ right now, so the
> requirements are mostly speculation at this point.
>
> The most recent discussion I recall is this one:
>
>  http://thread.gmane.org/gmane.comp.version-control.git/144250/focus=145353
>
> where the general idea was to just keep deleted reflogs around, append
> to them if the branch was recreated, and use a consistent renaming
> scheme to avoid D/F naming conflicts (e.g., "foo" is a deleted ref, and
> you create "foo/bar").

Per check-ref-format, ref names cannot contain two dots.  We could
archive ref logs by renaming them, $GIT_DIR/logs/refs/heads/foo
becomes $GIT_DIR/logs/refs/heads/foo..deleted-1.  If foo is created
and deleted again, it becomes foo..deleted-2.

This still causes problems for git reflog show / git log -g because
they want a current ref to enumerate the log of.


A different approach might be to have $GIT_DIR/logs/refs/REF_ATTIC,
and special case that in git reflog show / git log -g.  When a
ref is deleted, append its entire log onto REF_ATTIC, between two
specially formatted marker lines.  When recovering a branch, copy
out the region from the REF_ATTIC log.

-- 
Shawn.

  reply	other threads:[~2010-12-07 18:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 21:16 [PATCH] logging branch deletion to help recovering from mistakes Junio C Hamano
2010-12-06 21:55 ` Štěpán Němec
2010-12-06 23:14 ` Andreas Schwab
2010-12-07  1:18 ` Nguyen Thai Ngoc Duy
2010-12-07  6:28   ` Junio C Hamano
2010-12-07 11:37     ` Nguyen Thai Ngoc Duy
2010-12-07 15:25       ` Michael J Gruber
2010-12-07 16:25         ` Nguyen Thai Ngoc Duy
2010-12-07 16:22       ` Jakub Narebski
2010-12-07 16:26         ` Nguyen Thai Ngoc Duy
2010-12-07 17:06     ` Jeff King
2010-12-07 18:14       ` Shawn Pearce [this message]
2010-12-07 18:20         ` Jeff King
2010-12-07 18:23           ` Shawn O. Pearce
2010-12-07 18:35             ` Jeff King
2010-12-07 18:37               ` Shawn O. Pearce
2010-12-07 18:39                 ` Jeff King
2010-12-07 18:41                   ` Shawn O. Pearce
2010-12-07 19:21       ` Junio C Hamano
2010-12-07 19:38         ` Jeff King
2010-12-07 16:23 ` Casey Dahlin
2010-12-07 17:45   ` Jonathan Nieder
2010-12-07 17:54     ` Casey Dahlin
2010-12-07 18:02       ` Jonathan Nieder
2010-12-07 18:26         ` Casey Dahlin
2010-12-07 20:25         ` Junio C Hamano
2010-12-07 20:55           ` Jonathan Nieder
2010-12-07 18:12       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimnp3xCHp_3E7ry-5OQL3PFnYh=H8PhfzMN307C@mail.gmail.com' \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).