Currently, headache implicitly relies on git log default order, i.e. by descending commit dates.
I think we should rely on the reverse chronological order of author dates instead (i.e. git log --author-date-order --reverse).
As an example, let's consider an empty repo where two commits are created:
➜ test-repo git:(master) export GIT_AUTHOR_DATE="Sat May 19 01:01:01 2007 -0700" \
&& echo 'hello' > hello.txt \
&& git add hello.txt \
&& git commit -m 'Hello, is it me you are looking for?'
[master (root-commit) a5ec09c] Hello, is it me you are looking for?
1 file changed, 1 insertion(+)
create mode 100644 hello.txt
➜ test-repo git:(master) export GIT_AUTHOR_DATE="Sat May 19 01:01:01 2003 -0700" \
&& echo 'Good bye' > goodbye.txt \
&& git add goodbye.txt \
&& git commit -m 'You say goodbye but I say hello'
[master a16415b] You say goodbye but I say hello
1 file changed, 1 insertion(+)
create mode 100644 goodbye.txt
➜ test-repo git:(master) unset GIT_AUTHOR_DATE
By default, the order is: a16415b then a5ec09c (i.e. commits sorted by descending commit date):
➜ test-repo git:(master) git log --format='%h %ad %cd %s' | cat
a16415b Mon May 19 01:01:01 2003 -0700 Fri Dec 28 18:41:55 2018 +0100 You say goodbye but I say hello
a5ec09c Sat May 19 01:01:01 2007 -0700 Fri Dec 28 18:41:48 2018 +0100 Hello, is it me you are looking for?
What we want instead is the last commit in terms of author date ordering (when the contents was created matters [author date], not when it was merged [commit date] in my opinion), i.e.:
➜ test-repo git:(master) git log --format='%h %ad %cd %s' --author-date-order --reverse | cat
a5ec09c Sat May 19 01:01:01 2007 -0700 Fri Dec 28 18:41:48 2018 +0100 Hello, is it me you are looking for?
a16415b Mon May 19 01:01:01 2003 -0700 Fri Dec 28 18:41:55 2018 +0100 You say goodbye but I say hello