summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65f59e2)
raw | patch | inline | side by side (parent: 65f59e2)
author | Thomas Rast <trast@student.ethz.ch> | |
Wed, 13 Aug 2008 21:41:23 +0000 (23:41 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 13 Aug 2008 22:17:09 +0000 (15:17 -0700) |
'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>
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>
git-rebase--interactive.sh | patch | blob | history | |
t/t3404-rebase-interactive.sh | patch | blob | history |
index 4e334ba41dad3067394b79c15ebfe610b2d3e178..58126bd80cd73993c6cedd548e200c0fa461a8af 100755 (executable)
}
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
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-)
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"
index ffe3dd97b7b1c056d854e28795e1313ce1633452..4d62b9af838b306d0c815d852422949e968b10fb 100755 (executable)
test_expect_success '-p handles "no changes" gracefully' '
HEAD=$(git rev-parse HEAD) &&
git rebase -i -p HEAD^ &&
+ git update-index --refresh &&
+ git diff-files --quiet &&
+ git diff-index --quiet --cached HEAD -- &&
test $HEAD = $(git rev-parse HEAD)
'
git checkout -b to-be-rebased &&
test_tick &&
git rebase -i -p --onto branch1 master &&
+ git update-index --refresh &&
+ git diff-files --quiet &&
+ git diff-index --quiet --cached HEAD -- &&
test $(git rev-parse HEAD~6) = $(git rev-parse branch1) &&
test $(git rev-parse HEAD~4^2) = $(git rev-parse to-be-preserved) &&
test $(git rev-parse HEAD^^2^) = $(git rev-parse HEAD^^^) &&