public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Stefan Monnier <monnier@iro•umontreal.ca>
Cc: git@vger•kernel.org
Subject: Re: Post-receive hook for "git pull"
Date: Mon, 07 Dec 2015 11:54:43 -0800	[thread overview]
Message-ID: <xmqqio4am3uk.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <jwv4mful6nu.fsf-monnier+gmane.comp.version-control.git@gnu.org> (Stefan Monnier's message of "Mon, 07 Dec 2015 08:47:58 -0500")

Stefan Monnier <monnier@iro•umontreal.ca> writes:

> I have a system here where it can be quite common to have thousands of
> branches in the remote repository, and where I'd like to update some
> local state according to the appearance of new branches (or updates of
> pre-existing ones).
>
> Currently, I use a "git for-each-ref" after pulling and then check (for
> each one of those refs) if an update is warranted, but this can get slow
> with that many branches.  Is there some way to get something like the
> post-receive hook to be run for "git pull", so that the script gets told
> directly which (remote tracking) branches have been modified/created?

I do not think there is.  But you could easily script along the
lines of...

    #!/bin/sh
    git for-each-ref | sort >prestate
    git pull "$@"
    git for-each-ref | sort >poststate
    comm -12 prestate poststate

... or something like that, no?

  reply	other threads:[~2015-12-07 19:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 13:47 Post-receive hook for "git pull" Stefan Monnier
2015-12-07 19:54 ` Junio C Hamano [this message]
2016-02-12 13:39   ` Stefan Monnier

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=xmqqio4am3uk.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=monnier@iro$(echo .)umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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