git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Seth Falcon <seth@userprimary.net>
Cc: Toby Allsopp <Toby.Allsopp@navman.co.nz>,
	Ping Yin <pkufranky@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git and peer review
Date: Sun, 18 May 2008 23:37:36 -0400	[thread overview]
Message-ID: <20080519033736.GZ29038@spearce.org> (raw)
In-Reply-To: <20080517213039.GR396@ziti.local>

Seth Falcon <seth@userprimary.net> wrote:
> What I would like is a way for the script to determine the appropriate
> tracking branch.  So that the usage would look like:
> 
>    git mark-reviewed someone@userprimary.net
> 
> and it would figure out whether it should do trunk.. or release-1.3..,
> etc.  Can anyone point me in the right direction?

Something like this, but its uh, ugly due to the use of a network
connection:

	branch=$(git symbolic-ref HEAD)
	branch=${branch##refs/heads/}

	remote=$(git config branch.$branch.remote)
	merge=$(git config branch.$branch.merge)

	rb=$(git ls-remote $remote $merge | awk '{print $1}')

Then use a filter-branch on "$rb..$branch" as the range.

You may be able to just assume that the remote name is the
refs/remotes prefix and instead do:

	branch=$(git symbolic-ref HEAD)
	branch=${branch##refs/heads/}

	remote=$(git config branch.$branch.remote)
	merge=$(git config branch.$branch.merge)
	merge=${merge##refs/heads/}

	rb=refs/remotes/$remote/$merge

but that's an assumption, and we all know what happens when you
assume things.

Technically you need to look at remote.$remote.fetch lines
in .git/config to figure out the rewriting rules from what
branch.$branch.merge contains to what refs/remotes/* might be,
and doing that is not quite as trivial as either using ls-remote or
assuming your users have the standard layout created by git-clone
and git-remote.

-- 
Shawn.

  reply	other threads:[~2008-05-19  3:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-03  1:02 git and peer review Ping Yin
2008-05-03 13:54 ` Thomas Adam
2008-05-03 14:03   ` Ping Yin
2008-05-03 14:22     ` Frodo Baggins
2008-05-03 14:27       ` Ping Yin
2008-05-04 20:21 ` Toby Allsopp
2008-05-05  0:52   ` Ping Yin
2008-05-05 13:48   ` Karl Hasselström
2008-05-17 21:30   ` Seth Falcon
2008-05-19  3:37     ` Shawn O. Pearce [this message]
2008-05-19 14:10       ` Seth Falcon

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=20080519033736.GZ29038@spearce.org \
    --to=spearce@spearce.org \
    --cc=Toby.Allsopp@navman.co.nz \
    --cc=git@vger.kernel.org \
    --cc=pkufranky@gmail.com \
    --cc=seth@userprimary.net \
    /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).