{"thread":{"id":"33330","subject":"Reading remote reflogs","startedAt":"2013-03-29T22:25:28Z","lastAt":"2013-03-30T00:02:56Z","messageCount":5,"participants":["Dennis Kaarsemaker","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"212655","messageId":"1364595928.30202.4.camel@localhost","threadId":"33330","inReplyTo":null,"subject":"Reading remote reflogs","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2013-03-29T22:25:28Z","receivedAt":"2013-03-29T22:25:28Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"Is it possible to somehow fetch the reflog of a remote?\n\nI would like to delegate some post-receive actions to an automatically\nmirrored clone of some repositories. Mirrored repositories don't\nmaintain a reflog, even with core.logAllRefUpdates = true, so to be able\nto know what was pushed per push, it would need to somehow know the\nreflog of the origin.\n\nOf course a post-receive hook can send this information downstream, but\nI'd like to keep the origin 'dumb' and not do that.\n\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"212656","messageId":"7vd2uhn7u1.fsf@alter.siamese.dyndns.org","threadId":"33330","inReplyTo":"1364595928.30202.4.camel@localhost","subject":"Re: Reading remote reflogs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-29T22:45:42Z","receivedAt":"2013-03-29T22:45:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n\n> ... Mirrored repositories don't\n> maintain a reflog, even with core.logAllRefUpdates = true,...\n\nAre you sure about this?  When log_all_ref_updates is not set, by\ndefault we do not log for bare repositories, but other than that, we\ndo not do anything special with respect to reflogs.\n\n\t$ (cd .. && git clone --no-local --mirror git.git victim)\n        $ git checkout next\n        $ EDITOR=: git commit --amend\n        $ cd ../victim\n\t$ git config core.logallrefupdates true\n\t$ git fetch\n        $ find logs\n\tlogs\n        logs/HEAD\n        logs/refs\n        logs/refs/heads\n        logs/refs/heads/next\n\nIt seems to record how a branch at its origin was updated just fine,\nat least to me.\n"},{"id":"212657","messageId":"1364597780.30202.7.camel@localhost","threadId":"33330","inReplyTo":"7vd2uhn7u1.fsf@alter.siamese.dyndns.org","subject":"Re: Reading remote reflogs","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2013-03-29T22:56:20Z","receivedAt":"2013-03-29T22:56:20Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On vr, 2013-03-29 at 15:45 -0700, Junio C Hamano wrote:\n> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n> \n> > ... Mirrored repositories don't\n> > maintain a reflog, even with core.logAllRefUpdates = true,...\n> \n> Are you sure about this?  When log_all_ref_updates is not set, by\n> default we do not log for bare repositories, but other than that, we\n> do not do anything special with respect to reflogs.\n\nI was, as I tried the recipe below, though with a different repo. Must\nhave goofed something up, as it works now. Thanks for the braincheck :)\n\nThat gives me a reasonable approximation of distinct pushes if I pull\nthe mirror often enough. It's always going to be an approximation\nthough, so the original question still stands.\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"212658","messageId":"7v8v55n790.fsf@alter.siamese.dyndns.org","threadId":"33330","inReplyTo":"1364597780.30202.7.camel@localhost","subject":"Re: Reading remote reflogs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-03-29T22:58:19Z","receivedAt":"2013-03-29T22:58:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n\n> On vr, 2013-03-29 at 15:45 -0700, Junio C Hamano wrote:\n>> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n>> \n>> > ... Mirrored repositories don't\n>> > maintain a reflog, even with core.logAllRefUpdates = true,...\n>> \n>> Are you sure about this?  When log_all_ref_updates is not set, by\n>> default we do not log for bare repositories, but other than that, we\n>> do not do anything special with respect to reflogs.\n>\n> I was, as I tried the recipe below, though with a different repo. Must\n> have goofed something up, as it works now. Thanks for the braincheck :)\n>\n> That gives me a reasonable approximation of distinct pushes if I pull\n> the mirror often enough.\n\nInstead of polling, why not \"git push --mirror\" whenever the\noriginal gets updated?\n"},{"id":"212659","messageId":"1364601776.30202.10.camel@localhost","threadId":"33330","inReplyTo":"7v8v55n790.fsf@alter.siamese.dyndns.org","subject":"Re: Reading remote reflogs","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2013-03-30T00:02:56Z","receivedAt":"2013-03-30T00:02:56Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On vr, 2013-03-29 at 15:58 -0700, Junio C Hamano wrote:\n> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n> \n> > On vr, 2013-03-29 at 15:45 -0700, Junio C Hamano wrote:\n> >> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n> >> \n> >> > ... Mirrored repositories don't\n> >> > maintain a reflog, even with core.logAllRefUpdates = true,...\n> >> \n> >> Are you sure about this?  When log_all_ref_updates is not set, by\n> >> default we do not log for bare repositories, but other than that, we\n> >> do not do anything special with respect to reflogs.\n> >\n> > I was, as I tried the recipe below, though with a different repo. Must\n> > have goofed something up, as it works now. Thanks for the braincheck :)\n> >\n> > That gives me a reasonable approximation of distinct pushes if I pull\n> > the mirror often enough.\n> \n> Instead of polling, why not \"git push --mirror\" whenever the\n> original gets updated?\n\nI considered that, but it has two downsides:\n- Slows down the push as it needs to wait for this to complete\n- Only works if you control the master, so it won't work with e.g. \n  github hosted repositories\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"}]}