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

Re: [PATCH w/signoff] pre-push.sample: Remove unwanted `IFS=' '`.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 21, 2014, 18:50 UTC
Message-ID
<xmqqtx0obzwm.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1419186337-20348-1-git-send-email-gjthill@gmail.com>
Jim Hill <gjthill@gmail.com> writes:
> Signed-off-by: Jim Hill <gjthill@gmail.com>
> ---
Please clarify "unwanted" in the proposed commit log message.

It looks to me that the assignment very much deliberate. We know refnames and 40-hex object names do not contain SP, and the hook is fed (quoting from Documentation/githooks.txt) like this:

    Information about what is to be pushed is provided on the hook's standard
    input with lines of the form:
      <local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF

so setting IFS to SP alone smells as an attempt to ensure that the "read" in each loop iteration would split at SP and nothing else; Aaron Schrab CC'ed who did the original in 87c86dd1 (Add sample pre-push hook script, 2013-01-13).

Also you would notice by reading "git shortlog" of our history that s/Remove/remove/ on the subject line would avoid this entry stand out among others unnecessarily, but that is minor.

Show 15 quoted lines
>  templates/hooks--pre-push.sample | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/templates/hooks--pre-push.sample b/templates/hooks--pre-push.sample
> index 69e3c67..6187dbf 100755
> --- a/templates/hooks--pre-push.sample
> +++ b/templates/hooks--pre-push.sample
> @@ -24,7 +24,6 @@ url="$2"
>  
>  z40=0000000000000000000000000000000000000000
>  
> -IFS=' '
>  while read local_ref local_sha remote_ref remote_sha
>  do
>  	if [ "$local_sha" = $z40 ]
Previous: Jim HillNext: Jim Hill
Message 3 of 7 in “pre-push.sample: Remove unwanted `IFS=' '`.”
  1. pre-push.sample: Remove unwanted `IFS=' '`.Jim Hill, Dec 21, 2014
  2. pre-push.sample: Remove unwanted `IFS=' '`.Jim Hill, Dec 21, 2014
  3. Junio C HamanoDec 21, 2014
  4. Jim HillDec 21, 2014
  5. Junio C HamanoDec 21, 2014
  6. Junio C HamanoDec 23, 2014
  7. pre-push.sample: remove unwanted `IFS=' '`.Jim Hill, Dec 21, 2014

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.