@@ -28,21 +28,16 @@ if [ "${newrev}" == '0000000000000000000000000000000000000000' ]; then
2828 exit 0
2929fi
3030
31- # Check if a zero sha, then either a new branch is pushed or an empty repo is being pushed
32- if [ " ${oldrev} " == " 0000000000000000000000000000000000000000" ]; then
33- # List heads, add a ^ to negate in the following 'git rev-list' command
34- heads=$( git for-each-ref --format=' %(refname)' refs/heads/* | sed ' s/^/\^/' )
35- # List everything reachable from ${newref} but not from any heads
36- span=$( git rev-list ${newrev} ${heads} )
37- else
38- # branch labels are updated after hook ran successfully, so get all new commits, but none that are reachable from any branches
39- # specify that we don’t want any commits that are reachable from any of the known branch labels
40- span=$( git rev-list ${oldrev} ..${newrev} --not --branches=' *' )
41- fi
31+ checksince=" --since=2020-04-27"
32+
33+ # branch labels are updated *after* the hook ran successfully,
34+ # so get all commits reachable from newref (that are newer than a certain date),
35+ # that are not reachable from any yet known ref (branch) labels
36+ span=$( git rev-list ${newrev} ${checksince} --not --all)
4237
43- # ------------------------------------
44- # Iterate over all commits in the push
45- # ------------------------------------
38+ # ----------------------------------------
39+ # Iterate over all new commits in the push
40+ # ----------------------------------------
4641
4742refuse=false
4843for sha1 in ${span} ; do
@@ -64,7 +59,6 @@ for sha1 in ${span}; do
6459 commitfirstline=$( echo " ${commitmessage} " | head -n 1)
6560
6661 # don't check revert commits
67- # TODO
6862 if [[ " ${commitfirstline} " == Revert* ]]; then
6963 continue
7064 fi
0 commit comments