update-bash: fix revision variable setting
* only set HOMEBREW_UPDATE_BEFORE inside pull instead of fetch. * fix HOMEBREW_UPDATE_BEFORE/AFTER variable settings. They should be set to INITIAL_REVISION and CURRENT_REVISION correspondingly. * avoid unnecessary duplicated shellout. * remove unused variable.
This commit is contained in:
		
							parent
							
								
									2f52ca9ded
								
							
						
					
					
						commit
						f7c276a0be
					
				@ -176,9 +176,10 @@ pull() {
 | 
				
			|||||||
  # "brew update --simulate-from-current-branch"
 | 
					  # "brew update --simulate-from-current-branch"
 | 
				
			||||||
  if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
 | 
					  if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
    INITIAL_REVISION="$(git rev-parse -q --verify "$(upstream_branch)")"
 | 
					    INITIAL_REVISION="$(git rev-parse -q --verify "$UPSTREAM_BRANCH")"
 | 
				
			||||||
    CURRENT_REVISION="$(read_current_revision)"
 | 
					    CURRENT_REVISION="$(read_current_revision)"
 | 
				
			||||||
    export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$(git rev-parse "$UPSTREAM_BRANCH")"
 | 
					    export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION"
 | 
				
			||||||
 | 
					    export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$CURRENT_REVISION"
 | 
				
			||||||
    if ! git merge-base --is-ancestor "$INITIAL_REVISION" "$CURRENT_REVISION"
 | 
					    if ! git merge-base --is-ancestor "$INITIAL_REVISION" "$CURRENT_REVISION"
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
      odie "Your HEAD is not a descendant of $UPSTREAM_BRANCH!"
 | 
					      odie "Your HEAD is not a descendant of $UPSTREAM_BRANCH!"
 | 
				
			||||||
@ -199,6 +200,7 @@ pull() {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  INITIAL_REVISION="$(read_current_revision)"
 | 
					  INITIAL_REVISION="$(read_current_revision)"
 | 
				
			||||||
 | 
					  export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # ensure we don't munge line endings on checkout
 | 
					  # ensure we don't munge line endings on checkout
 | 
				
			||||||
  git config core.autocrlf false
 | 
					  git config core.autocrlf false
 | 
				
			||||||
@ -210,8 +212,7 @@ pull() {
 | 
				
			|||||||
    git merge --no-edit --ff $QUIET_ARGS "origin/$UPSTREAM_BRANCH"
 | 
					    git merge --no-edit --ff $QUIET_ARGS "origin/$UPSTREAM_BRANCH"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  CURRENT_REVISION="$(read_current_revision)"
 | 
					  export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$(read_current_revision)"
 | 
				
			||||||
  export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$(git rev-parse "$UPSTREAM_BRANCH")"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  trap '' SIGINT
 | 
					  trap '' SIGINT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -300,8 +301,6 @@ EOS
 | 
				
			|||||||
  do
 | 
					  do
 | 
				
			||||||
    [[ -d "$DIR/.git" ]] || continue
 | 
					    [[ -d "$DIR/.git" ]] || continue
 | 
				
			||||||
    cd "$DIR" || continue
 | 
					    cd "$DIR" || continue
 | 
				
			||||||
    TAP_VAR=$(repo_var "$DIR")
 | 
					 | 
				
			||||||
    export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$(git rev-parse "$(upstream_branch)")"
 | 
					 | 
				
			||||||
    UPSTREAM_BRANCH="$(upstream_branch)"
 | 
					    UPSTREAM_BRANCH="$(upstream_branch)"
 | 
				
			||||||
    # the refspec ensures that the default upstream branch gets updated
 | 
					    # the refspec ensures that the default upstream branch gets updated
 | 
				
			||||||
    git fetch $QUIET_ARGS origin \
 | 
					    git fetch $QUIET_ARGS origin \
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user