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

[PATCH] hooks--update: fix test for properly set up project description file

From
Gerrit Pape <pape@smarden.org>
Date
Nov 8, 2007, 14:02 UTC
Message-ID
<20071108140200.24902.qmail@f23d7e396b1523.315fe32.mid.smarden.org>
In-Reply-To
<4730726B.1000407@op5.se>

The update hook template intends to abort if the project description file hasn't been adjusted or is empty. This patch fixes the check for 'being adjusted'.

Signed-off-by: Gerrit Pape <pape@smarden.org>
---
On Tue, Nov 06, 2007 at 02:55:55PM +0100, Andreas Ericsson wrote:
Show 12 quoted lines
> Gerrit Pape wrote:
> > # check for no description
> >-projectdesc=$(sed -e '1p' "$GIT_DIR/description")
> >-if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit
> >this
> >file to name it for gitweb" ]; then
> >+projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
>
> Write this as
>       projectdesc=$(sed -e 1q "$GIT_DIR/description")
> instead. It's a little shorter, a little faster and slightly more
> portable.
I made it $(head -n 1 ...).
 templates/hooks--update |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/hooks--update b/templates/hooks--update
index d8c7626..fbf664f 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -34,8 +34,8 @@ fi
 allowunannotated=$(git-repo-config --bool hooks.allowunannotated)
 
 # check for no description
-projectdesc=$(sed -e '1p' "$GIT_DIR/description")
-if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb" ]; then
+projectdesc=$(head -n 1 "$GIT_DIR/description")
+if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb." ]; then
 	echo "*** Project description file hasn't been set" >&2
 	exit 1
 fi
-- 
1.5.3.5
Previous: Andreas EricssonNext: Junio C Hamano
Message 3 of 4 in “hooks--update: fix test for properly set up project description file”
  1. hooks--update: fix test for properly set up project description fileGerrit Pape, Nov 6, 2007
  2. Andreas EricssonNov 6, 2007
  3. hooks--update: fix test for properly set up project description fileGerrit Pape, Nov 8, 2007
  4. Junio C HamanoNov 8, 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.