squash! rebase -i: parse to-do list command line options

rebase -i: parse to-do list command line options

Read in to-do list lines as

    command args

instead of

    command sha1 rest

so that to-do list command lines can specify additional arguments
apart from the commit hash and the log message title, which become
the non-options in `args`. Loop over `args`, put all options (an
argument beginning with a dash) in `opts`, stop the loop on the first
non-option and assign it to `sha1`. For instance, the to-do list

    reword --signoff fa1afe1 Some change

is parsed as `command=reword`, `opts= '--signoff'` (including the
single quotes and the space for evaluation and concatenation of
options), `sha1=fa1afel` and `rest=Some change`. The loop does not
know the options it parses so that options that take an argument
themselves are not supported at the moment. Neither are options that
contain spaces because the shell expansion of `args` in `do_next`
interprets white space characters as argument separator.

Print an error message for unknown or unsupported command line
options, which means an error for all specified options at the
moment. Cleanly break the `do_next` loop by assigning a reason to the
local variable `malformed`, which triggers the unknown command code
in `do_replay`. Move the error code to the beginning of `do_replay`
so that unknown commands are reported before bad options are as only
the first error we come across is reported. For instance, the to-do
list from above produces the error

    Unknown 'reword' option: --signoff
    Please fix this using 'git rebase --edit-todo'.

The to-do list is also parsed when the commit hashes are translated
between long and short format before and after the to-do list is
edited. Apply the same procedure as in `do_replay` with the exception
that we only care about where the options stop and the commit hash
begins. Do not reject any options when transforming the commit
hashes.

Enable the specification of to-do list command line options in
`FAKE_LINES` the same way this is accomplished for command lines
passed to `exec`. Define a new `fake_editor.sh` that edits a static
to-do list instead of the one passed as argument when invoked by
git-rebase. Add a test case that checks that unknown options are
refused and can be corrected using `--edit-todo`.
fixup! rebase -i: parse to-do list command line options
fixup! rebase -i: commit only once when rewriting picks
fixup! rebase -i: commit only once when rewriting picks
rebase -i: teach do_pick the option --reuse-authorship

- --reuse-authorship takes a revision and reuses the author and the
  author date of that revision for the commit it creates
- we need a mechanism to retain the authorship of replayed commits
  because do_pick creates new commits for reworded commits too
- sourcing author_script is error-prone if the git ident variables
  are already exported
- the git-commit command issued by do_pick assumes that the current
  author environment is the one chosen by the user and not the script
  so that --reset-author can correctly work
- using --reuse-authorship HEAD to create squash commits is easier to
  understand and read than wrapping the do_pick calls in do_author
squash! rebase -i: teach do_pick the option --reset-author

`do_pick` is the git-cherry-pick wrapper in git-rebase--interactive
that is used to implement many of the to-do list commands.
Eventually, the complete `do_pick` interface will be exposed to the
user in some form or another and those commands will become simple
aliases for the `do_pick` options now used to implement them.

Add the git-commit option `--reset-author` to the options pool of
`do_pick`. It rewrites the author date and name of the picked commit
to match the committer date and name.

If `--reset-author` is passed to `do_pick`, set the `rewrite` flag
and relay the option to the git-commit command line which creates the
final commit. If `--amend` is not passed as well, the fresh
authorship effect is achieved by the mere fact that we are creating a
new commit. Do not even source the ident information in that case
because the user shell might have already exported the respective
environment variables.
squash! rebase -i: enable options --signoff, --reset-author for pick, reword

rebase -i: enable --signoff, --reset-author for pick, reword, edit

Lift the general unknown option blockade for the `pick`, `reword` and
`edit` commands. If `do_cmd` comes across one of the options
`--signoff` and `--reset-author` while parsing a to-do entry and the
scheduled command is either `pick` or `reword`, relay the option to
`do_pick`.

Remember to add Signed-off-by: and to reset the authorship even when
the rebase is interrupted for conflict resolution and `git rebase
--continue` creates the commit. Employ the same mechanism that is
used to remember amending an interim squash commit after conflict
resolution or a commit after editing. If a line option was specified,
create the files `signoff` and `resetauthor` respectively in the
state directory. Also remember the new parent's hash and refuse to
create a commit if the user has created commits on top of where we
were when the rebase was interrupted. We are using a single file
`last_head` for this purpose from now so that we have to carry out
the check whether the head was moved just once.

While `signoff` is handled by simply specifying the `--signoff`
option when creating the commit, the `resetauthor` case is somewhat
more involved. The author script contains either the ident
information of the replayed commit or the one of the squash commit.
Renewing the authorship means using the user environment for the
authorship so that we need to skip the author script if `resetauthor`
exists and we are not amending. If we are amending, `--reset-author`
must be passed to git-commit because otherwise the authorship of HEAD
would be used.

`do_pick` options like `--gpg-sign` and `--file` are not yet
supported because `do_cmd` cannot handle option arguments and options
with spaces at the moment. `squash` and `fixup` still do not accept
user options as the interplay of `--reset-author` and the author
script is yet to be determined.

Add tests.
rebase -i: enable options --signoff, --reset-author for squash, fixup