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

Fail graciously with enableGitInfo = true in a non-git project #6035

Closed
marcojakob opened this issue Jun 13, 2019 · 6 comments
Closed

Fail graciously with enableGitInfo = true in a non-git project #6035

marcojakob opened this issue Jun 13, 2019 · 6 comments

Comments

@marcojakob
Copy link

Hugo (v0.55.6/extended windows/amd64) exits with a fatal error if enableGitInfo is set to true in a folder that does not contain git info.

Failed to read Git log: fatal: not a git repository (or any of the parent directories): .git

I don't think it's necessary to quit and raise a fatal error in that case. I'm using the new GitHub template function and others are using my Hugo repo as a template. Then if someone just downloads the repo without using git (there are such people), they face this error. I think a warning would be more than enough.

@marcojakob
Copy link
Author

The lastmod parameter has a nice mechanism to fall back to other dates if the git info is not available. Maybe the enableGitInfo config could be handled similarly.

Or would this create a problem with the way people are using the Git Info Variables?

@stale
Copy link

stale bot commented Oct 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Oct 12, 2019
@marcojakob
Copy link
Author

For the record: I currently use a workaround for this issue. I've removed the enableGitInfo from config.toml and instead use it as a command line argument. Since I'm using Netlify, my netlify.toml looks like this:

[build]
publish = "public"
command = "hugo --baseURL $URL --enableGitInfo"

[build.environment]
HUGO_VERSION = "0.55.6"

This way if someone downloads the repo without using git and uses Hugo to run, the fatal error does not appear.

@stale stale bot removed the Stale label Oct 12, 2019
@stale
Copy link

stale bot commented Feb 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Feb 9, 2020
@stale stale bot closed this as completed Mar 11, 2020
Spaceface16518 added a commit to Spaceface16518/website that referenced this issue May 17, 2020
@Spaceface16518
Copy link

I don't think this should be closed. This issue is causing my build to fail on the Vercel platform. With hugo version

Hugo Static Site Generator v0.70.0/extended darwin/amd64 BuildDate: unknown

Setting enableGitInfo = false causes the build to succeed.

@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants