git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hooks--update: fix test for properly set up project description file
@ 2007-11-06 13:47 Gerrit Pape
  2007-11-06 13:55 ` Andreas Ericsson
  0 siblings, 1 reply; 4+ messages in thread
From: Gerrit Pape @ 2007-11-06 13:47 UTC (permalink / raw)
  To: git, Junio C Hamano

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>
---
 templates/hooks--update |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/hooks--update b/templates/hooks--update
index d8c7626..65e8c32 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=$(sed -ne '1p' "$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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hooks--update: fix test for properly set up project description file
  2007-11-06 13:47 [PATCH] hooks--update: fix test for properly set up project description file Gerrit Pape
@ 2007-11-06 13:55 ` Andreas Ericsson
  2007-11-08 14:02   ` Gerrit Pape
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Ericsson @ 2007-11-06 13:55 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: git, Junio C Hamano

Gerrit Pape wrote:
> 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>
> ---
>  templates/hooks--update |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/templates/hooks--update b/templates/hooks--update
> index d8c7626..65e8c32 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=$(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.

> +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

I must have missed when the default updatehook got this addendum, as it's
impossible to push to a repository that isn't named with this hook in
effect. I imagine this could lead to some fun problems when trying to
push to repositories on windows machines.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] hooks--update: fix test for properly set up project description file
  2007-11-06 13:55 ` Andreas Ericsson
@ 2007-11-08 14:02   ` Gerrit Pape
  2007-11-08 22:13     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Gerrit Pape @ 2007-11-08 14:02 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: git, Junio C Hamano

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:
> 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hooks--update: fix test for properly set up project description file
  2007-11-08 14:02   ` Gerrit Pape
@ 2007-11-08 22:13     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-11-08 22:13 UTC (permalink / raw)
  To: Gerrit Pape; +Cc: Andreas Ericsson, git

Gerrit Pape <pape@smarden.org> writes:

> 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:
>> 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 even suspect that the original 'p' is indeed a typo of 'q'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-08 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-06 13:47 [PATCH] hooks--update: fix test for properly set up project description file Gerrit Pape
2007-11-06 13:55 ` Andreas Ericsson
2007-11-08 14:02   ` Gerrit Pape
2007-11-08 22:13     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).