From f3c88b081022c945f010cdbfcd25e0008e0c3f5b Mon Sep 17 00:00:00 2001 From: nickg Date: Sun, 21 May 2017 19:06:15 -0700 Subject: [PATCH] Add warning on GitInfo and Shallow Clones --- content/extras/gitinfo.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/extras/gitinfo.md b/content/extras/gitinfo.md index d29641bcb..d267e0e3f 100644 --- a/content/extras/gitinfo.md +++ b/content/extras/gitinfo.md @@ -44,7 +44,11 @@ Subject : commit message subject, e.g. `tpl: Add custom index function` -## Performance Considerations +## Other Considerations The Git integrations should be fairly performant, but it does add some time to the build, which depends somewhat on the Git history size. +The accuracy of data depends on the underlying local git respository. If the local repository is a *shallow clone*, then any file that hasn't been modified in the truncated history will default to data in the oldest commit. In particular, if the respository has been cloned using `--depth=1` then every file will the exact same `GitInfo` data -- that of the only commit in the repository. + +In particular, many CI/CD systems such as [travis-ci.org](https://travis-ci.org) default to a clone depth of 50 which is unlikely to be deep enough. You can explicitly add back the missing history using using `git fetch --unshallow` or [make the initial checkout deeper](https://docs.travis-ci.com/user/customizing-the-build#Git-Clone-Depth). +