am: simplify allocations in get_commit_info()