GSoC with git, week 13: leftovers

Par Alban, le

The conversion of git-rebase--interactive.sh is done, but I still have some things on my todo list.

Improving the todo list processing

If you look at complete_action(), you may notice that a lot of functions read the todo list from the filesystem, parses and processes it, then write it back. It’s a remnant of the shell script: git-rebase--interactive.sh had to call those functions, but there was no way to pass around the parsed representation of the todo list. This is no longer a problem since this is rewritten in C: we can generate a todo_list once, pass it to every function that need it, and write it once to the disk.

However, some of these functions are still needed by git-rebase--preserve-merges.sh, so, instead of dropping the read/parse/process/parse dance, we need to move the “process” part to its own function. This way, we can use the “process” function from sequencer.c, while still being able to use it from rebase -p.

Warn the user when a commit is dropped with --edit-todo

By default, git does not warn if you drop a commit from the todo-list after the initial edit. This behaviour can be changed: you can be warned, or postpone the rebase if this happens.

But this parameter won’t be taken into account when you edit the todo list later with --edit-todo. This is because edit_todo() and complete_action() are completely different codepathes (and edit_todo() does not check if the new todo list is correct!), so git’s behaviour is very inconsistent here.

This change was proposed by Phillip Wood.

Clean sequencer.c

Some functions from the sequencer are only needed by interactive rebase, so it would be nice to move them to rebase-interactive.c to unclutter the sequencer.

Right now, I’m working on improving the todo list processing. All of this will keep me busy for a little while after the GSoC.