Subject: [bug#50072] [PATCH WIP 0/4] Add upstream updater for git-fetch origins.

From: Maxime Devos <[email-masked]>
Date: Wed, 05 Jan 2022 11:07:06 +0100

zimoun schreef op di 04-01-2022 om 23:22 [+0100]:
> 2) ’auto’ is confusing…
> 
> > +                     (select? (negate vcs-file?)))
> > +  "Compute the hash of FILE with ALGORITHM.  If RECURSIVE? is #true or 'auto',
> > +recurse into subdirectories of FILE, computing the combined hash (nar hash) of
> 
> …here I understand that ’auto’ means #true…

Precisely, in the sense 'auto' means #true in that 'auto' recurses.
But sometimes #true / auto compute a different hash ...

> > +Keep in mind that the hash of a regular file depends on RECURSIVE?:
> > +if the recursive hash is desired, it must be set to #true.  Otherwise, it must
> > +be set to #false or 'auto'. In most situations, the non-recursive hash is desired
> > +for regular files."
> 
> …but there it is the contrary. :-)

No, when #:recursive? is 'auto' and the file is a directory, it
recurses. When it is 'auto' and the file is a regular file, then
it also recurses, albeit in a trivial way (because regular files don't
contain other files).

This comment explains that the 'recursive hash' (nar hash) and 'regular
hash' of a regular file are different, that usually you want the
regular hash for regular files, and implies that '#:recursive? auto'
usually does the right thing.

But if you really want the recursive hash for regular files, then you
can still compute that by setting #:recursive? #true.

>   To me, #true/#false or #t/#f are
> meaningful, especially when…
> 
> > +  (if (or (eq? recursive? #true)
> > +          (and (eq? recursive? 'auto)
> 
> …the symbol ’auto’ is only used here.  IIRC all the series. :-)

In ‘[PATCH v4 3/4] refresh: Support non-tarball sources.’, there's

> +                (let ((hash (file-hash* output)))

There, #:recursive? is 'auto'.

Greetings,
Maxime