update.sh: tolerate partial fetches
commit2ed5486858b6d6840a77e7cfdd5d17a6941f8e2f
authorKyle J. McKay <mackyle@gmail.com>
Thu, 8 Feb 2018 18:56:13 +0000 (8 10:56 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 8 Feb 2018 18:56:13 +0000 (8 10:56 -0800)
treefa8f2601a70235639cb4f4d747eb3660fcace24a
parent7009f8677d8e3de5959075080ad2e1fab100c484
update.sh: tolerate partial fetches

It's possible that a fetch may actually fetch something and make
some progress, but still report an error (i.e. a non-zero result
code) because the fetch did not complete entirely successfully.

Since we already go to the trouble of collecting before and after
refs and comparing them, we can actually detect this situation with
a minor amount of refactoring but really no additional work we were
not already doing.

Go ahead an treat a fetch that changed some refs but reported a
non-zero result status as a "successful fetch".  However, in that
case, do keep a copy of the fetch log in the project's .banglog
file, but do NOT set the project's .banged flag.

At present only activate this for normal Git fetches.  In the future
perhaps it might be extended to foreign VCS mirror types as well.

One example where this matters occurs when a malicious Git-impersonation
attempts to send non-commit object ref values for any of the refs
under the refs/heads/... hierarchy.  Git has prohibited this since
Git version 1.5.4.  In this case fetch will update all the other
refs while skipping the problem ones.  That is now treated as a
successful fetch for the change notification and summary page updates
rather than a failure unless the only updates were bad ones that
were ignored.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
jobd/update.sh