Skip to content

Stage the translations before checking for changes - #15

Merged
pavel-te merged 1 commit into
mainfrom
fix/gitlab-recipe-first-run-push
Aug 7, 2026
Merged

Stage the translations before checking for changes#15
pavel-te merged 1 commit into
mainfrom
fix/gitlab-recipe-first-run-push

Conversation

@pavel-te

@pavel-te pavel-te commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

init prints a GitLab job whose last step commits the downloaded translations and pushes them as a merge request. That step asked git diff --quiet before it ran git add -A.

On the first run the translations are new files. A plain git diff compares the worktree against the index and only looks at tracked paths, so it reports nothing to do: the block is skipped, no branch is pushed, no merge request appears — and the job still ends green. A second run works, because by then the files are tracked. So the failure lands on exactly the run where someone is deciding whether this works at all.

Reproduced before the change: with an untracked file present and nothing else modified, git diff --quiet exits 0.

The job now stages first and asks git diff --cached --quiet, which is what the snippet published in the product already does — the two copies of this recipe had drifted apart.

Verification

  • tests/test-init.sh: 75 assertions, 0 failures. The three new ones fail against main: they assert the order (git add -A before the check), the --cached form, and the absence of the worktree-only check, so a revert cannot pass them silently.
  • All eight suites: 237 assertions, 0 failures, on bash 3.2.57 (macOS).
  • The rendered job still parses as YAML, and bash -n ptc-cli.sh is clean.

The GitLab recipe printed by `init` ran `git diff --quiet` before `git add -A`.
On the first run the translations are new files, which a plain `git diff` does
not look at, so the check reported nothing to do: the job skipped the push and
went green without opening a merge request. A second run worked, because by
then the files were tracked — so the failure landed on the one run where a user
is deciding whether this works at all.

The recipe now stages first and checks `git diff --cached --quiet`, which is
what the snippet published in the product already does.

The self-test asserts the order rather than the presence of both commands, and
fails on the previous revision.
@pavel-te
pavel-te merged commit e78b4b3 into main Aug 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants