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

[PATCH] pre-rebase hook: capture documentation in a <<here document

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 8, 2012, 12:21 UTC
Message-ID
<20120308122105.GA1562@burratino>
In-Reply-To
<7vmxc6xs73.fsf@alter.siamese.dyndns.org>

Without this change, the sample hook does not pass a syntax check (sh -n):

  $ sh -n hooks--pre-rebase.sample 
  hooks--pre-rebase.sample: line 101: syntax error near unexpected token `('
  hooks--pre-rebase.sample: line 101: `   merged into it again (either directly or indirectly).'
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
---
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>>       pre-rebase hook: capture documentation in a <<here document [4]
>
> I do not mind this but if you are to do so you should remove the "exit 0"
> before that block.
Done. ;)
Thanks, and sorry for the slow reply.
Jonathan
 templates/hooks--pre-rebase.sample |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks--pre-rebase.sample
index 053f1111..b7f81c19 100755
--- a/templates/hooks--pre-rebase.sample
+++ b/templates/hooks--pre-rebase.sample
@@ -88,9 +88,7 @@ else
 	exit 1
 fi
 
-exit 0
-
-################################################################
+<<\DOC_END
 
 This sample hook safeguards topic branches that have been
 published from being rewound.
@@ -167,3 +165,5 @@ To compute (2):
 	git rev-list master..topic
 
 	if this is empty, it is fully merged to "master".
+
+DOC_END
-- 
1.7.9.2
Previous: Junio C HamanoNext: Erik Faye-Lund
Message 4 of 6 in “[fyi] patches used by git distributors”
  1. Jonathan NiederNov 8, 2011
  2. Junio C HamanoNov 8, 2011
  3. Junio C HamanoNov 8, 2011
  4. pre-rebase hook: capture documentation in a <<here documentJonathan Nieder, Mar 8, 2012
  5. Erik Faye-LundNov 10, 2011
  6. Todd ZullingerNov 10, 2011

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.