Skip to contentSkip to conversation

post-receive-email: suppress error if description file missing

PATCH In review Sitaram Chamarty 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 post-receive-email: suppress error if description file missing

---
 contrib/hooks/post-receive-email |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/hooks/post-receive-email +1 -1
index f99ea95..71f2b47 100755
@@ -709,7 +709,7 @@ if [ -z "$GIT_DIR" ]; then
 	exit 1
 fi
 
-projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
+projectdesc=$(sed -ne '1p' "$GIT_DIR/description 2>/dev/null")
 # 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
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 9 lines · Sitaram Chamarty
---
 contrib/hooks/post-receive-email |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/hooks/post-receive-email +0 -0
index f99ea95..71f2b47 100755

contrib/hooks/post-receive-email if [ -z "$GIT_DIR" ]; then · line 712

Quoted 5 lines
contrib/hooks/post-receive-email +1 -1
@@ -709,7 +709,7 @@ if [ -z "$GIT_DIR" ]; then
 	exit 1
 fi
 
-projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
+projectdesc=$(sed -ne '1p' "$GIT_DIR/description 2>/dev/null")

I suspect that you would want to have the redirection outside the dq pair, but other than that, well spotted.

You forgot to sign-off, though ;-)

Quoted 5 lines
contrib/hooks/post-receive-email +0 -0
 # 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
Signature · 1 line
1.7.3.4
#2 lore raw

---

Quoted 2 lines · Junio C Hamano

I suspect that you would want to have the redirection outside the dq pair, but other than that, well spotted.

doh! Thanks for catching the stupid error -- I shouldn't attempt even a simple patch when half-asleep I guess :)

Quoted 1 line

You forgot to sign-off, though ;-)

done!

 contrib/hooks/post-receive-email |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/hooks/post-receive-email +1 -1
index f99ea95..21989fc 100755
@@ -709,7 +709,7 @@ if [ -z "$GIT_DIR" ]; then
 	exit 1
 fi
 
-projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
+projectdesc=$(sed -ne '1p' "$GIT_DIR/description" 2>/dev/null)
 # 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
Signature · 1 line
1.7.3.4