Commit 56ae2d04d9b1a4d4359a88c4d7103d09f68ef248

Authored by Mark Feltner
1 parent dc9be95099

Modified some conditional expressions (with DeMorgan's Law) to fix syntax errors on some shells

Showing 1 changed file with 14 additions and 10 deletions Side-by-side Diff

... ... @@ -126,18 +126,22 @@ antigen-update () {
126 126 }
127 127  
128 128 antigen-revert () {
129   - if ! [[ -f $ADOTDIR/revert-info ]]; then
  129 + if [[ -f $ADOTDIR/revert-info ]]; then
  130 + cat $ADOTDIR/revert-info | sed '1!p' | while read line; do
  131 + dir="$(echo "$line" | cut -d: -f1)"
  132 + git --git-dir="$dir/.git" --work-tree="$dir" \
  133 + checkout "$(echo "$line" | cut -d: -f2)" 2> /dev/null
  134 +
  135 + done
  136 +
  137 + echo "Reverted to state before running -update on $(
  138 + cat $ADOTDIR/revert-info | sed -n 1p)."
  139 +
  140 + else
130 141 echo 'No revert information available. Cannot revert.' >&2
131 142 fi
132 143  
133   - cat $ADOTDIR/revert-info | sed '1!p' | while read line; do
134   - dir="$(echo "$line" | cut -d: -f1)"
135   - git --git-dir="$dir/.git" --work-tree="$dir" \
136   - checkout "$(echo "$line" | cut -d: -f2)" 2> /dev/null
137   - done
138 144  
139   - echo "Reverted to state before running -update on $(
140   - cat $ADOTDIR/revert-info | sed -n 1p)."
141 145 }
142 146  
143 147 -antigen-get-clone-dir () {
... ... @@ -225,7 +229,7 @@ antigen-revert () {
225 229 --plugin-git checkout $requested_branch
226 230 fi
227 231  
228   - if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then
  232 + if [[ -n $old_rev && $old_rev != $new_rev ]]; then
229 233 echo Updated from ${old_rev:0:7} to ${new_rev:0:7}.
230 234 if $verbose; then
231 235 --plugin-git log --oneline --reverse --no-merges --stat '@{1}..'
... ... @@ -541,7 +545,7 @@ antigen () {
541 545  
542 546 # Set spec values based on the positional arguments.
543 547 local i=1
544   - while ! [[ -z $1 || $1 == --* ]]; do
  548 + while [[ -n $1 && $1 != --* ]]; do
545 549  
546 550 if (( $i > $positional_args_count )); then
547 551 echo "Only $positional_args_count positional arguments allowed." >&2