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

Re: [PATCH 3/4] update-hook: parse the tag header in preparation to use the tag type

From
APAndy Parkins <andyparkins@gmail.com>
Date
Mar 20, 2007, 15:24 UTC
Message-ID
<200703201524.04282.andyparkins@gmail.com>
In-Reply-To
<20070320143844.GA1750@spearce.org>
On Tuesday 2007 March 20 14:38, Shawn O. Pearce wrote:
> The problem of course is the update hook is running before a ref
> is created to point at the tag.  If you used post-receive hook
> on the other hand...  Oh, right, that has its own problems too!

I've obviously not described the problem very well; as I don't understand how your comment relates to this patch.

All I'm doing is pulling the individual fields out of
 $ git cat-file -p v1.5.0
 object 437b1b20df4b356c9342dac8d38849f24ef44f27
 type commit
 tag v1.5.0
 tagger Junio C Hamano <junkio@cox.net> Wed Feb 14 00:00:00 2007 +0000

And putting them in their own variables. I'm not sure how for-each-ref or in fact, any ref-based tool would help me do this. At this point it's nothing to do with git, it's a standard shell script problem.

 git cat-file -p $newrev | while read field value
 do
   variable = "found"
 done
 echo $variable

Doesn't work, because the right half of the pipe is run in its own process and so setting "variable" has no effect once the while loop is over.

I found that "<<<" heredoc thing in the bash manual, which is almost like having a reverse pipe and allows the while loop to run in the main process.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 3 of 4 in “update-hook: parse the tag header in preparation to use the tag type”
  1. 3/4 update-hook: parse the tag header in preparation to use the tag typeAndy Parkins, Mar 20, 2007
  2. Shawn O. PearceMar 20, 2007
  3. Andy ParkinsMar 20, 2007
  4. Shawn O. PearceMar 20, 2007

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.