-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Support GitInfo for content folders in different Git repositories #5533
Comments
That is a bold statement. 99% of Hugo sitest out there are mono repos with a |
It wouldn't affect those 99%, though, would it? If the content directory is just a regular subdirectory of the repo, Hugo's going to find the exact same repo root. But |
Maybe, maybe not. |
How could it break anything that currently works? It'd just mean running |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Submitted the above PR. I don't really understand why I'm getting errors on Travis regarding #5327. Is that something I've broken? Did I pull the wrong branch? I'd be grateful for any input, as I'm totally new to the Hugo codebase. Regarding the patch: From my tests, the TL;DR is it works 100% the same in the common "mono-repo" scenario, also enables the standard Specifically, if you currently run Currently, This patch makes the |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
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. |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Because the The core Hugo application does not impose any restrictions on the location of the content directory (relative to where the The While this has always been the default behaviour, it's also quite obviously incorrect to search for content metadata starting from the working directory instead of the directory where the files whose metadata you're interested in are actually located. |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
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. |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
Hugo still tries to find the content's git repo in |
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. |
Add an option to get git metadata from the content dir instead of the working dir Fixes gohugoio#5533
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. |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533
|
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. |
Bad bot. |
Add an option to get git metadata from the content dir instead of the working dir Fixes gohugoio#5533 Signed-off-by: Khusika Dhamar Gusti <[email protected]>
Hi, Are there any updates or plans to implement the changes mentioned above by deanish to the main branch? Anything you can share with us? |
We have (almost?) exactly the same case. We have a dedicated repository with "base" Hugo things, such as theme, layouts, partials, shortcodes, styles, etc, and then several different projects include this repository as a Git submodule in their repositories, and each have their own
And so Hugo is run like this: $ cd base
$ hugo --config="../config.toml" --contentDir="../content/" That is such a killer feature of Hugo's flexible architecture to be able to work like that, but unfortunately this way it indeed doesn't get Git information from the project repository, where the actual useful content lives. It would be great if Hugo was using Git information from the repository which the |
When the last modified date of a page cannot be determined, i.e. due to this missing feature in Hugo, do not show that template in the page footer. See gohugoio/hugo#5533 Signed-off-by: Carolyn Van Slyck <[email protected]>
Does anyone have a workaround/link for fetching git data when the content dir is a submodule? |
We are running into this exact same issue. Hugo modules are very effective in exactly the situation described above, but because the Last modified date is useless in these sub modules, we are removing it from the doc. Would love, love, love to see a fix for this! :) |
Looking for a solution for this too. Would love, love, love to see a fix for this! :) |
Get metadata for `GitInfo` from `contentDir` instead of `workingDir`. This decouples the `GitInfo` feature from the working directory, making it dependent on configuration, not the directory `hugo` is run in. Rationale --------- This patch aligns the `GitInfo` feature more closely with the way the rest of Hugo works. The standard `cd /my/site && hugo` build idiom also works when content isn't in the same repo as site, and it allows the `GitInfo` feature to be used regardless of which directory `hugo` is run from (when configured correctly), as is the case for other features. Currently, Hugo searches the working directory for the git repo to populate `GitInfo` content metadata. This means that, in order to retrieve the correct metadata, `hugo` must be run from within the repo containing the content. If `hugo` isn't run from within a repo, `--enableGitInfo` causes a repo-not-found build error, even if the content *is* in a repo. And if `hugo` is run in a different repo, say if content is a submodule of site, it will find no/bad data, as it's looking in the wrong repo. This restriction is unique to `GitInfo` (AFAIK). If you aren't using that feature, you can run Hugo in any directory you want, as long as you pass the appropriate flags. This patch makes it possible to use the standard `cd /my/site && hugo` build process also when the content is in a different repo. More generally, it makes it possible to run `hugo` from any directory when using `--enableGitInfo`, as you can when not using it. Effects ------- `GitInfo` currently only works correctly if `workingDir` and `contentDir` are in the same repo, so it will continue to work everywhere it already works, particularly in the normal case of having site and content in a single repo. This patch will also make `GitInfo` Just Work ^(TM) when content is in a separate repo to the site. Currently, using `GitInfo` requires `cd`-ing to the content repo and running `hugo` from there with a bunch of flags. If the content is unversioned, this patch will cause Hugo to *always* fail to build the site when run with `--enableGitInfo`. Currently, because Hugo looks in the working directory, not the content directory, a build with unversioned content can succeed when Hugo is called with `--enableGitInfo` as long as Hugo is *run* within a git repo. Hugo won't find any (correct) file metadata, but missing file metadata don't cause a build error, whereas a missing git repo does. Fixes gohugoio#5533 Signed-off-by: Khusika Dhamar Gusti <[email protected]>
Bump. This is such a crucial feature. I want to have content and config separate from each other, as it should be. They are not dependent on each other. |
@deanishe Can you tell how? I have If I run |
Hi @siddhpant This is my dir tree
|
GitInfo
provides metadata about content files, but from my observations and reading of the code, it actually searches the working directory for a git repo, not the content directory.As a result, if content and theme/configuration are kept in separate repos (including when content is a submodule), Hugo fails to find any git metadata for the content files because it's querying the wrong repo.
Because
GitInfo
is for information about content, not theme/build configuration etc., Hugo should search for a git repo from the content directory, not the working directory, which is generally where the configuration and themes are found, and may or may not be in the same repo.This should make
GitInfo
behave correctly for anyone who keeps their content in a separate repo, while continuing to work as before for mono-repos.The text was updated successfully, but these errors were encountered: