# [PATCH] contrib/hooks/post-receive-email: checks for gitweb.description

3 messages from 2008-02-11 to 2008-02-11. Participants: Bruno Ribas, Jakub Narebski, BRUNO CESAR RIBAS.
Thread: https://gitlist.dev/t/12044

## Bruno Ribas, 2008-02-11 20:02

Subject: [PATCH] contrib/hooks/post-receive-email: checks for gitweb.description
Message-ID: <1202760138-24227-1-git-send-email-ribas@c3sl.ufpr.br>
URL: https://gitlist.dev/e/1202760138-24227-1-git-send-email-ribas%40c3sl.ufpr.br

```

Signed-off-by: Bruno Ribas <ribas@c3sl.ufpr.br>
---
 contrib/hooks/post-receive-email |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 77c88eb..bdd21fa 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -614,7 +614,11 @@ if [ -z "$GIT_DIR" ]; then
 	exit 1
 fi
 
-projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
+if [ -f "$GIT_DIR/description" ]; then
+	projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
+else
+	projectdesc=$(git-config gitweb.description)
+fi
 # Check if the description is unchanged from it's default, and shorten it to
 # a more manageable length if it is
 if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null
-- 
1.5.4.24.gce08d

```

## Jakub Narebski, 2008-02-11 21:20

Subject: Re: [PATCH] contrib/hooks/post-receive-email: checks for gitweb.description
Message-ID: <m3ejbjdwc6.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3ejbjdwc6.fsf%40localhost.localdomain
In-Reply-To: <1202760138-24227-1-git-send-email-ribas@c3sl.ufpr.br>

```
Bruno Ribas <ribas@c3sl.ufpr.br> writes:

Here it would be nice to have longer description, like:

  Check repository configuration gitweb.description for project
  description, if $GIT_DIR/description does not exist

Note that 'description' file is created by default when creating
repository by git-init by default repo template.

> Signed-off-by: Bruno Ribas <ribas@c3sl.ufpr.br>
> ---
>  contrib/hooks/post-receive-email |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
> index 77c88eb..bdd21fa 100644
> --- a/contrib/hooks/post-receive-email
> +++ b/contrib/hooks/post-receive-email
> @@ -614,7 +614,11 @@ if [ -z "$GIT_DIR" ]; then
>  	exit 1
>  fi
>  
> -projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
> +if [ -f "$GIT_DIR/description" ]; then
> +	projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
> +else
> +	projectdesc=$(git-config gitweb.description)

The rest of this hook use "git cmd". Preferred way to call git
commands is "git cmd". So I would use

  "git config gitweb.description"

> +fi
>  # Check if the description is unchanged from it's default, and shorten it to
>  # a more manageable length if it is
>  if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null
> -- 
> 1.5.4.24.gce08d
> 

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## BRUNO CESAR RIBAS, 2008-02-11 21:49

Subject: Re: [PATCH] contrib/hooks/post-receive-email: checks for gitweb.description
Message-ID: <20080211214957.GA20469@c3sl.ufpr.br>
URL: https://gitlist.dev/e/20080211214957.GA20469%40c3sl.ufpr.br
In-Reply-To: <m3ejbjdwc6.fsf@localhost.localdomain>

```
On Mon, Feb 11, 2008 at 01:20:21PM -0800, Jakub Narebski wrote:
> Bruno Ribas <ribas@c3sl.ufpr.br> writes:
> 
> Here it would be nice to have longer description, like:
> 
>   Check repository configuration gitweb.description for project
>   description, if $GIT_DIR/description does not exist

Okay, I'll resend =)

> 
> Note that 'description' file is created by default when creating
> repository by git-init by default repo template.

Yep, but when we use the gitweb.description we have do rm description file,
As seen on gitweb.perl it falls back to gitweb.description only when we can't
open description file.

hmm... With this patch i am not assuming someone set description file to mode
000, i think is better not to imaginade someone would do this, or not?

> 
> > Signed-off-by: Bruno Ribas <ribas@c3sl.ufpr.br>
> > ---
> >  contrib/hooks/post-receive-email |    6 +++++-
> >  1 files changed, 5 insertions(+), 1 deletions(-)
> > 
> > diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
> > index 77c88eb..bdd21fa 100644
> > --- a/contrib/hooks/post-receive-email
> > +++ b/contrib/hooks/post-receive-email
> > @@ -614,7 +614,11 @@ if [ -z "$GIT_DIR" ]; then
> >  	exit 1
> >  fi
> >  
> > -projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
> > +if [ -f "$GIT_DIR/description" ]; then
> > +	projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
> > +else
> > +	projectdesc=$(git-config gitweb.description)
> 
> The rest of this hook use "git cmd". Preferred way to call git
> commands is "git cmd". So I would use
> 
>   "git config gitweb.description"
> 
> > +fi
> >  # Check if the description is unchanged from it's default, and shorten it to
> >  # a more manageable length if it is
> >  if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null
> > -- 
> > 1.5.4.24.gce08d
> > 
> 
> -- 
> Jakub Narebski
> Poland
> ShadeHawk on #git
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```
