Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tortilla cannot create/delete a step while rebasing #48

Open
darkbasic opened this issue Oct 16, 2017 · 2 comments
Open

Tortilla cannot create/delete a step while rebasing #48

darkbasic opened this issue Oct 16, 2017 · 2 comments

Comments

@darkbasic
Copy link
Contributor

darkbasic commented Oct 16, 2017

This is related to issue 13. To emulate something like an interactive rebase we also need to be able to pop/push a step while rebasing.

Ideally I would like to be able to push/pop a step even after a rebase failure, but in this case the HEAD would point to the previous commit, so it could be hard to implement. In fact if we simply do a git reset --hard HEAD; git rebase --continue it will indeed delete the step, but not reword all subsequent steps.
I'm not sure, but maybe this could be easily implemented once tortilla will be able to edit multiple steps by forcing tortilla to "stop" at the commits we want to pop/push.

Let's say we want to do the following:

edit step_1.2
drop step_1.3
pick step_1.4
edit step_1.5
push new_step
edit step_1.6

we could do something like:
tortilla step edit 1.2 1.3 1.5 1.6
and then once at step 1.3 simply type:
tortilla step pop; git rebase --continue
and once at commit 1.5:
tortilla step push [...]; git rebase --continue

@dotansimha
Copy link
Collaborator

It sounds good but the only issue is the API. @darkbasic do you have an idea for a good API for the feature? I guess that maybe the CLI should be super interactive and "ask" you what to do with each step. something similar to yarn interactive upgrade command.

@darkbasic
Copy link
Contributor Author

darkbasic commented Apr 17, 2018

The issue is only when we have merge conflicts.
For example let's say that I run tortilla step edit 9.1 9.2:

$ git status
interactive rebase in progress; onto 95f7c18
Last command done (1 command done):
   edit d26c5f4 Step 9.1: Optimistic updates
Next commands to do (13 remaining commands):
   exec GIT_SEQUENCE_EDITOR="node /home/niko/WebstormProjects/deps/tortilla/src/editor.js sort" git rebase --edit-todo
   edit 67129a1 Step 9.2: Get chat data from chats cache while waiting for server response
  (use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'master' on '95f7c18'.
  (use "git commit --amend" to amend the current commit)
  (use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working tree clean

Now I will be able to remove step 9.1 or create a new step after it with a simple tortilla step push/pop.

But let's say that I edit a file which will create a merge failure in step 9.2, as soon as I type git rebase --continue I'll have to fix the merge conflict and I'll get:

$ git status
interactive rebase in progress; onto 95f7c18
Last commands done (3 commands done):
   exec GIT_SEQUENCE_EDITOR="node /home/niko/WebstormProjects/deps/tortilla/src/editor.js sort" git rebase --edit-todo
   edit 67129a1 Step 9.2: Get chat data from chats cache while waiting for server response
  (see more in file .git/rebase-merge/done)
Next commands to do (11 remaining commands):
   exec GIT_SEQUENCE_EDITOR="node /home/niko/WebstormProjects/deps/tortilla/src/editor.js sort" git rebase --edit-todo
   pick e25a6ae Step 9.3: Landing page for new chats/groups
  (use "git rebase --edit-todo" to view and edit)
You are currently rebasing branch 'master' on '95f7c18'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   src/app/services/chats.service.ts

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        src/app/services/chats.service.ts.orig
commit 3c91c6da9869d5d036a694b5d69b9c25ebfff47f (HEAD)
Author: Niccolò Belli <[email protected]>
Date:   Fri Dec 8 10:43:45 2017 +0100

    Step 9.1: Optimistic updates

As you can see because of the merge conflict the HEAD is still at step 9.1 and not 9.2.
It means that I cannot delete step 9.2 or create new steps after it.
Typing git rebase --continue will not stop at step 9.2, but instead on the next step on the list (after 9.1 and 9.2 there are no more steps in the list, so it will simply end the rebase and stop at latest commit).
Unfortunately the only way I can imagine to solve such issue is to somehow convince git to stop at the commit after a merge failure and the subsequent git rebase --continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants