3 # Keep track of the last time we modified the object store
5 # Beware, we MAY be running in a chroot!
9 var_xargs_r
=@var_xargs_r@
11 # Some platforms' broken xargs runs the command always at least once even if
12 # there's no input unless given a special option. Automatically supply the
13 # option on those platforms by providing an xargs function.
14 xargs() { command xargs $var_xargs_r "$@"; }
16 git config gitweb.lastreceive
"$(date '+%a, %d %b %Y %T %z')"
18 # Read the incoming refs and freshen old loose objects
19 # If we waited until post-receive a gc could have already nuked them
20 # We freshen the new ref in case it's being resurrected to protect it from gc
21 # We probably do not need to do it for new refs as Git tries to do that,
22 # but since we're already doing it for old refs (which Git does not do),
23 # it's almost no extra work for new refs, just in case. We also attempt
24 # to make all packs user and group writable so they can be touched later.
26 octet
='[0-9a-f][0-9a-f]'
27 octet4
="$octet$octet$octet$octet"
28 octet20
="$octet4$octet4$octet4$octet4$octet4"
30 find objects
/pack
-maxdepth 1 -type f \
! -perm -ug+w \
31 -name "pack-$octet20.pack" -print0 | \
35 while read -r old new ref
; do
38 if [ "$old" != "0000000000000000000000000000000000000000" ]; then
39 # freshen mod time on recently unref'd loose objects
42 oldp
="objects/$shard/$fn"
44 if [ "$new" != "0000000000000000000000000000000000000000" ]; then
45 # prevent imminent pruning of a ref being resurrected
48 newp
="objects/$shard/$fn"
50 chmod ug
+w
$oldp $newp 2>/dev
/null ||
:
51 touch -c $oldp $newp 2>/dev
/null ||
: