summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2008-08-13 23:41:23 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-13 15:17:09 -0700
commit71d9451e061841ed5acb576652e09df32c700b86 (patch)
tree7321f90e5de8513ad28b82aaebc747657ef10b39 /git-rebase--interactive.sh
parent65f59e2998c7dd87f61b25fa41bba72fd4247901 (diff)
downloadgit-71d9451e061841ed5acb576652e09df32c700b86.tar.gz
rebase -i -p: handle index and workdir correctly
'git rebase -i -p' forgot to update the index and working directory during fast forwards. Fix this. Makes 'GIT_EDITOR=true rebase -i -p <ancestor>' a no-op again. Also, it attempted to do a fast forward even if it was instructed not to commit (via -n). Fall back to the cherry-pick code path and let that handle the issue for us. Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4e334ba41d..58126bd80c 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -145,7 +145,16 @@ pick_one () {
}
pick_one_preserving_merges () {
- case "$1" in -n) sha1=$2 ;; *) sha1=$1 ;; esac
+ fast_forward=t
+ case "$1" in
+ -n)
+ fast_forward=f
+ sha1=$2
+ ;;
+ *)
+ sha1=$1
+ ;;
+ esac
sha1=$(git rev-parse $sha1)
if test -f "$DOTEST"/current-commit
@@ -157,7 +166,6 @@ pick_one_preserving_merges () {
fi
# rewrite parents; if none were rewritten, we can fast-forward.
- fast_forward=t
preserve=t
new_parents=
for p in $(git rev-list --parents -1 $sha1 | cut -d' ' -f2-)
@@ -182,6 +190,8 @@ pick_one_preserving_merges () {
t)
output warn "Fast forward to $sha1"
test $preserve = f || echo $sha1 > "$REWRITTEN"/$sha1
+ output git reset --hard $sha1 ||
+ die "Cannot fast forward to $sha1"
;;
f)
test "a$1" = a-n && die "Refusing to squash a merge: $sha1"