-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebase continue: Add --no-edit flag to skip opening an editor
Git's `rebase --continue` always opens an editor to edit the commit message after resoling the conflict. There are cases where this is not necessary. This adds a `--no-edit` flag to `gs rebase continue` to skip opening an editor. `rebase` does not have a `--no-edit` flag to skip the editor but we can get the same effect by setting the editor to `true` for that command. Resolves #503
- Loading branch information
Showing
7 changed files
with
206 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Added | ||
body: >- | ||
rebase continue: | ||
Add `--[no-]edit` flag to skip opening an editor when continuing a rebase, | ||
or opt into it if the new `spice.rebaseContinue.edit` configuration is `true`. | ||
time: 2024-11-30T17:25:01.584724-08:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# 'rebase continue --no-edit' is able to continue from a conflict | ||
# without opening an editor. | ||
|
||
as 'Test <[email protected]>' | ||
at '2024-12-01T10:18:19Z' | ||
|
||
mkdir repo | ||
cd repo | ||
git init | ||
git commit --allow-empty -m 'Initial commit' | ||
gs repo init | ||
|
||
# add main -> feat1 | ||
gs trunk | ||
cp $WORK/extra/feat1.txt feat.txt | ||
git add feat.txt | ||
gs bc feat1 -m 'Add feature 1' | ||
|
||
# add main -> feat2 | ||
gs trunk | ||
cp $WORK/extra/feat2.txt feat.txt | ||
git add feat.txt | ||
gs bc feat2 -m 'Add feature 2' | ||
|
||
# add main -> feat3 | ||
gs trunk | ||
cp $WORK/extra/feat3.txt feat.txt | ||
git add feat.txt | ||
gs bc feat3 -m 'Add feature 3' | ||
|
||
# main: introduce a conflict | ||
gs trunk | ||
cp $WORK/extra/feat0.txt feat.txt | ||
git add feat.txt | ||
git commit -m 'Add feature 0' | ||
|
||
# Set editor to false to fail the test | ||
# if the editor is opened by any command | ||
env EDITOR=false | ||
|
||
# feat1: rebase continue --no-edit | ||
gs bco feat1 | ||
! gs branch restack | ||
stderr 'There was a conflict' | ||
cp $WORK/extra/feat1.txt feat.txt | ||
git add feat.txt | ||
gs rebase continue --no-edit | ||
|
||
# feat1: verify resolved | ||
cmp feat.txt $WORK/extra/feat1.txt | ||
git status --porcelain | ||
! stdout '.' # no changes | ||
|
||
# Make --no-edit the default | ||
git config spice.rebaseContinue.edit false | ||
|
||
# feat2: rebase continue --no-edit is default | ||
gs bco feat2 | ||
! gs branch restack | ||
stderr 'There was a conflict' | ||
cp $WORK/extra/feat2.txt feat.txt | ||
git add feat.txt | ||
gs rebase continue | ||
|
||
# feat2: verify resolved | ||
cmp feat.txt $WORK/extra/feat2.txt | ||
git status --porcelain | ||
! stdout '.' # no changes | ||
|
||
# feat3: rebase continue, --edit opt-in | ||
gs bco feat3 | ||
! gs branch restack | ||
stderr 'There was a conflict' | ||
|
||
env EDITOR=mockedit MOCKEDIT_GIVE=$WORK/input/feat3-msg.txt MOCKEDIT_RECORD=$WORK/feat3-conflict-msg.txt | ||
cp $WORK/extra/feat3.txt feat.txt | ||
git add feat.txt | ||
gs rebase continue --edit | ||
cmp $WORK/feat3-conflict-msg.txt $WORK/golden/feat3-conflict-msg.txt | ||
|
||
git graph | ||
cmp stdout $WORK/golden/log.txt | ||
|
||
-- extra/feat0.txt -- | ||
feature 0 | ||
|
||
-- extra/feat1.txt -- | ||
feature 1 | ||
|
||
-- extra/feat2.txt -- | ||
feature 2 | ||
|
||
-- extra/feat3.txt -- | ||
feature 3 | ||
|
||
-- input/feat3-msg.txt -- | ||
feat3: resolved | ||
|
||
-- golden/feat3-conflict-msg.txt -- | ||
Add feature 3 | ||
|
||
# Conflicts: | ||
# feat.txt | ||
|
||
# Please enter the commit message for your changes. Lines starting | ||
# with '#' will be ignored, and an empty message aborts the commit. | ||
# | ||
# interactive rebase in progress; onto ccf2371 | ||
# Last command done (1 command done): | ||
# pick 712f10b Add feature 3 | ||
# No commands remaining. | ||
# You are currently rebasing branch 'feat3' on 'ccf2371'. | ||
# | ||
# Changes to be committed: | ||
# modified: feat.txt | ||
# | ||
-- golden/log.txt -- | ||
* 200dbc4 (HEAD -> feat3) feat3: resolved | ||
* ccf2371 (main) Add feature 0 | ||
* 585bc4c Initial commit |