Repository navigation
bin/ fixes: terraform install, submodule scripts, shared fixture, tidy-ups - #141
Merged
Merged
Conversation
The throwaway source repository, bare remotes and superproject were set up the same way in four tests/shell files. They now load tests/shell/helpers/git-fixture.bash and call git_fixture and bare_remote. Refs #136 Co-Authored-By: AI Agent <noreply@harleypig.com>
…orktree modules set-submodule-branch now checks git checkout: a submodule whose checkout fails is reported, gets no branch, and the script exits non-zero. Each branch it records is committed straight away, .gitmodules alone, so a later rmsubmodule no longer refuses over an unstaged .gitmodules. rmsubmodule asked for .git/modules/NAME, which in a linked worktree is not where git keeps the submodule (.git is a file there). It now asks git rev-parse --git-path modules/NAME, which names the worktree's own modules directory. --git-common-dir, which the issue suggested, would name the main checkout's modules directory, the wrong one. mvsubmodule never reads .git/modules; a new test pins that it already works in a linked worktree. Closes #135 Co-Authored-By: AI Agent <noreply@harleypig.com>
Neither Ubuntu's nor Fedora's repositories carry terraform or terraform-ls; they are only in HashiCorp's own repository. Asking apt-get for them aborted the whole install, so gawk, jq, shellcheck and shfmt were not installed either. They now sit with hadolint, sqlint and tflint in the closing "install by hand" message, with HashiCorp's install pages. Adding HashiCorp's repository was not chosen: it would make this script take a trust decision on the user's behalf. Closes #130 Co-Authored-By: AI Agent <noreply@harleypig.com>
coc-docker depends on dockerfile-language-server-nodejs and runs its own copy, so the global npm install served only the hand-written languageserver.dockerfile block in coc-settings.json, which a sibling change removes. The settings half lands there. Refs #21 Co-Authored-By: AI Agent <noreply@harleypig.com>
Five lines differed from shfmt run with the options .editorconfig sets for bin/ (bats files are not matched there, so pass them as flags). Refs #44 Co-Authored-By: AI Agent <noreply@harleypig.com>
- mvsubmodule and rmsubmodule no longer say "and updated readme" in their commit messages; neither touches a readme. mvsubmodule loses its commented-out echo, mkreadme and README.md lines and the stray git config note at its top, none of which carried a reason. - update-coc-extensions reads $XDG_CONFIG_HOME/coc/extensions when XDG_CONFIG_HOME names a directory, as CoC itself does, and says "Cannot parse" for a malformed package.json instead of claiming no extensions are installed. - post-clone loads nvm from where its installer puts it (NVM_DIR, else $XDG_CONFIG_HOME/nvm, else ~/.nvm) instead of a dotfiles-only startup file, and reports a missing nvm.sh rather than a shell error. - post-clone asks dpkg-query for a package's status, so a package removed with its configuration left behind, which dpkg -l still lists, is installed instead of skipped. Refs #44 Co-Authored-By: AI Agent <noreply@harleypig.com>
prettier was installed only as ALE's Markdown fixer, which a sibling change removes. Nothing else configured runs it. The ALE half lands there. Refs #51 Co-Authored-By: AI Agent <noreply@harleypig.com>
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes in the
bin/scripts, one commit each:files each set up (a source repository, bare remotes and a
superproject) is now in
tests/shell/helpers/git-fixture.bash, loadedwith
load. Thetests/vimhalf is left for its own change.set-submodule-branchnow checks thatgit checkoutworked. If it fails, it reports the submodule, records no branch for
it, and exits non-zero. Each branch it records is committed right
away, with only
.gitmodulesin the commit, so a laterrmsubmoduleno longer refuses over an unstaged
.gitmodules.rmsubmodulenowfinds the submodule's git directory in a linked worktree.
post-cloneno longer asks apt or dnf forterraformorterraform-ls. The closing "install by hand" message now lists themwith HashiCorp's install pages.
post-cloneno longer installsdockerfile-language-server-nodejs. coc-docker depends on it and runsits own copy (checked in the npm registry:
coc-docker@1.0.2depends on
dockerfile-language-server-nodejs ^0.9.0). The matchingcoc-settings.jsonchange is in the intellisense PR.vscode-html-languageservicewas never installed bypost-clone, sonothing to remove for the html block.
post-cloneno longer installsvim-language-server. ALE stopped running vimls in fix: XDG fallbacks, w!!, paste toggle and ALE linter names (#85, #101, #25, #100) #123, andcoc-vimlsp builds the server into its own bundle (the npm registry
lists
vim-language-server ^2.3.1as a devDependency ofcoc-vimlsp@0.13.1, compiled intoout/index.js), so the globalinstall was used by nothing.
post-cloneno longer installsprettier. Itwas installed only as ALE's Markdown fixer, which the intellisense PR
removes, and nothing else configured runs it. The ALE half lands in
that PR. If this PR merges first, ALE briefly names a fixer that
post-clone no longer installs.
tests/shell/update-coc-extensions.batsreformattedwith the shfmt options
.editorconfigsets forbin/. This is aformatting-only commit.
readme". Unexplained commented-out lines are removed from
mvsubmodule.update-coc-extensionsnow reads$XDG_CONFIG_HOME/coc/extensionsthe same way CoC does, and says"Cannot parse" when
package.jsonis malformed.post-cloneloads nvmfrom where nvm's installer puts it, and uses
dpkg-querystatus, so apackage that was removed but left its config files gets installed.
docs/scripts.mdis updated for the behaviour changes.Closes #130
Closes #135
Refs #136
Refs #44
Refs #21
Refs #100
Refs #51
Decisions
Neither Ubuntu's nor Fedora's repositories carry terraform or
terraform-ls, so asking apt or dnf for them can only fail. Installing
packages one at a time would let gawk, jq, shellcheck and shfmt
install, but every stock machine would still report "Setup did not
complete". Adding HashiCorp's repository would make the script take a
trust decision for the user. Listing them with hadolint, sqlint and
tflint matches how this script already handles tools it does not
install.
--git-path, not--git-common-diras the issuesuggested. In a linked worktree, git keeps that worktree's submodule
directories under
.git/worktrees/<wt>/modules/, andgit rev-parse --git-path modules/NAMEreturns that path.--git-common-dirpoints at the main checkout's.git/modules, whichis the wrong directory. Checked with git 2.53.
mvsubmoduletoo, but it never reads.git/modules. A new test confirms it already works in a linkedworktree, so it needed no fix.
set-submodule-branchmakes one commit per submodule, not oneat the end. The script's existing early exit (no default branch)
would otherwise leave edits made before it uncommitted again.
Committing
-- .gitmodulesleaves anything else that was stagedalone. Only
.gitmodulesis committed, as the issue asked. Ifchecking out the branch moves a submodule's gitlink, that change is
left for the user to commit.
tests/shell/helpers/..claude/TESTS.mddoes not say where helpers go. The shared bats convention puts them in
tests/helpers/, but this helper is shell-only and that directory isoutside this change's files. bats does not recurse, so
bats tests/shelldoes not run it as a test.install.sh(
nvm_install_dir):NVM_DIR, else$XDG_CONFIG_HOME/nvm, else~/.nvm. Ifnvm.shis missing,post-clonenow warns instead offailing with a
sourceerror, and the existing npm check stillrecords the failure.
Testing evaluation
Run by the author, to the qa-tester's standard (no delegation in this
run).
tests/shell/*.bats, with stubs on PATHand local bare remotes. Nothing reaches the network and nothing is
really installed.
green:
rmsubmodule"removes the submodule's git directory in a linkedworktree": goes red if the script deletes
.git/modules/NAMEinstead of the
--git-pathresult.set-submodule-branch"commits the branch it records, and nothingelse": goes red if the commit is dropped, or if it commits
everything that is staged.
set-submodule-branch"records no branch when the checkout fails":goes red if the checkout result is ignored.
post-clone"asks no package manager for terraform…" and "names theconfigured tools…": go red if terraform goes back into
system_packages.post-clone"installs the linters…": goes red ifdockerfile-language-server-nodejs,vim-language-serverorprettiergoes back intonpm_packages.post-clone"apt-get installs a package that was removed but leftits configuration": goes red when the check goes back to
dpkg -l.post-clonenvm tests (NVM_DIR,~/.nvm, missingnvm.sh, "reportsnpm installed once"): go red when the script sources the
dotfiles-only startup file.
update-coc-extensionsXDG test: goes red with a hard-coded~/.config. The parse test goes red when jq's failure is ignored.mvsubmodule/rmsubmodule"says in its commit message only what itdid": go red if "and updated readme" returns.
protocol.file.allowatneverturned 24 tests red.
mvsubmodule"moves a submodulein a linked worktree".
from
mvsubmoduleget no test, because removing a comment changes nobehaviour.
entry point (the script run as a command). The
set-submodule-branchfailure path was run with a submodule that has neither a local nor a
remote-tracking
main.Manual verification
ubuntu:24.04container with this branch copiedin, plus
sudo,gitandcurlinstalled.bin/post-clonewith no npm and no pipx.shellcheck shfmt", with no terraform. Afterwards
dpkg-queryreportsall four as
install ok installed. nvm loads from~/.nvm, and thescript prints "npm installed successfully". The manual list names
terraform and terraform-ls.
the four are installed. Or
sourcereports a missingshell-startup/nodejs.still exited 1 and printed "Setup did not complete". The submodule
step failed (
fatal: not a git repository) because the copy of theworktree's
.gitfile points at a path outside the container. Thatfailure comes from how the test was set up, not from this change.
The full failure list was not captured.
Locally:
bats tests/shellpassed 97 of 97 (and again after the #100 and #51 commits). It also passed run the wayCI runs it, with SIGPIPE ignored and GNU coreutils first on PATH, under
a fresh empty
TMPDIRthat was still empty afterwards.shfmt -d bin/and
shellcheck bin/*are clean, and the bats files are clean undershfmtwithbin/'s options. markdownlint is clean ondocs/scripts.md.Review
opt-out: no review skill ran. The changes are small shell fixes,
each with a regression test that was seen to fail first. In place of a
review skill, the author reviewed the full diff by hand.
Self-review of the full diff (
git diff origin/master). It found oneproblem: the first docs wording missed the case where
XDG_CONFIG_HOMEis set but is not a directory. That is fixed. No hook, and no rule or
skill that can refuse work, is changed.
Completion report
no access surface.
sudouse isunchanged.
commits are their record.
package.jsonparse failures and failed checkoutsare now caught.
nvm.shand amalformed JSON file each give a clear message and a non-zero exit.
docs/scripts.mdand the scripts'--help.docs/hashicorp.mdstill says to install terraform "via packagemanager". That file is outside this change and is listed as a
follow-up.
Co-Authored-By: AI Agent noreply@harleypig.com