git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Reading remote reflogs
@ 2013-03-29 22:25 Dennis Kaarsemaker
  2013-03-29 22:45 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Dennis Kaarsemaker @ 2013-03-29 22:25 UTC (permalink / raw)
  To: git

Is it possible to somehow fetch the reflog of a remote?

I would like to delegate some post-receive actions to an automatically
mirrored clone of some repositories. Mirrored repositories don't
maintain a reflog, even with core.logAllRefUpdates = true, so to be able
to know what was pushed per push, it would need to somehow know the
reflog of the origin.

Of course a post-receive hook can send this information downstream, but
I'd like to keep the origin 'dumb' and not do that.

-- 
Dennis Kaarsemaker
www.kaarsemaker.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading remote reflogs
  2013-03-29 22:25 Reading remote reflogs Dennis Kaarsemaker
@ 2013-03-29 22:45 ` Junio C Hamano
  2013-03-29 22:56   ` Dennis Kaarsemaker
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2013-03-29 22:45 UTC (permalink / raw)
  To: Dennis Kaarsemaker; +Cc: git

Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:

> ... Mirrored repositories don't
> maintain a reflog, even with core.logAllRefUpdates = true,...

Are you sure about this?  When log_all_ref_updates is not set, by
default we do not log for bare repositories, but other than that, we
do not do anything special with respect to reflogs.

	$ (cd .. && git clone --no-local --mirror git.git victim)
        $ git checkout next
        $ EDITOR=: git commit --amend
        $ cd ../victim
	$ git config core.logallrefupdates true
	$ git fetch
        $ find logs
	logs
        logs/HEAD
        logs/refs
        logs/refs/heads
        logs/refs/heads/next

It seems to record how a branch at its origin was updated just fine,
at least to me.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading remote reflogs
  2013-03-29 22:45 ` Junio C Hamano
@ 2013-03-29 22:56   ` Dennis Kaarsemaker
  2013-03-29 22:58     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Dennis Kaarsemaker @ 2013-03-29 22:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On vr, 2013-03-29 at 15:45 -0700, Junio C Hamano wrote:
> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
> 
> > ... Mirrored repositories don't
> > maintain a reflog, even with core.logAllRefUpdates = true,...
> 
> Are you sure about this?  When log_all_ref_updates is not set, by
> default we do not log for bare repositories, but other than that, we
> do not do anything special with respect to reflogs.

I was, as I tried the recipe below, though with a different repo. Must
have goofed something up, as it works now. Thanks for the braincheck :)

That gives me a reasonable approximation of distinct pushes if I pull
the mirror often enough. It's always going to be an approximation
though, so the original question still stands.
-- 
Dennis Kaarsemaker
www.kaarsemaker.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading remote reflogs
  2013-03-29 22:56   ` Dennis Kaarsemaker
@ 2013-03-29 22:58     ` Junio C Hamano
  2013-03-30  0:02       ` Dennis Kaarsemaker
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2013-03-29 22:58 UTC (permalink / raw)
  To: Dennis Kaarsemaker; +Cc: git

Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:

> On vr, 2013-03-29 at 15:45 -0700, Junio C Hamano wrote:
>> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
>> 
>> > ... Mirrored repositories don't
>> > maintain a reflog, even with core.logAllRefUpdates = true,...
>> 
>> Are you sure about this?  When log_all_ref_updates is not set, by
>> default we do not log for bare repositories, but other than that, we
>> do not do anything special with respect to reflogs.
>
> I was, as I tried the recipe below, though with a different repo. Must
> have goofed something up, as it works now. Thanks for the braincheck :)
>
> That gives me a reasonable approximation of distinct pushes if I pull
> the mirror often enough.

Instead of polling, why not "git push --mirror" whenever the
original gets updated?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading remote reflogs
  2013-03-29 22:58     ` Junio C Hamano
@ 2013-03-30  0:02       ` Dennis Kaarsemaker
  0 siblings, 0 replies; 5+ messages in thread
From: Dennis Kaarsemaker @ 2013-03-30  0:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On vr, 2013-03-29 at 15:58 -0700, Junio C Hamano wrote:
> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
> 
> > On vr, 2013-03-29 at 15:45 -0700, Junio C Hamano wrote:
> >> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
> >> 
> >> > ... Mirrored repositories don't
> >> > maintain a reflog, even with core.logAllRefUpdates = true,...
> >> 
> >> Are you sure about this?  When log_all_ref_updates is not set, by
> >> default we do not log for bare repositories, but other than that, we
> >> do not do anything special with respect to reflogs.
> >
> > I was, as I tried the recipe below, though with a different repo. Must
> > have goofed something up, as it works now. Thanks for the braincheck :)
> >
> > That gives me a reasonable approximation of distinct pushes if I pull
> > the mirror often enough.
> 
> Instead of polling, why not "git push --mirror" whenever the
> original gets updated?

I considered that, but it has two downsides:
- Slows down the push as it needs to wait for this to complete
- Only works if you control the master, so it won't work with e.g. 
  github hosted repositories
-- 
Dennis Kaarsemaker
www.kaarsemaker.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-30  0:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-29 22:25 Reading remote reflogs Dennis Kaarsemaker
2013-03-29 22:45 ` Junio C Hamano
2013-03-29 22:56   ` Dennis Kaarsemaker
2013-03-29 22:58     ` Junio C Hamano
2013-03-30  0:02       ` Dennis Kaarsemaker

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).