{"thread":{"id":"30416","subject":"RFC: reflog for deleted branches","startedAt":"2012-05-03T21:25:46Z","lastAt":"2012-05-04T16:24:51Z","messageCount":9,"participants":["Sven Strickroth","Junio C Hamano","Andrew Sayers","Sitaram Chamarty","Robin Rosenberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"190692","messageId":"4FA2F7DA.6020108@tu-clausthal.de","threadId":"30416","inReplyTo":null,"subject":"RFC: reflog for deleted branches","fromName":"Sven Strickroth","fromEmail":"sven.strickroth@tu-clausthal.de","sentAt":"2012-05-03T21:25:46Z","receivedAt":"2012-05-03T21:25:46Z","isPatch":false,"sender":{"key":"sven.strickroth@tu-clausthal.de","avatar":null},"body":"Hi,\n\nan often heart question is how to restore deleted branches. Sometimes\nthose can be restored by using the reflog of the HEAD.\n\nBut why not create a special (ref)log for deleted branches (with SHA1,\ndate, name of the branch and maybe commit message of the last commit on\nthe deleted branch)? This way people could just look up the SHA1 of the\ndeleted branch and can recreate it (even if they moved the HEAD around a\nlot).\n\n-- \nBest regards,\n Sven Strickroth\n ClamAV, a GPL anti-virus toolkit   http://www.clamav.net\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"190693","messageId":"7vaa1pdjz8.fsf@alter.siamese.dyndns.org","threadId":"30416","inReplyTo":"4FA2F7DA.6020108@tu-clausthal.de","subject":"Re: RFC: reflog for deleted branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-03T21:37:31Z","receivedAt":"2012-05-03T21:37:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:\n\n> an often heart question is how to restore deleted branches. Sometimes\n> those can be restored by using the reflog of the HEAD.\n>\n> But why not create a special (ref)log for deleted branches (with SHA1,\n> date, name of the branch and maybe commit message of the last commit on\n> the deleted branch)? This way people could just look up the SHA1 of the\n> deleted branch and can recreate it (even if they moved the HEAD around a\n> lot).\n\nThe itch is legit, but I doubt a \"special log for deleted branches\" is a\ngood design.  Why do you limit yourself only to a single \"last\" commit?\nWouldn't it be a better design to save away the entire reflog for the\nbranch when a branch is deleted, possibly with expedited expire rule for\nsuch a reflog?\n"},{"id":"190696","messageId":"4FA30270.6000806@tu-clausthal.de","threadId":"30416","inReplyTo":"7vaa1pdjz8.fsf@alter.siamese.dyndns.org","subject":"Re: RFC: reflog for deleted branches","fromName":"Sven Strickroth","fromEmail":"sven.strickroth@tu-clausthal.de","sentAt":"2012-05-03T22:10:56Z","receivedAt":"2012-05-03T22:10:56Z","isPatch":false,"sender":{"key":"sven.strickroth@tu-clausthal.de","avatar":null},"body":"Am 03.05.2012 23:37 schrieb Junio C Hamano:\n> The itch is legit, but I doubt a \"special log for deleted branches\" is a\n> good design.  Why do you limit yourself only to a single \"last\" commit?\n\nThat was just the first idea ;)\n\n> Wouldn't it be a better design to save away the entire reflog for the\n> branch when a branch is deleted, possibly with expedited expire rule for\n> such a reflog?\n\nThe \"normal\" reflog cannot be used if you just create and then delete a\nbranch - the reflog is empty in this case. A special \"deleted\" entry\npointing to the SHA1 of the branch is needed. Also the question is how\nto handle the case that a user creates and deletes a new branch with the\nsame name.\n\nAll in all, I (and lots of other users) would be happy if this issue\ncould be addressed in one of the next releases. :)\n\n-- \nBest regards,\n Sven Strickroth\n ClamAV, a GPL anti-virus toolkit   http://www.clamav.net\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"190697","messageId":"4FA302FC.2040608@pileofstuff.org","threadId":"30416","inReplyTo":"4FA2F7DA.6020108@tu-clausthal.de","subject":"Re: RFC: reflog for deleted branches","fromName":"Andrew Sayers","fromEmail":"andrew-git@pileofstuff.org","sentAt":"2012-05-03T22:13:16Z","receivedAt":"2012-05-03T22:13:16Z","isPatch":false,"sender":{"key":"andrew-git@pileofstuff.org","avatar":null},"body":"On 03/05/12 22:25, Sven Strickroth wrote:\n> Hi,\n> \n> an often heart question is how to restore deleted branches. Sometimes\n> those can be restored by using the reflog of the HEAD.\n> \n> But why not create a special (ref)log for deleted branches (with SHA1,\n> date, name of the branch and maybe commit message of the last commit on\n> the deleted branch)? This way people could just look up the SHA1 of the\n> deleted branch and can recreate it (even if they moved the HEAD around a\n> lot).\n> \n\nSomething like this may well be needed by an SVN importer, as it's quite\npossible for an SVN branch to be deleted, then another branch forked\nfrom it years later.  See the (brief) discussion here:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/195517\nhttp://article.gmane.org/gmane.comp.version-control.git/195544\n\nThis is really Florian's area, but I expect it would be easy enough for\nSVN import to build on top of any reasonably general solution if you're\noffering :)\n\n\t- Andrew\n"},{"id":"190706","messageId":"7vwr4sdfw7.fsf@alter.siamese.dyndns.org","threadId":"30416","inReplyTo":"4FA30270.6000806@tu-clausthal.de","subject":"Re: RFC: reflog for deleted branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-03T23:05:44Z","receivedAt":"2012-05-03T23:05:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:\n\n> The \"normal\" reflog cannot be used if you just create and then delete a\n> branch - the reflog is empty in this case.\n\nI somehow thought we discussed about the lack of \"creation\" event.\nPerhaps it is sufficient to create a reflog entry for such then?\n"},{"id":"190709","messageId":"4FA31723.8020705@tu-clausthal.de","threadId":"30416","inReplyTo":"7vwr4sdfw7.fsf@alter.siamese.dyndns.org","subject":"Re: RFC: reflog for deleted branches","fromName":"Sven Strickroth","fromEmail":"sven.strickroth@tu-clausthal.de","sentAt":"2012-05-03T23:39:15Z","receivedAt":"2012-05-03T23:39:15Z","isPatch":false,"sender":{"key":"sven.strickroth@tu-clausthal.de","avatar":null},"body":"Am 04.05.2012 01:05 schrieb Junio C Hamano:\n> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:\n> \n>> The \"normal\" reflog cannot be used if you just create and then delete a\n>> branch - the reflog is empty in this case.\n> \n> I somehow thought we discussed about the lack of \"creation\" event.\n> Perhaps it is sufficient to create a reflog entry for such then?\n\nI suppose an entry for deletion should be sufficient.\n\n-- \nBest regards,\n Sven Strickroth\n ClamAV, a GPL anti-virus toolkit   http://www.clamav.net\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"190711","messageId":"CAMK1S_jvdjLunMPGu6QidzN7YHt0UaENp-e-6kUcy4rcC_T72w@mail.gmail.com","threadId":"30416","inReplyTo":"4FA2F7DA.6020108@tu-clausthal.de","subject":"Re: RFC: reflog for deleted branches","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2012-05-04T01:17:56Z","receivedAt":"2012-05-04T01:17:56Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On Fri, May 4, 2012 at 2:55 AM, Sven Strickroth\n<sven.strickroth@tu-clausthal.de> wrote:\n> Hi,\n>\n> an often heart question is how to restore deleted branches. Sometimes\n> those can be restored by using the reflog of the HEAD.\n\nI get by with:\n\n    gitk --date-order $(git fsck | grep \"dangling.commit\" | cut -f3\n-d' ') --not --branches --tags --remotes\n\nWorks for me because I usually remember *something* about the commit\nmessage so then I type in \"/\" and the string and in a few\n\"Shift-downarrow\"s I'm there.\n"},{"id":"190725","messageId":"4FA376B5.50804@dewire.com","threadId":"30416","inReplyTo":"7vwr4sdfw7.fsf@alter.siamese.dyndns.org","subject":"Re: RFC: reflog for deleted branches","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2012-05-04T06:27:01Z","receivedAt":"2012-05-04T06:27:01Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"Junio C Hamano skrev 2012-05-04 01.05:\n> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:\n>\n>> The \"normal\" reflog cannot be used if you just create and then delete a\n>> branch - the reflog is empty in this case.\n>\n> I somehow thought we discussed about the lack of \"creation\" event.\n> Perhaps it is sufficient to create a reflog entry for such then?\n\nWe have the create event (oldd=0000...), if we just don't delete the log and add\na destroy event (newid=000000).\n\nA bit trickier with the current reflog design is the case where you\ndelete branch foo and then create the branch foo/bar. One way would be\nto append a \".\" to the leaf in the refs directory tree. Older readers\nwouldn't understand that to there's a compatibility issue.\n\n-- robin\n"},{"id":"190765","messageId":"7vmx5nc3sc.fsf@alter.siamese.dyndns.org","threadId":"30416","inReplyTo":"4FA376B5.50804@dewire.com","subject":"Re: RFC: reflog for deleted branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-04T16:24:51Z","receivedAt":"2012-05-04T16:24:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n\n> Junio C Hamano skrev 2012-05-04 01.05:\n>> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:\n>>\n>>> The \"normal\" reflog cannot be used if you just create and then delete a\n>>> branch - the reflog is empty in this case.\n>>\n>> I somehow thought we discussed about the lack of \"creation\" event.\n>> Perhaps it is sufficient to create a reflog entry for such then?\n>\n> We have the create event (oldd=0000...), if we just don't delete the log and add\n> a destroy event (newid=000000).\n>\n> A bit trickier with the current reflog design is the case where you\n> delete branch foo and then create the branch foo/bar.\n\nThat is not worth worrying about from the behavioral point of view, as end\nusers, even on Macs and Windows, have long learned that in a hierarchical\nname space, you cannot have foo and foo/bar at the same time.  But from\nthe implementation point of view, that implies in this sequence:\n\n\tcreate foo/bar, creating refs/heads/foo/bar and logs/foo/bar\n        delete foo/bar, removing refs/heads/foo/bar but keeping logs/foo/bar\n\tcreate foo\n\nthe third step needs to \"rm -fr logs/foo && >logs/foo\".  We have refs/heads/foo\nunder lock, so presumably nobody can create a baz branch that adds logs/foo/baz\nto race with us while we do so, but I didn't check.  Our lock taking code\nmay need to be tweaked so that if you take lock on refs/heads/foo, nobody\nelse can take lock on refs/heads/foo/anything, and vice versa.\n"}]}