summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-03-16 18:44:44 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-03-16 18:44:44 -0400
commitab8423d3cdf52bf86589498107f59470868301f1 (patch)
treeb9f74db0760f605648bdf787be9caa97acb46881
parentd6738c9a5ad3b25013d4788ea4e847abdaa06ce9 (diff)
Use `git rev-parse` to more flexibly handle directories
-rwxr-xr-xpbs-package-commit5
-rwxr-xr-xpbs-package-merge8
2 files changed, 9 insertions, 4 deletions
diff --git a/pbs-package-commit b/pbs-package-commit
index f6e5734..d07d3f9 100755
--- a/pbs-package-commit
+++ b/pbs-package-commit
@@ -24,10 +24,11 @@ main() {
return 0
fi
- if [[ ! -f .git ]]; then
- error "Must be in a package directory"
+ if ! git rev-parse --git-dir &>/dev/null; then
+ error "Must be in a package (git) directory"
return 1
fi
+ cd "$(git rev-parse --show-cdup)"
git commit "$@"
git push
diff --git a/pbs-package-merge b/pbs-package-merge
index b0fafc9..f99484b 100755
--- a/pbs-package-merge
+++ b/pbs-package-merge
@@ -27,11 +27,15 @@ main() {
return 1
fi
- if [[ ! -f .git ]]; then
- error "Must be in a package directory"
+ if ! git rev-parse --git-dir &>/dev/null; then
+ error "Must be in a package (git) directory"
+ return 1
fi
+ cd "$(git rev-parse --show-cdup)"
+
if [[ ! -r pbstrack ]]; then
error "No pbstrack file found, don't know where to pull from"
+ return 1
fi
git pull $(cat pbstrack)
}