@matheusbsbs / matheus-bagliano / commits / a4f25e3682
Fork 0

rebase-i-p: fix 'no squashing merges' tripping up non-merges

Also only check out the first parent if this commit if not a squash--if it is a squash, we want to explicitly ignore the parent and leave the wc as is, as cherry-pick will apply the squash on top of it. Signed-off-by: Stephen Haberman <stephen@exigencecorp.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stephen Haberman committed Oct 15, 2008 at 02:44 UTC a4f25e368247108e89e5ee1a02c2f1b6fc31c56f
1 file changed +9 -5
git-rebase--interactive.sh
+9 -5
@@ -219,15 +219,19 @@ pick_one_preserving_merges () {
219 die "Cannot fast forward to $sha1"
220 ;;
221 f)
222 - test "a$1" = a-n && die "Refusing to squash a merge: $sha1"
223 -
222 first_parent=$(expr "$new_parents" : ' \([^ ]*\)')
225 - # detach HEAD to current parent
226 - output git checkout $first_parent 2> /dev/null ||
227 - die "Cannot move HEAD to $first_parent"
223 +
224 + if [ "$1" != "-n" ]
225 + then
226 + # detach HEAD to current parent
227 + output git checkout $first_parent 2> /dev/null ||
228 + die "Cannot move HEAD to $first_parent"
229 + fi
230
231 case "$new_parents" in
232 ' '*' '*)
233 + test "a$1" = a-n && die "Refusing to squash a merge: $sha1"
234 +
235 # redo merge
236 author_script=$(get_author_ident_from_commit $sha1)
237 eval "$author_script"