pcottle/learnGitBranching — pull request #195 by ptsoccer (2014-07-24 22:29:45+00:00)
Title: Add testable interactive rebase

I was deciding between whether to add functionality to the current rebaseInteractive function that would allow the function to run without a GUI or write a new function entirely that tests the functionality of rebaseInteractive. I did this by extracting a function from rebaseInteractive called getInteractiveRebaseCommits which just gets the list of commits that would have been displayed to the user. This function then gets called by the testable interactive rebase and the regular interactive rebase.

Unfortunately it doesn't test the GUI (I tried to do this but ran into issues with the $ variable not existing and decided to not dif in further). But it tests about as much of the non interactive logic that it can.

Not sure if this was the best way to go about it, but I added an extra flag to git rebase called "--interactive-test". Running "git rebase -i --interactive-test, will behave as if the user immediately hit the confirm button when rebase dialog appeared.
Running "git rebase -i --interactive-test C3,C2,C1" will behave as if the user selected C3, C2, and C1, in that order.

Anyway, not sure if this is worth merging, but figured at least having some test for -i would be useful. If you have any suggestions let me know