git: fixed last_changeset algorithm