gregsexton / gitv

gitk for Vim.
936 stars 59 forks source link

Cannot figure out how to rebase. #121

Closed synic closed 6 years ago

synic commented 7 years ago

The docs are not very clear, typing grs on a commit opens the interactive rebase edit window. If I mark a commit for squash, how do I proceed to the commit message edit dialog? If I type :wq in the interactive rebase window, it closes the preview window and nothing happens. If I type grc, it says the preview window can't be found.

Beyond the keybindings, how does rebasing work in gitv? It is very unclear

rbong commented 7 years ago

Thank you for your feedback, it's badly needed for the new features.

I was sure there was a rebasing guide in the doc - I seem to be mistaken. I'll get on that.

Here is a short guide to get you started

Please let me know if the workflow is sufficient. I see that you expect the rebase to continue when you write to and close the todo file. The problem I have with automatically starting the rebase operation when writing to and closing the todo file is that the user could just want to save and look at commits before continuing. I would be more open to a keybinding or command that writes the todo file and immediately starts.

As far as preview window can't be found goes, I can't recreate this, but I think that this can happen if the rebase operation fails. I'll work on getting better error reporting for this. However, can you send more details? What happens if you run git rebase --continue from the console instead of grc? What instructions are you using?

synic commented 7 years ago

I am still not getting it :(

In this image: http://d.pr/i/wqHs/24zXoaTt I've marked the "add gitv plugin" (26628a4) for squash using grS.

I believe I am then supposed to start the rebase by typing grc, however, pressing grc doesn't appear to do anything.

If I press grs on the commit, I get this error: http://d.pr/i/POzb/25KkKNII

The "preview window can't be found" thing can be reproduced by starting an interactive rebase using grs, and then typing:wq in the todo file. It closes the todo window, and if you try to do anything in the git tree window, you will get the error.

rbong commented 7 years ago

The rebase isn't actually started as you stage commands, so you must use grs instead of grc. I will add documentation on using certain gr commands without a rebase actually in progress.

You can't squash the first commit in a rebase because there's nothing to squash into. It sounds like this is what's happening. So the rebase actually ends right away. However, there shouldn't be an error, just feedback. I will fix that.

I am still unable to create the preview window can't be found error. Do you have any custom gitv settings? Is there a merge in the rebase range?

synic commented 7 years ago

The same thing happens if I do it like this instead:

http://d.pr/i/O8SV/4uyb9ti9

If I then put my cursor on that line (commit 2c0308) and type grs, I get the same error. If I put it on the line below that, I get a commit dialog, but I do not see my previous commit messages (I'm used to seeing something like this: http://d.pr/i/bQ9Y/40Um45aj

Also, I think you are supposed to be able to squash the last commit, into the one previous. If I run git rebase -i 4617ee9, I see a dialog like this:

http://d.pr/i/WjIy/3rji1iKN - I can then squash the last commit, which is at the bottom, and saving it brings up this todo dialog, where I can edit the commit messages for all commits involved in the squash: http://d.pr/i/lxNX/3tbILzTX

rbong commented 7 years ago

The cursor should be on 4617ee9 when you press grs for squash to work. However, I just tried your setup and I still can't recreate the error when I run grs on a similar setup to 2c0308 on version 7.4 or 8.0. Can you post a minimal .vimrc and the output of vim --version? Would you also be able to push up a repo I could test on?

Also, when I get to the squash commit, I do see just a regular commit message. However, my version of vim detects that there was a change in the file, and when I reload I get the regular squash message. In other words, there is a race condition, and if you press :e you'll get the squash message you're expecting. I do not recall having to do this before, it's possible it's a race condition. I'll try to fix this.

Thank you for all this great feedback!

rbong commented 7 years ago

Never mind about the repo, I was able to find the repository you were using and could stil not recreate it.

rbong commented 7 years ago

Installed your vim dotfile repo, could not recreate. Still have to try it on OS X, but in case that doesn't work, can you post the output of vim --version? Thanks.

synic commented 7 years ago

Sorry, went on a mini vacation for the weekend. Later today I will try and record a video of what is happening for me. I'm sure I'm just doing something wrong.

:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 19 2017 03:58:09)
MacOS X (unix) version
Included patches: 1-567
Compiled by travis@Traviss-Mac-592.local
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +cindent         +cryptv          -ebcdic          +float           +insert_expand   +lispindent      +mouseshape      +mouse_xterm     +path_extra      +quickfix        +statusline      +terminfo        +vertsplit       +windows         -xterm_save
+arabic          +clientserver    +cscope          +emacs_tags      +folding         +job             +listcmds        +mouse_dec       +multi_byte      +perl/dyn        +reltime         -sun_workshop    +termresponse    +virtualedit     +writebackup
+autocmd         +clipboard       +cursorbind      +eval            -footer          +jumplist        +localmap        -mouse_gpm       +multi_lang      +persistent_undo +rightleft       +syntax          +textobjects     +visual          -X11
+balloon_eval    +cmdline_compl   +cursorshape     +ex_extra        +fork()          +keymap          +lua/dyn         -mouse_jsbterm   -mzscheme        +postscript      +ruby/dyn        +tag_binary      +timers          +visualextra     -xfontset
+browse          +cmdline_hist    +dialog_con_gui  +extra_search    +fullscreen      +lambda          +menu            +mouse_netterm   +netbeans_intg   +printer         +scrollbind      +tag_old_static  +title           +viminfo         +xim
++builtin_terms  +cmdline_info    +diff            +farsi           -gettext         +langmap         +mksession       +mouse_sgr       +num64           +profile         +signs           -tag_any_white   +toolbar         +vreplace        -xpm
+byte_offset     +comments        +digraphs        +file_in_path    -hangul_input    +libcall         +modify_fname    -mouse_sysmouse  +odbeditor       +python/dyn      +smartindent     -tcl             +transparency    +wildignore      -xsmp
+channel         +conceal         +dnd             +find_in_path    +iconv           +linebreak       +mouse           +mouse_urxvt     +packages        +python3/dyn     +startuptime     +termguicolors   +user_commands   +wildmenu        -xterm_clipboard
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib  -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/
openssl/lib   -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE
rbong commented 6 years ago

There were some rebase bugs fixed recently. I recommend trying again if you're still able.

rbong commented 6 years ago

I am going to hold off on calling this next version stable until I can do more testing on OSX or I can reproduce this, I don't want to risk major platform incompatability.

rbong commented 6 years ago

I am now able to reproduce the behaviour on Linux using the dotvim repo, even on the latest version of Gitv.

rbong commented 6 years ago

GitGutter appears to have effects on starting the rebase window, but it does not cause No preview window found.

rbong commented 6 years ago

Settings like this are causing No preview window found:

set splitright set splitbelow

There's also some odd behaviour when starting rebase, which is opening a commit window when rebase begins. Still exploring this.

rbong commented 6 years ago

Looks like if you squash commits and start on the commit before it, it also causes some issues.

rbong commented 6 years ago

Reproducing this has been super helpful in identifying several rebasing problems. These problems have compounded eachother to create this issue. Before this can be closed, several issues need to be resolved: