error: 'website/themes/PaperMod' does not have a commit checked out #125

Closed
opened 2026-05-17 14:33:31 +00:00 by guettli · 1 comment
guettli commented 2026-05-17 14:33:31 +00:00 (Migrated from codeberg.org)

Do plan.

Do plan.
guettlibot commented 2026-05-21 05:03:45 +00:00 (Migrated from codeberg.org)

Plan: Replace PaperMod git submodule with Hugo Modules

Root cause

website/themes/PaperMod is tracked as a git submodule. Running git commit . includes the submodule path in the path spec, and git fails with "does not have a commit checked out" when the submodule is not properly initialized (e.g. after a fresh clone without git submodule update --init). The error makes day-to-day use brittle.

Recommended solution: Hugo Modules

Hugo has a first-class dependency manager (Hugo Modules) that works like Go modules: a go.mod + go.sum file in website/ pins the theme version, and Hugo downloads it at build time. No git submodule is needed.

Benefits:

  • git commit . works — the themes/ directory no longer exists as a submodule
  • Theme version is pinned by a hash in go.sum (reproducible)
  • Hugo caches the downloaded theme; Dagger can mount a cache volume for it
  • Updating PaperMod is hugo mod get -u instead of git submodule update

Steps

1. Initialize Hugo Modules in website/

cd website
hugo mod init sharedinbox.de

This creates website/go.mod.

2. Add PaperMod as a Hugo module import

In website/hugo.toml, replace theme = 'PaperMod' with:

[module]
[[module.imports]]
  path = "github.com/adityatelange/hugo-PaperMod"

Then pin the version:

cd website
hugo mod get github.com/adityatelange/hugo-PaperMod@v8.0.0

(Use the latest tagged release. This updates go.mod and go.sum.)

3. Remove the git submodule

git submodule deinit -f website/themes/PaperMod
git rm website/themes/PaperMod
git rm .gitmodules
rm -rf .git/modules/website/themes/PaperMod

The themes/ directory can be removed entirely or kept empty and gitignored.

4. Update ci/main.goHugo() container

Hugo Modules require the go binary at build time (to download modules). Add Go and a module cache volume to the Hugo() container:

func (m *Ci) Hugo() *dagger.Container {
    return dag.Container().
        From("alpine:3.21").
        WithExec([]string{"apk", "--no-cache", "add",
            "curl", "tar", "libc6-compat", "libstdc++", "gcompat", "go"}).
        WithMountedCache("/root/go/pkg/mod", dag.CacheVolume("hugo-mod-cache")).
        WithExec([]string{"curl", "-sL", "...", "-o", "/tmp/hugo.tar.gz"}).
        // ... rest unchanged
}

The hugo-mod-cache Dagger cache volume ensures PaperMod is downloaded only once per engine, not on every CI run.

5. Commit website/go.mod, website/go.sum, updated hugo.toml

git add website/go.mod website/go.sum website/hugo.toml
git commit -m "fix: replace PaperMod git submodule with Hugo Modules"

Summary of changes

File Change
.gitmodules Deleted
website/themes/PaperMod (submodule) Removed
website/go.mod New — Hugo module root
website/go.sum New — pinned PaperMod hash
website/hugo.toml theme = 'PaperMod'[module.imports] block
ci/main.go Hugo() Add go package + hugo-mod-cache volume

After this change git commit . will work without errors.

## Plan: Replace PaperMod git submodule with Hugo Modules ### Root cause `website/themes/PaperMod` is tracked as a git submodule. Running `git commit .` includes the submodule path in the path spec, and git fails with _"does not have a commit checked out"_ when the submodule is not properly initialized (e.g. after a fresh clone without `git submodule update --init`). The error makes day-to-day use brittle. ### Recommended solution: Hugo Modules Hugo has a first-class dependency manager (Hugo Modules) that works like Go modules: a `go.mod` + `go.sum` file in `website/` pins the theme version, and Hugo downloads it at build time. No git submodule is needed. Benefits: - `git commit .` works — the `themes/` directory no longer exists as a submodule - Theme version is pinned by a hash in `go.sum` (reproducible) - Hugo caches the downloaded theme; Dagger can mount a cache volume for it - Updating PaperMod is `hugo mod get -u` instead of `git submodule update` --- ### Steps #### 1. Initialize Hugo Modules in `website/` ```bash cd website hugo mod init sharedinbox.de ``` This creates `website/go.mod`. #### 2. Add PaperMod as a Hugo module import In `website/hugo.toml`, replace `theme = 'PaperMod'` with: ```toml [module] [[module.imports]] path = "github.com/adityatelange/hugo-PaperMod" ``` Then pin the version: ```bash cd website hugo mod get github.com/adityatelange/hugo-PaperMod@v8.0.0 ``` (Use the latest tagged release. This updates `go.mod` and `go.sum`.) #### 3. Remove the git submodule ```bash git submodule deinit -f website/themes/PaperMod git rm website/themes/PaperMod git rm .gitmodules rm -rf .git/modules/website/themes/PaperMod ``` The `themes/` directory can be removed entirely or kept empty and gitignored. #### 4. Update `ci/main.go` — `Hugo()` container Hugo Modules require the `go` binary at build time (to download modules). Add Go and a module cache volume to the `Hugo()` container: ```go func (m *Ci) Hugo() *dagger.Container { return dag.Container(). From("alpine:3.21"). WithExec([]string{"apk", "--no-cache", "add", "curl", "tar", "libc6-compat", "libstdc++", "gcompat", "go"}). WithMountedCache("/root/go/pkg/mod", dag.CacheVolume("hugo-mod-cache")). WithExec([]string{"curl", "-sL", "...", "-o", "/tmp/hugo.tar.gz"}). // ... rest unchanged } ``` The `hugo-mod-cache` Dagger cache volume ensures PaperMod is downloaded only once per engine, not on every CI run. #### 5. Commit `website/go.mod`, `website/go.sum`, updated `hugo.toml` ```bash git add website/go.mod website/go.sum website/hugo.toml git commit -m "fix: replace PaperMod git submodule with Hugo Modules" ``` --- ### Summary of changes | File | Change | |------|--------| | `.gitmodules` | Deleted | | `website/themes/PaperMod` (submodule) | Removed | | `website/go.mod` | New — Hugo module root | | `website/go.sum` | New — pinned PaperMod hash | | `website/hugo.toml` | `theme = 'PaperMod'` → `[module.imports]` block | | `ci/main.go` `Hugo()` | Add `go` package + `hugo-mod-cache` volume | After this change `git commit .` will work without errors.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guettli/sharedinbox#125