• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sds / overcommit / 27295850158
92%
master: 91%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 10 Jun 2026 06:03PM UTC
Jobs 8
Files 222
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jun 2026 06:02PM UTC coverage: 91.615% (+0.009%) from 91.606%
27295850158

push

github

web-flow
Make hook context input reads thread-safe (#882)

## Summary

This fixes a small race in `HookContext::Base#input_string`.

Hook contexts currently cache stdin lazily with `@input_string ||=
@input.read`. Since hooks are parallelized by default, two hooks sharing
the same context can race during that first read. For hook types that
receive real data on stdin, such as `pre-push`, one hook can consume the
stream while another reads EOF and caches an empty string.

If that happens, helpers like `pushed_refs` can silently see no refs
even though Git did provide them.

## Changes

- Add a mutex around the first `input_string` read so the stream is
consumed once.
- Keep the cached string shared by all callers after the initial read.
- Add a spec that forces a concurrent read attempt without relying on
flaky timing.

This follows up on #881.

## Verification

Focused checks pass locally:

```sh
bundle exec rspec spec/overcommit/hook_context/base_spec.rb
bundle exec rubocop lib/overcommit/hook_context/base.rb spec/overcommit/hook_context/base_spec.rb
bundle exec overcommit --run
```

I also ran the full spec suite. It still has a few unrelated failures
around git alias amendment detection on my machine, but this change's
focused spec passes.

5 of 5 new or added lines in 1 file covered. (100.0%)

3278 of 3578 relevant lines covered (91.62%)

3025.45 hits per line

Jobs
ID Job ID Ran Files Coverage
1 ruby3.0-ubuntu - 27295850158.1 10 Jun 2026 06:04PM UTC 444
91.55
GitHub Action Run
2 ruby3.1-ubuntu - 27295850158.2 10 Jun 2026 06:04PM UTC 444
91.52
GitHub Action Run
3 ruby3.4-ubuntu - 27295850158.3 10 Jun 2026 06:04PM UTC 444
91.58
GitHub Action Run
4 ruby3.2-ubuntu - 27295850158.4 10 Jun 2026 06:03PM UTC 444
91.52
GitHub Action Run
5 ruby2.6-ubuntu - 27295850158.5 10 Jun 2026 06:04PM UTC 444
91.55
GitHub Action Run
6 ruby2.7-ubuntu - 27295850158.6 10 Jun 2026 06:03PM UTC 444
91.55
GitHub Action Run
7 ruby3.3-ubuntu - 27295850158.7 10 Jun 2026 06:04PM UTC 444
91.57
GitHub Action Run
8 ruby4.0-ubuntu - 27295850158.8 10 Jun 2026 06:03PM UTC 444
91.58
GitHub Action Run
Source Files on build 27295850158
  • Tree
  • List 222
  • Changed 221
  • Source Changed 1
  • Coverage Changed 221
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #27295850158
  • e88e06b8 on github
  • Prev Build on main (#26650011293)
  • Next Build on main (#27295884930)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc