Merge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1
* js/maint-1.6.1-rebase-i-submodule: Fix submodule squashing into unrelated commit rebase -i squashes submodule changes into unrelated commit
This commit is contained in:
commit
54e7e7891b
@ -360,17 +360,15 @@ do_next () {
|
||||
pick_one -n $sha1 || failed=t
|
||||
case "$(peek_next_command)" in
|
||||
squash|s)
|
||||
EDIT_COMMIT=
|
||||
USE_OUTPUT=output
|
||||
MSG_OPT=-F
|
||||
MSG_FILE="$MSG"
|
||||
EDIT_OR_FILE="$MSG"
|
||||
cp "$MSG" "$SQUASH_MSG"
|
||||
;;
|
||||
*)
|
||||
EDIT_COMMIT=-e
|
||||
USE_OUTPUT=
|
||||
MSG_OPT=
|
||||
MSG_FILE=
|
||||
EDIT_OR_FILE=-e
|
||||
rm -f "$SQUASH_MSG" || exit
|
||||
cp "$MSG" "$GIT_DIR"/SQUASH_MSG
|
||||
rm -f "$GIT_DIR"/MERGE_MSG || exit
|
||||
@ -384,7 +382,8 @@ do_next () {
|
||||
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
|
||||
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
|
||||
GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
|
||||
$USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
|
||||
$USE_OUTPUT git commit --no-verify \
|
||||
$MSG_OPT "$EDIT_OR_FILE" || failed=t
|
||||
fi
|
||||
if test $failed = t
|
||||
then
|
||||
|
@ -462,4 +462,30 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'submodule rebase setup' '
|
||||
git checkout A &&
|
||||
mkdir sub &&
|
||||
(
|
||||
cd sub && git init && >elif &&
|
||||
git add elif && git commit -m "submodule initial"
|
||||
) &&
|
||||
echo 1 >file1 &&
|
||||
git add file1 sub
|
||||
test_tick &&
|
||||
git commit -m "One" &&
|
||||
echo 2 >file1 &&
|
||||
test_tick &&
|
||||
git commit -a -m "Two" &&
|
||||
(
|
||||
cd sub && echo 3 >elif &&
|
||||
git commit -a -m "submodule second"
|
||||
) &&
|
||||
test_tick &&
|
||||
git commit -a -m "Three changes submodule"
|
||||
'
|
||||
|
||||
test_expect_success 'submodule rebase -i' '
|
||||
FAKE_LINES="1 squash 2 3" git rebase -i A
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user