diff options
Diffstat (limited to 'ar/.local/bin/gitupdate')
| -rwxr-xr-x | ar/.local/bin/gitupdate | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ar/.local/bin/gitupdate b/ar/.local/bin/gitupdate index 8205e48..4fed27e 100755 --- a/ar/.local/bin/gitupdate +++ b/ar/.local/bin/gitupdate @@ -43,6 +43,13 @@ unpushed=$(git cherry -v | wc -l) [ -z "$changes" ] && [ "$unpushed" -eq 0 ] && exit +# Save current directory and change to the Git repo root +repo_root=$(git rev-parse --show-toplevel || echo ".") +cd "$repo_root" || exit + +# Get the current Git branch name +branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') + # Generate default commit message if there are changes if [ -n "$changes" ] && [ "$unpushed" -eq 0 ]; then num_changes=$(echo "$changes" | wc -l) @@ -64,13 +71,6 @@ else message=$(git cherry -v | awk '{$1=$2=""; print $0}' | sed 's/^ *//' | tail -n 1) fi -# Get the current Git branch name -branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') - -# Save current directory and change to the Git repo root -repo_root=$(git rev-parse --show-toplevel || echo ".") -cd "$repo_root" - if [ "$repo_root" = "${PASSWORD_STORE_DIR:-${HOME}/.password-store}" ]; then pass git remote | xargs -L1 pass git push --all else |
