Permalink
Browse files

Handle the (usual) case of $PWD being the project root.

  • Loading branch information...
eventualbuddha committed Aug 24, 2011
1 parent 815ecad commit f1ca95775024df1969d4ffcf1786eca2026f18ae
Showing with 6 additions and 1 deletion.
  1. +6 −1 bin/hack
View
@@ -3,7 +3,12 @@
CURRENT=$(git symbolic-ref -q HEAD || git rev-parse HEAD)
CURRENT=${CURRENT#refs/heads/}
gitdir=$(git rev-parse --git-dir)
-project=$(basename $(dirname "$gitdir"))
+rootdir=$(dirname "$gitdir")
+
+if [ "$rootdir" = "." ]; then
+ rootdir=$PWD
+fi
+project=$(basename "$rootdir")
# default settings
explain=false

0 comments on commit f1ca957

Please sign in to comment.