diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-10-03 03:05:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-10-03 03:05:39 -0700 |
commit | 9b0185ca06001219f5ffcccb5c09b9a9bb42e7c2 (patch) | |
tree | b25e282c2248e5a079b56e95607f0509422e062a /git-rebase--interactive.sh | |
parent | 0341091a9ec47576a2fdfab181145fa94c04b810 (diff) | |
parent | 73697a0b572f7f216d8355d83bf69e9b42e9a077 (diff) | |
download | git-9b0185ca06001219f5ffcccb5c09b9a9bb42e7c2.tar.gz |
Merge branch 'js/rebase-i'
* js/rebase-i:
rebase -i: work on a detached HEAD
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-x | git-rebase--interactive.sh | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 96d8b6f8db..050140d666 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -317,17 +317,20 @@ do_next () { else NEWHEAD=$(git rev-parse HEAD) fi && - message="$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO)" && - git update-ref -m "$message" $HEADNAME $NEWHEAD $OLDHEAD && - git symbolic-ref HEAD $HEADNAME && { + case $HEADNAME in + refs/*) + message="$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO)" && + git update-ref -m "$message" $HEADNAME $NEWHEAD $OLDHEAD && + git symbolic-ref HEAD $HEADNAME + ;; + esac && { test ! -f "$DOTEST"/verbose || git diff --stat $(cat "$DOTEST"/head)..HEAD } && rm -rf "$DOTEST" && + git gc --auto && warn "Successfully rebased and updated $HEADNAME." - git gc --auto - exit } @@ -367,7 +370,11 @@ do HEADNAME=$(cat "$DOTEST"/head-name) HEAD=$(cat "$DOTEST"/head) - git symbolic-ref HEAD $HEADNAME && + case $HEADNAME in + refs/*) + git symbolic-ref HEAD $HEADNAME + ;; + esac && output git reset --hard $HEAD && rm -rf "$DOTEST" exit @@ -445,8 +452,8 @@ do test -z "$ONTO" && ONTO=$UPSTREAM : > "$DOTEST"/interactive || die "Could not mark as interactive" - git symbolic-ref HEAD > "$DOTEST"/head-name || - die "Could not get HEAD" + git symbolic-ref HEAD > "$DOTEST"/head-name 2> /dev/null || + echo "detached HEAD" > "$DOTEST"/head-name echo $HEAD > "$DOTEST"/head echo $UPSTREAM > "$DOTEST"/upstream |