Subject: Re: [RFC] git-branch: add options and tests for branch renaming

From: Shawn Pearce <[email-masked]>
Date: Tue, 28 Nov 2006 10:39:04 -0500

Andy Whitcroft <[email-masked]> wrote:
> Ok, I have been feeling uneasy about rename and reflogs for a while now.
>  About removing reflogs too for that matter.
> 
> In my mind the ref log is about tracking what a ref points to.  So I
> want to be able to say "what was next, yesterday".  Do I care if its not
> there now?  Perhaps I want a rename to just put a rename from in the top
> of the new reflog and leave the old there.
> 
> Yep, no idea how we would clean them up with this model.  But ...

You use a global reflog instead of a ref specific log.  There are
of course huge problems with that idea, but it is probably the
simplest way to solve what you want.

Though I'm not sure why you care that much.  To me a ref is just
as transient as the name of the working directory the repository is
housed in.  I could care less what I called that directory last week,
just that it exists and has the content I expect.  On the other
hand, once I'm in that directory I *do* want the history of it.
That's where git comes in.  Likewise for a ref once I am speaking
about a given ref, I want the history of it, and that's where git's
reflog comes in.

Although I just realized this paticular case:

	git branch -D next
	git fetch origin next:next
	...
	git fetch origin next:next
	git branch -M next bob
	...
	... 2 days go by  ...
	...
	git fetch origin next:next
	... arrgh next is no good! ...
	git log next@{2.days.ago}

and there's nothing there, as the log for next just started in
the last fetch.  Yet you had a next that you renamed to bob, and
that next has the log.

Though this can be easily dealt with by reading the RENAME_LOG.
If you scan both this ref's log and the RENAME_LOG and switch to
scanning another ref's log when you find that this ref was renamed
to another ref, then you get what you expect above.  Except if you
deleted the rename destination branch.

I can't say I would use that feature though, despite how handy I
find reflogs to be.

--