am: suppress error output from a conditional

When testing if the $dotest directory exists, and if $next is greater
than $last, the script currently executes `cat` on files that might
not exist.  So, suppress the error output from `cat`.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
rebase -i: don't error out if $state_dir already exists

Practically speaking, the only reason why a `mkdir $state_dir` would
fail is because $state_dir already exists.  There is no problem in
this case, and we can proceed as usual.  So, change the `mkdir` call
to `mkdir -p`, and strip the `|| die`.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
am: tighten a conditional that checks for basic state

We currently assume that, if the $dotest directory exists,
write_basic_state() has been called.  This might match a stray $dotest
directory created somewhere else and result in failures down the
line. So, tighten the conditional by additionally looking for the
first file written by write_basic_state(), $dotest/head-name.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
am: don't do housekeeping when rebasing

Perform these two tasks:

    rm -fr "$dotest"
    git gc --auto

only when not called with --rebasing (from git-rebase--am).
Otherwise, let the caller decide if and when to do the cleanup.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
rebase: implement rebase.autostash
fixup! am: don't do housekeeping