From: Jeff King <peff@peff.net>
To: Brian Swetland <swetland@google.com>
Cc: git@vger.kernel.org
Subject: Re: observing changes to a git repository
Date: Tue, 1 Jan 2008 01:54:03 -0500 [thread overview]
Message-ID: <20080101065403.GA21912@coredump.intra.peff.net> (raw)
In-Reply-To: <20071231222820.GA11278@bulgaria.corp.google.com>
On Mon, Dec 31, 2007 at 02:28:20PM -0800, Brian Swetland wrote:
> - periodically:
> - grab the current head (call this Current)
> - if it's the same as Last stop
> - do a git log Current ^Last to observe what has happened since
> we last noticed a change. report on these commits.
> - Last = Current
Overall this makes sense. But in the case of history going backwards,
you might want to show a log of "Current...Last". IOW, imagine this
history:
B-C
/
A-D-E
Last is set to 'C' from some iteration of your script. In one period,
somebody does a git-reset back to A, then makes commits D and E. So you
want to see not just B and C, but some representation that D and E are
no longer of interest. "gitk Last...Current" will show you a nice graph
with a fork. git-log's --left-right option can represent the same
information textually. What you want depends, I think, on the goal of
your script.
> If these branches can be updated such that history is rewritten (not
> a concern in my particular case), I assume that for correctness you'd
> have to make Last and Current actual branches (perhaps under
> refs/heads/observer/... or whatever) to ensure that they don't get gc'd
> out from under you.
Yes, although realistically the reflog will keep it intact (unless you
have a bare repo without reflog).
> If I'm tracking several branches which can be merged between, I might
> want to keep track of which commits I've sent reports about if I don't
> want to re-report commits when they're merged into another branch.
What you have should work in the face of merges. Here's a history with
some merges:
B-C H-I <-- branch1
/ \ / \
A-D-E-F-G-J-K-L <-- master
where 'F' and 'L' are our merges. Because ^H implies ^G, but not ^J, if
we have something like Current=L, Last=H, you will see I, J, K, L.
So you will see each commit only once, unless you are running this
script per-branch, in which case you will see it once per branch. :) In
that case, you can do something like "git log Current ^LastBranch1
^LastBranch2 ...". IOW, Last* indicates "I've seen this and don't care
about it anymore".
-Peff
prev parent reply other threads:[~2008-01-01 6:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-31 22:28 observing changes to a git repository Brian Swetland
2008-01-01 6:54 ` Jeff King [this message]
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=20080101065403.GA21912@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=swetland@google.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).