FetchContent: incremental commit or full repo?

I recently learned from discussions here that when FetchContent fetches a particular GIT_TAG (i.e. a Git commit hash), it first pulls in the entire repo (from pointer to GIT_REPOSITORY), then checks-out the requested GIT_TAG. Okay.

But for an existing build directory into which FetchContent has previously pulled a repo, if the GIT_TAG changes to refer to a commit not (yet) present in the build directory (i.e. _reps/), does it fetch just the missing commit or the entire repo all over again?

Going from memory, so I could be wrong, but I believe it just does a git fetch if there’s already a repo cloned but it doesn’t have the ref requested by GIT_TAG. It should end up just fetching the commits it doesn’t yet have.

You might be interested in the discussions on issue 17770. It isn’t directly related to your question, but it touches on areas that also relate to making clones and fetches faster.