diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-03-16 18:44:44 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-03-16 18:44:44 -0400 |
commit | ab8423d3cdf52bf86589498107f59470868301f1 (patch) | |
tree | b9f74db0760f605648bdf787be9caa97acb46881 | |
parent | d6738c9a5ad3b25013d4788ea4e847abdaa06ce9 (diff) |
Use `git rev-parse` to more flexibly handle directories
-rwxr-xr-x | pbs-package-commit | 5 | ||||
-rwxr-xr-x | pbs-package-merge | 8 |
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) } |