@@ -37,9 +37,31 @@ DIR=${4:-$(usage)}
3737NOTICE_CUTOFF=${5:- $(usage)}
3838
3939mainBranch=$( git branch --show-current)
40- newCutoff=$( date --date=" 1 year ago" +%s)
4140noticeCutoff=$( date --date=" $NOTICE_CUTOFF " +%s)
4241
42+ # People that received the commit bit after this date won't be retired
43+ newCutoff=$( date --date=" 1 year ago" +%s)
44+
45+ # We need to know when people received their commit bit to avoid retiring them within the first year.
46+ # For now this is done either with the git creation date of the file, or its contents:
47+ #
48+ # | commit bit reception date | file creation date | file contents |
49+ # | -------------------------- | ------------------ | -------------- |
50+ # | A) -∞ - 2024-10-06 | 2025-07-08 | empty |
51+ # | B) 2024-10-07 - 2025-04-22 | 2025-07-08 | reception date |
52+ # | C) 2025-08-13 - ∞ | reception date | empty |
53+ #
54+ # After 2026-04-23 (one year after C started), the file creation date
55+ # for all first-year committers will match the reception date,
56+ # while everybody else will have been a committer for more than one year.
57+ # This means the code can then be simplified to just
58+ # check if the file creation date is in the last year.
59+ #
60+ # For now however, the code needs to check if the file creation date
61+ # is before 2025-07-09 to distinguish between periods A and C,
62+ # so we hardcode that date for the code to use.
63+ createdOnReceptionEpoch=$( date --date=2025-07-09 +%s)
64+
4365if [[ -z " ${PROD:- } " ]]; then
4466 tmp=$( git rev-parse --show-toplevel) /.tmp
4567 rm -rf " $tmp "
@@ -54,12 +76,30 @@ mkdir -p "$DIR"
5476cd " $DIR "
5577for login in * ; do
5678
57- # Don't remove people that have been added recently
58- if [[ -s " $login " ]]; then
59- epochAdded=$( date --date=" $( < " $login " ) " +%s)
60- if (( newCutoff < epochAdded )) ; then
61- continue
79+ # Figure out when this person received the commit bit
80+ # Get the unix epoch of the first commit that touched this file
81+ # --first-parent is important to get the time of when the main branch was changed
82+ fileCommitEpoch=$( git log --reverse --first-parent --format=%cd --date=unix -- " $login " | head -1)
83+ if (( fileCommitEpoch < createdOnReceptionEpoch )) ; then
84+ # If it was created before creation actually matched the reception date
85+ # This branch can be removed after 2026-04-23
86+
87+ if [[ -s " $login " ]]; then
88+ # If the file is non-empty it indicates an explicit reception date
89+ receptionEpoch=$( date --date=" $( < " $login " ) " +%s)
90+ else
91+ # Otherwise they received the commit bit more than a year ago (start of unix epoch, 1970)
92+ receptionEpoch=0
6293 fi
94+ else
95+ # Otherwise creation matches reception
96+ receptionEpoch=$fileCommitEpoch
97+ fi
98+
99+ # If the commit bit was received after the cutoff date, don't retire in any case
100+ if (( newCutoff < receptionEpoch )) ; then
101+ log " $login became a committer less than 1 year ago, skipping retirement check"
102+ continue
63103 fi
64104
65105 trace gh api -X GET /repos/" $ORG " /" $ACTIVITY_REPO " /activity \
0 commit comments