[sysadmin-bin: 8/168] Convert GIT_DIR to absolute before extracting short project name



commit b5c4afc366dd41839fa250d41dc61244382e40bf
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Feb 5 16:24:13 2009 -0500

    Convert GIT_DIR to absolute before extracting short project name
    
    git tends to have GIT_DIR=. when running the hook, so figure out
    the absolute path before extracting the last component.

 post-receive-email |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/post-receive-email b/post-receive-email
index 6bf734b..cfe0511 100755
--- a/post-receive-email
+++ b/post-receive-email
@@ -613,7 +613,8 @@ if [ -z "$GIT_DIR" ]; then
 fi
 
 # Use the directory name with .git stripped as a short identifier
-projectshort=$(basename ${GIT_DIR%.git})
+absdir=$(cd $GIT_DIR && pwd)
+projectshort=$(basename ${absdir%.git})
 
 projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
 # Check if the description is unchanged from it's default, and shorten it to



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]