git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Seth Robertson <in-gitvger@baka.org>
Cc: Mitar <mmitar@gmail.com>, git@vger.kernel.org
Subject: Re: post-fetch, tweak-fetch hook
Date: Mon, 7 May 2012 03:29:34 -0400	[thread overview]
Message-ID: <20120507072934.GC19874@sigill.intra.peff.net> (raw)
In-Reply-To: <201205062310.q46NAHnM022630@no.baka.org>

On Sun, May 06, 2012 at 07:10:17PM -0400, Seth Robertson wrote:

> The output of fetch seems to do that, quite nicely.
> 
> ----------------------------------------------------------------------
> > git fetch
> remote: Counting objects: 24155, done.
> remote: Compressing objects: 100% (6651/6651), done.
> remote: Total 21446 (delta 15831), reused 20146 (delta 14640)
> Receiving objects: 100% (21446/21446), 6.78 MiB | 239 KiB/s, done.
> Resolving deltas: 100% (15831/15831), completed with 574 local objects.
> From git://git.kernel.org/pub/scm/git/git
>    ea2c69e..edf1412  maint      -> origin/maint
>    ae4479d..8275905  master     -> origin/master
>  + b6b16ad...8a79d96 next       -> origin/next  (forced update)
>  + 47db9a0...30b8c95 pu         -> origin/pu  (forced update)
>    ce29fc8..3ca5cbc  todo       -> origin/todo
> ----------------------------------------------------------------------

This output is human-consumable, and is not guaranteed to remain stable
in future versions of git. Push has a --porcelain mode for this reason,
but nobody has bothered to implement it for fetch.

> If you care about race conditions (and really, a lockfile(1) call can
> take care of that easily enough), then parse the output of fetch which
> will make it clear what *this* call did.

Custom locking is not sufficient, as a push could modify refs behind
your back. I guess you could get by with a pre-receive hook that also
took the lock. But that is unnecessarily crappy; git does not have a
whole repo lock, and there is no need for lock contention between pushes
and fetches that are touching different refs.

I would say the "most git" thing would be to implement "fetch
--porcelain", and use its output.

-Peff

  parent reply	other threads:[~2012-05-07  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-06 20:52 post-fetch, tweak-fetch hook Mitar
2012-05-06 23:10 ` Seth Robertson
2012-05-06 23:54   ` Mitar
2012-05-07  7:29   ` Jeff King [this message]
2012-05-07  9:11     ` Mitar
2012-05-07 13:38       ` Jeff King

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=20120507072934.GC19874@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=in-gitvger@baka.org \
    --cc=mmitar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).