simp / simp/puppetsync

git_commit amends clean trees when the message matches, defeating skip_unchanged_targets on re-runs

Open Beginner friendly
#94 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1
Forks
5
Avg merge
8d 1h
Merged PRs (30d)
4

Description

Problem

git_commit.rb amends whenever HEAD's message matches the session commit message — even when the working tree is clean:

amend = head_status.success? && head_message.rstrip == commit_message.rstrip
...
args << '--amend' if amend
{ 'changed' => true, 'amended' => amend }

A clean-tree amend produces a new commit SHA with an identical tree, and reports changed: true. Consequences on any fleet re-run:

  • every repo comes out ok instead of unchanged, so skip_unchanged_targets never skips the GitHub stages
  • git_push_to_remote force-pushes ~70 branches whose trees didn't change
  • every open PR's head moves → full CI re-runs fleet-wide (~1,000 jobs) for no-op updates

This is why the 2026-08-12 reference-md re-run rewrote all 71 heads (validated identical trees), and it reproduces trivially: run any session twice back-to-back — the second run amends and force-pushes everything.

Fix

Check git status --porcelain FIRST; when the tree is clean, return { 'changed' => false } regardless of whether HEAD's message matches. The amend path should only apply when there IS something to commit on a branch whose HEAD already carries the session commit.

The existing spec "reports changed: false and leaves HEAD alone when there is nothing to commit" misses this because its no-op scenario uses a message that doesn't match HEAD — add a case where it does.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in git_commit.rb and inspect the existing no-op spec, whose current case uses a nonmatching message. Add coverage for a clean tree whose HEAD message matches, then run the relevant spec. Done means it reports changed: false, leaves HEAD unchanged, and does not amend.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, ruby
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.