Skip to content

Commit

Permalink
Don't compare hashes if pull failed
Browse files Browse the repository at this point in the history
Also fix minor style nit.
  • Loading branch information
yut23 committed Sep 25, 2024
1 parent 7a15196 commit 22295d8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bin/homeshick
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ case $cmd in
cd) help cd ;; # cd is implemented in the homeshick.{sh,csh} helper script.
help) help $help_cmd ;;
*)
declare -a pull_completed
pull_completed=()
for param in "${params[@]}"; do
case $cmd in
clone)
Expand All @@ -183,11 +183,13 @@ case $cmd in
refresh)
(refresh $threshhold "$param") ;;
pull)
prev_hash=$(cd "$repos/$param" && git rev-parse HEAD)
prev_hash=$(cd "$repos/$param" && git rev-parse HEAD --)
(pull "$param")
result=$?
curr_hash=$(cd "$repos/$param" && git rev-parse HEAD)
[[ "$prev_hash" != "$curr_hash" ]] && pull_completed+=("$param")
if [[ $result -eq 0 ]]; then
curr_hash=$(cd "$repos/$param" && git rev-parse HEAD --)
[[ "$prev_hash" != "$curr_hash" ]] && pull_completed+=("$param")
fi
(exit $result)
;;
symlink|link)
Expand Down

0 comments on commit 22295d8

Please sign in to comment.