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

Re: [PATCH] contrib/hooks/post-receive-email: get description from repo.git/config

From
TATrond Hasle Amundsen <t.h.amundsen@usit.uio.no>
Date
May 6, 2013, 15:22 UTC
Message-ID
<15tfvy0cew5.fsf@tux.uio.no>
In-Reply-To
<15tsj20cizd.fsf@tux.uio.no>
Trond Hasle Amundsen <t.h.amundsen@usit.uio.no> writes:
> 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.

Bah.. It seems I attached this as MIME, sorry about that. Here it is, properly inlined this time:

>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


Cheers,
-- 
Trond H. Amundsen <t.h.amundsen@usit.uio.no>
Center for Information Technology Services, University of Oslo
Previous: Trond Hasle AmundsenNext: Junio C Hamano
Message 2 of 15 in “contrib/hooks/post-receive-email: get description from repo.git/config”
  1. contrib/hooks/post-receive-email: get description from repo.git/configTrond Hasle Amundsen, May 6, 2013
  2. Trond Hasle AmundsenMay 6, 2013
  3. Junio C HamanoMay 6, 2013
  4. Matthieu MoyMay 6, 2013
  5. Trond Hasle AmundsenMay 6, 2013
  6. Junio C HamanoMay 7, 2013
  7. Michael HaggertyMay 7, 2013
  8. Junio C HamanoMay 7, 2013
  9. Matthieu MoyMay 7, 2013
  10. Junio C HamanoJul 1, 2013
  11. Michael HaggertyJul 2, 2013
  12. Junio C HamanoJul 2, 2013
  13. Matthieu MoyMay 7, 2013
  14. Junio C HamanoMay 7, 2013
  15. Trond Hasle AmundsenMay 6, 2013

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.