git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] contrib/hooks/post-receive-email: get description from repo.git/config
@ 2013-05-06 13:53 Trond Hasle Amundsen
  2013-05-06 15:22 ` Trond Hasle Amundsen
  2013-05-06 15:36 ` Junio C Hamano
  0 siblings, 2 replies; 15+ messages in thread
From: Trond Hasle Amundsen @ 2013-05-06 13:53 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]


Hello,

The included patch attempts to improve post-receive-email. It's a
trivial change, but one that helps us Gitolite users. Comments are
welcome, and this is my first attempt at contributing to the Git
project. Please keep me on CC as I'm not on the list.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-contrib-hooks-post-receive-email-get-description-fro.patch --]
[-- Type: text/x-patch, Size: 1659 bytes --]

>From 878a7af9088e2bcc3afc9b09b9023f1f188c844b Mon Sep 17 00:00:00 2001
From: Trond Hasle Amundsen <t.h.amundsen@usit.uio.no>
Date: Mon, 6 May 2013 15:41:25 +0200
Subject: [PATCH] contrib/hooks/post-receive-email: get description from repo.git/config

When getting the project description, we first try gitweb.description
entry in repo.git/config, but repo.git/description takes precedence if
it exists. This behaviour mimics that of Gitweb, and is what we want
when using Gitolite, which deletes repo.git/description upon repo
creation and rather maintains a gitweb.description entry in
repo.git/config if a description is configured.

Signed-off-by: Trond Hasle Amundsen <t.h.amundsen@usit.uio.no>
---
 contrib/hooks/post-receive-email |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 0e5b72d..6ce046a 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -714,7 +714,14 @@ if [ -z "$GIT_DIR" ]; then
 	exit 1
 fi
 
-projectdesc=$(sed -ne '1p' "$GIT_DIR/description" 2>/dev/null)
+# Get the repo's description. First try gitweb.description entry in
+# repo.git/config, but repo.git/description takes precedence if it
+# exists. This behaviour mimics that of Gitweb.
+projectdesc=$(git config gitweb.description)
+if [ -f "$GIT_DIR/description" ]; then
+        projectdesc=$(sed -ne '1p' "$GIT_DIR/description" 2>/dev/null)
+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.7.1


[-- Attachment #3: Type: text/plain, Size: 121 bytes --]


Cheers,
-- 
Trond H. Amundsen <t.h.amundsen@usit.uio.no>
Center for Information Technology Services, University of Oslo

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

end of thread, other threads:[~2013-07-02 18:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 13:53 [PATCH] contrib/hooks/post-receive-email: get description from repo.git/config Trond Hasle Amundsen
2013-05-06 15:22 ` Trond Hasle Amundsen
2013-05-06 15:36 ` Junio C Hamano
2013-05-06 15:42   ` Matthieu Moy
2013-05-06 16:29     ` Trond Hasle Amundsen
2013-05-07  6:36     ` Junio C Hamano
2013-05-07  7:46       ` Michael Haggerty
2013-05-07 15:15         ` Junio C Hamano
2013-05-07 15:36           ` Matthieu Moy
2013-07-01 21:58         ` Junio C Hamano
2013-07-02  9:12           ` Michael Haggerty
2013-07-02 18:51             ` Junio C Hamano
2013-05-07  7:49       ` Matthieu Moy
2013-05-07 14:51         ` Junio C Hamano
2013-05-06 16:26   ` Trond Hasle Amundsen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).