git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git and peer review

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 19, 2008, 03:37 UTC
Message-ID
<20080519033736.GZ29038@spearce.org>
In-Reply-To
<20080517213039.GR396@ziti.local>
Seth Falcon <seth@userprimary.net> wrote:
Show 7 quoted lines
> 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.
Previous: Seth FalconNext: Seth Falcon
Message 10 of 11 in “git and peer review”
  1. Ping YinMay 3, 2008
  2. Thomas AdamMay 3, 2008
  3. Ping YinMay 3, 2008
  4. Frodo BagginsMay 3, 2008
  5. Ping YinMay 3, 2008
  6. Toby AllsoppMay 4, 2008
  7. Ping YinMay 5, 2008
  8. Karl HasselströmMay 5, 2008
  9. Seth FalconMay 17, 2008
  10. Shawn O. PearceMay 19, 2008
  11. Seth FalconMay 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.