Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update git.md (“Hosting Considerations”) #2074

Merged
merged 4 commits into from
Sep 1, 2023
Merged

Update git.md (“Hosting Considerations”) #2074

merged 4 commits into from
Sep 1, 2023

Conversation

brycewray
Copy link
Contributor

Adds details related to obtaining accurate .GitInfo data when using hosts’ native interfaces. Information accurate as of 2022-05-08.

Adds details related to obtaining accurate `.GitInfo` data when using hosts’ native interfaces. Information accurate as of 2022-05-08.
@brycewray
Copy link
Contributor Author

One correction to that. The closing command (in the code example) should, of course, be:

git fetch --unshallow && hugo --minify

@jmooring
Copy link
Member

jmooring commented Sep 1, 2023

@brycewray

Can you rework this information into a table with footnotes? Something like:

Hosting service Clone depth Configurable
Cloudflare Pages shallow ✔️1
GitHub Pages deep ✔️
GitLab Pages 42 ✔️
Netlify deep
Some other service 2

Footnotes

  1. Preface your build command with git fetch --unshallow

Suggested changes per @jmooring comment.
@brycewray
Copy link
Contributor Author

brycewray commented Sep 1, 2023

@jmooring Have edited the file to that effect. Not sure if it'll appear in what you can see. If not, let me know and I'll do a fresh PR with the changes, which amount to the following, below. N.B.: I didn't put in the "Configurable" column because it seemed unnecessary for what I ended up doing.

Hosting Considerations

On the site host, your repository must be "deep-cloned," so the returned .GitInfo data will be accurate. Otherwise, your site may display only data from your latest commit. Controlling the cloning level isn't possible in most hosts' native interfaces but, instead, must be done through CI/CD (e.g., a GitHub Action or GitLab CI/CD). See the following table:

Hosting service Clone depth
Cloudflare Pages Shallow1
DigitalOcean App Platform Deep
GitHub Pages Deep
GitLab Pages Shallow2
Netlify Deep
Vercel Shallow

Footnotes

  1. To configure a Cloudflare Pages site for deep cloning, preface the site's normal Hugo build command with git fetch --unshallow && (e.g., git fetch --unshallow && hugo).

  2. Set the GitLab Runner's clone depth as explained in the GitLab documentation.

@jmooring
Copy link
Member

jmooring commented Sep 1, 2023

The idea behind the "configurable" green check mark is... yeah, the default for x is shallow, but that's not a problem, and here's why (footnote).

With GitHub Pages, if you use https://github.com/actions/checkout#checkout-v3, the default is shallow, not deep. The example workflow in our documentation sets the fetch depth. Maybe you want to point to that.

The GitLab example in our documentation includes the depth setting, so you might want to point to that as well.

Further changes (including re-adding "Configurable" column and providing more info and links) per @jmooring.
@brycewray
Copy link
Contributor Author

brycewray commented Sep 1, 2023

@jmooring Have edited as per your last comment.

(...except I forgot the GitLab example link; will make shortly. Trying to do two things at once. Sorry.)

Copy link
Member

@jmooring jmooring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last change...


[^CFP]: To configure a Cloudflare Pages site for deep cloning, preface the site's normal Hugo build command with `git fetch --unshallow &&` (*e.g.*, `git fetch --unshallow && hugo`).

[^GHP]: You can configure the GitHub Runner to do a deep clone by specifying `fetch-depth: 0` in the applicable "checkout" step of your workflow file, as shown in the Hugo documentation's [example workflow file](/hosting-and-deployment/hosting-on-github/#procedure).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[^GHP]: You can configure the GitHub Runner to do a deep clone by specifying `fetch-depth: 0` in the applicable "checkout" step of your workflow file, as shown in the Hugo documentation's [example workflow file](/hosting-and-deployment/hosting-on-github/#procedure).
[^GHP]: You can configure the GitHub Action to do a deep clone by specifying `fetch-depth: 0` in the applicable "checkout" step of your workflow file, as shown in the Hugo documentation's [example workflow file](/hosting-and-deployment/hosting-on-github/#procedure).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the change directly in the file rather than accepting the suggestion because I still needed to add the GL-related Hugo link you mentioned earlier. Done.

Further changes (incl. one forgotten from previous comment) per @jmooring.
@jmooring
Copy link
Member

jmooring commented Sep 1, 2023

This is great; thanks. Sorry it took me a while to get to it.

@brycewray
Copy link
Contributor Author

This is great; thanks. Sorry it took me a while to get to it.

Sorry it took me so many iterations to give you what you wanted! 😄

@jmooring jmooring merged commit acfa0be into gohugoio:master Sep 1, 2023
6 checks passed
@brycewray brycewray deleted the patch-2 branch September 1, 2023 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants