Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commits should be sorted by author's date and author's date should be used for copyright years #31

Open
fbiville opened this issue Dec 28, 2018 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@fbiville
Copy link
Owner

fbiville commented Dec 28, 2018

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.txttest-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.txttest-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
@fbiville fbiville added bug Something isn't working good first issue Good for newcomers labels Dec 28, 2018
@fbiville fbiville added this to the 1.0.0-M02 milestone Dec 28, 2018
@fbiville fbiville changed the title Commits should be sorted by author's date Commits should be sorted by author's date and author's date should be used for copyright years Dec 28, 2018
@fbiville fbiville modified the milestones: 1.0.0-M04, 1.0.0-M05 Jan 2, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant