aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-01-21 13:58:54 +0800
committerXu Cheng2016-01-21 21:14:55 +0800
commitf7c276a0bee204af223e68a53af13c90674ea356 (patch)
tree1605f856bfdecca595b2f29e3101cf767b987abf /Library
parent2f52ca9dedae8f4e1fb144d54f9377ced3abd585 (diff)
downloadbrew-f7c276a0bee204af223e68a53af13c90674ea356.tar.bz2
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.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/cmd/update-bash.sh11
1 files changed, 5 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/update-bash.sh b/Library/Homebrew/cmd/update-bash.sh
index 2b7e3d233..856ac1e5c 100755
--- a/Library/Homebrew/cmd/update-bash.sh
+++ b/Library/Homebrew/cmd/update-bash.sh
@@ -176,9 +176,10 @@ pull() {
# "brew update --simulate-from-current-branch"
if [[ -n "$HOMEBREW_SIMULATE_FROM_CURRENT_BRANCH" ]]
then
- INITIAL_REVISION="$(git rev-parse -q --verify "$(upstream_branch)")"
+ INITIAL_REVISION="$(git rev-parse -q --verify "$UPSTREAM_BRANCH")"
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"
then
odie "Your HEAD is not a descendant of $UPSTREAM_BRANCH!"
@@ -199,6 +200,7 @@ pull() {
fi
INITIAL_REVISION="$(read_current_revision)"
+ export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$INITIAL_REVISION"
# ensure we don't munge line endings on checkout
git config core.autocrlf false
@@ -210,8 +212,7 @@ pull() {
git merge --no-edit --ff $QUIET_ARGS "origin/$UPSTREAM_BRANCH"
fi
- CURRENT_REVISION="$(read_current_revision)"
- export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$(git rev-parse "$UPSTREAM_BRANCH")"
+ export HOMEBREW_UPDATE_AFTER"$TAP_VAR"="$(read_current_revision)"
trap '' SIGINT
@@ -300,8 +301,6 @@ EOS
do
[[ -d "$DIR/.git" ]] || continue
cd "$DIR" || continue
- TAP_VAR=$(repo_var "$DIR")
- export HOMEBREW_UPDATE_BEFORE"$TAP_VAR"="$(git rev-parse "$(upstream_branch)")"
UPSTREAM_BRANCH="$(upstream_branch)"
# the refspec ensures that the default upstream branch gets updated
git fetch $QUIET_ARGS origin \