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

git-rebase-show-commit asks to save git-rebase-todo #2770

Closed
fice-t opened this issue Sep 14, 2016 · 6 comments
Closed

git-rebase-show-commit asks to save git-rebase-todo #2770

fice-t opened this issue Sep 14, 2016 · 6 comments
Labels
enhancement New feature or request

Comments

@fice-t
Copy link
Contributor

fice-t commented Sep 14, 2016

  1. emacs -Q
  2. magit-status a repo and do an interactive rebase with several commits
  3. Press RET on any of the commits

Perhaps this is an intended safety measure in this case, but I find it more annoying than anything. However, I usually like the save prompt in other situations.

Could git-rebase-todo be exempt from magit-save-repository-buffers at least in the case of git-rebase-show-commit?

Magit 20160902.1451, Git 2.9.3, Emacs 25.1.3, gnu/linux

@tarsius
Copy link
Member

tarsius commented Sep 14, 2016

Could git-rebase-todo be exempt from magit-save-repository-buffers at least in the case of git-rebase-show-commit?

It seems to me that this is one of those situations when you really want to save the buffer. Say you edit some file but don't save it, then you start a rebase and a conflict occurs in exactly that file? What now? You have to save your work manually in some other file, resolve the conflict, and finish the rebase. Then you have to recover the changes from the temporary file, but it might not be as simple as just copying it to the proper location and Magit won't be able to help you merging.

@tarsius
Copy link
Member

tarsius commented Sep 14, 2016

Instead I would recommend that you set magit-save-repository-buffers to t and permanently enable ---autostash in the rebase popup.

@tarsius tarsius added the support User needs some help label Sep 14, 2016
@fice-t
Copy link
Contributor Author

fice-t commented Sep 15, 2016

I believe there's been some miscommunication. What I meant by that was: could the file git-rebase-todo itself be exempt from the save prompt (not the other files in the git repository).

i.e. I'd rather not be prompted with Save file <repo>/.git/rebase-merge/git-rebase-todo? (y, n, ...) when viewing commits using RET in git-rebase-mode even when no other files in the repository are modified.

@tarsius tarsius added enhancement New feature or request and removed support User needs some help labels Sep 15, 2016
@tarsius
Copy link
Member

tarsius commented Sep 15, 2016

Well, it's late here... :-) I will look at this in a few days.

kyleam added a commit that referenced this issue Sep 15, 2016
The git-rebase-todo buffer is frequently in a modified state, but there
is no need to save it before showing a commit.  It will be taken care of
by with-editor-return when the user exits through with-editor-finish.

The unsaved buffer should almost always be the git-rebase-todo because
the initial 'git rebase' call will fail if there are unstaged changes.
The user could unwisely go and modify some other tracked buffers after
starting a rebase, and this could put things into a bad state [1], but
this is unrelated to whether the user happened to call a command to show
a commit.

Closes #2770.

[1] And, when the user has done this, I don't think there is really any
    good action to take to fix the situation.  It's bad whether or not
    the buffer is saved.  The user should just never start an
    interactive rebase and then change buffers of tracked files before
    triggering the rebase with with-editor-finish.
@kyleam
Copy link
Member

kyleam commented Sep 15, 2016

I've looked into a bit and don't think asking to save the buffer is a
useful behavior (see commit message of #2771).

kyleam added a commit that referenced this issue Sep 15, 2016
The git-rebase-todo buffer is frequently in a modified state, but there
is no need to save it before showing a commit.  It will be taken care of
by with-editor-return when the user exits through with-editor-finish.

The unsaved buffer should almost always be the git-rebase-todo because
the initial 'git rebase' call will fail if there are unstaged changes.
The user could unwisely go and modify some other tracked buffers after
starting a rebase, and this could put things into a bad state [1], but
this is unrelated to whether the user happened to call a command to show
a commit.

Closes #2770.

[1] And, when the user has done this, I don't think there is really any
    good action to take to fix the situation.  It's bad whether or not
    the buffer is saved.  The user should just never start an
    interactive rebase and then change buffers of tracked files before
    triggering the rebase with with-editor-finish.
@fice-t
Copy link
Contributor Author

fice-t commented Sep 15, 2016

@kyleam That works for me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants