out-of-date-submodule
submodule
parent pinned to an older submodule SHA while the submodule has moved ahead
Description
A parent repo whose pinned submodule SHA (`vendor/lib`) is one commit behind the submodule's current HEAD. The parent committed the submodule when it had 2 commits; a third commit was then added inside the submodule without updating the parent's pin. `git submodule status` shows `+` for `vendor/lib`, indicating the checked-out submodule HEAD differs from the parent's recorded SHA. Useful for testing: - out-of-date submodule detection and `+` status flag display - "update submodule pin" workflows (`git add vendor/lib` + commit) - diff between the pinned SHA and the current submodule HEAD - `git submodule update` to restore the pinned state
Contracts
- parent main has 2 commits
- .gitmodules registers vendor/lib
- git submodule status shows + for vendor/lib
- vendor/lib HEAD is 1 commit ahead of the parent pin
Tags
Branches
main Use it
import { spinUpScenario } from '@gfargo/git-scenarios'
const repo = await spinUpScenario('out-of-date-submodule') npx git-scenarios create out-of-date-submodule import { describeWithScenario } from '@gfargo/git-scenarios/jest'
describeWithScenario('out-of-date-submodule', (getRepo) => {
it('should have the expected state', async () => {
const repo = getRepo()
// your assertions here
})
}) Commit graph
* c4d8ca4 (HEAD -> main) chore: add vendor/lib submodule
* c428bd9 chore: initial scaffold