findmissing: initdb_chromeos: Handle merge commits

If the tip of the tree is a merge commit, its handling ends up odd if we don't
record it.

- First time around, the last SHA handled is the SHA preceding the merge.
  It will include the commits in the merge itself, though. This SHA is recorded
  as last handled SHA.
- Next time, the code looks at all commits from SHA..HEAD, ie the merge.
  It will again try to handle all the SHAs in the merge, but not the merge
  itself. All SHAs will be listed as duplicates.
  The last SHA handled will be the last SHA that is part of the merge, not the
  tip of the tree. This SHA is recorded as last SHA handled.
- Next time, the script will try to find all SHAs starting from the last SHA of
  the merge up to the tip of the tree. It will find lots of duplicates when
  doing so, but nothing new. With that, we are back to the first step.

This will repeat until there is a non-merge commit at the tip of the tree.

Handle this situation by recording the merge itself as last commit handled.
This way, the code always looks at the tip of the tree, no matter if it is a
merge or not.

BUG=None
TEST=Run on GCE

Change-Id: Ia4a7ff5863a6ead4b77fb9b02c07051be921f6f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2207395
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Commit-Queue: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
1 file changed