inox-tools icon indicating copy to clipboard operation
inox-tools copied to clipboard

Warn about fetch-depth issues in content utils git times' docs

Open zemccartney opened this issue 1 month ago • 2 comments

Hello!

Just tried content utils for the first time, very cool, thanks for putting it out there!

Suggestion for the docs: call out that in order to access accurate git times, you must fetch the repo's entire history (i.e. fetch depth 0)

I appreciate this seems obvious saying it out loud. My rationale: CI services seem to default to a fetch depth of 1, at least cloudflare's build service and github's checkout action do, as far as I can tell (I ran into this behavior in both), such that my site would build, but the git times output would always be the build time (or however git calculates commit times when flatting history with fetch depth 1, not sure), different from when I built locally. Which is to say, there was no immediate indicator as to the source of the issue, why the diff between my local and remote behavior. The root cause eventually dawned on me reading around and thinking about it, hence why why I think a note in the docs would be useful, try to short circuit this thinking for others.

Happy to write something up if you think this'd be a useful contribution.

Suggesting documentation as I don't see what the library could reasonably do to handle this case, unless there's some way to programmatically identify the fetch depth setting used to fetch the current state of the repo (that seems farfetched, but would be happy to be surprised :) )

zemccartney avatar Nov 16 '25 23:11 zemccartney

I wrote about this on my blog in the past, but using Vercel: https://fryuni.dev/notes/vercel-git/

The library execute those commands to unshallow the clone, but I think just documenting it should suffice.

Feel free to send a PR with some text to clarify that on the docs.

Fryuni avatar Nov 19 '25 20:11 Fryuni

Ah, cool, thanks for the post, will check that out. And sure thing, I'll get a PR over soon.

zemccartney avatar Nov 22 '25 21:11 zemccartney