Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #97 from Joeasaurus/master
Browse files Browse the repository at this point in the history
Changed repo_name logic for bare repos
  • Loading branch information
conorbranagan committed Nov 17, 2014
2 parents b891e41 + 14cf50e commit 3c3ab59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/git-post-receive-hook
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ logger.addHandler(SysLogHandler())
try:
import os
import sys
import re
from hashlib import sha1
from socket import gethostname
from dogapi import dog_http_api as dog
Expand Down Expand Up @@ -61,8 +62,11 @@ try:
repo_name = "repository"
try:
if isbare == "true":
# go 1 dirs up and use pwd as the repo name, not great but should work
repo_name = os.path.basename(os.path.realpath(os.path.join(__file__, "..", "..")))
# Get the basename of CWD, but strip '/hooks' from the end if we happen to be in there.
repo_name = os.path.basename(re.sub('/?hooks/?$', '', os.getcwd()))
# Could also be done as so:
# p = os.popen("basename $(echo $(pwd) | sed 's/hooks$//')")
# repo_name = p.read()
else:
# go 2 dirs up and use pwd as the repo name, not great but should work
repo_name = os.path.basename(os.path.realpath(os.path.join(__file__, "..", "..", "..")))
Expand Down

0 comments on commit 3c3ab59

Please sign in to comment.