[BUG] `Bash(git diff)` truncating hunks
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When running Bash(git diff) and other commands that generate patch-like diffs (git diff, git show) it seems like there's some postprocessing being applied to the output. This has led to Claude missing important details in diffs. See below for detailed examples.
This isn't necessarily a bug, but I do not see this change documented anywhere so I do not know if this is intentional. This is a breaking change anyways as many of my workflows rely on full diffs being visible to the model.
What Should Happen?
Claude should get the full output of the Bash command. Or at the very least there should be visible feedback that there is postprocessing being applied, as this was a silent failure.
Error Messages/Logs
Steps to Reproduce
The Bash tool post-processes git diff output, truncating hunks with many consecutive +/- lines (~10 line threshold). This silently drops content, causing the model to miss changes.
Example: Replaced lines — additions completely hidden
A hunk where 15 lines are deleted and replaced with 3 new lines. The deletions are shown but the additions are silently dropped.
Raw git diff (via git diff > /tmp/out.txt + Read tool)
diff --git a/src/config.py b/src/config.py
index abc1234..def5678 100644
--- a/src/config.py
+++ b/src/config.py
@@ -10,25 +10,5 @@
# Database settings
-DB_HOST = "localhost"
-DB_PORT = 5432
-DB_NAME = "myapp"
-DB_USER = "admin"
-DB_PASS = "hunter2"
-DB_POOL_SIZE = 10
-DB_TIMEOUT = 30
-DB_RETRY = 3
-DB_SSL = True
-DB_LOG_QUERIES = False
-DB_MIGRATION_DIR = "./migrations"
-DB_SEED_DIR = "./seeds"
-DB_BACKUP_ENABLED = True
-DB_BACKUP_INTERVAL = "daily"
-DB_BACKUP_RETENTION = 30
+from db_config import get_db_settings
+
+DB = get_db_settings()
# App settings
What the Bash tool returns to the model
src/config.py
@@ -10,25 +10,5 @@
# Database settings
-DB_HOST = "localhost"
-DB_PORT = 5432
-DB_NAME = "myapp"
-DB_USER = "admin"
-DB_PASS = "hunter2"
-DB_POOL_SIZE = 10
-DB_TIMEOUT = 30
-DB_RETRY = 3
-DB_SSL = True
-DB_LOG_QUERIES = False
... (truncated)
+3 -15
The 3 added lines are invisible. The model sees only deletions and concludes lines were removed, when they were actually replaced. The +3 -15 summary is appended by the tool (not part of git output) but doesn't show what was added.
Real-world impact
This caused a failure where - [ ] task was replaced with - [x] task (checkbox completion). The +[x] lines were truncated, so the model reported "no task completions found" — it only saw deletions.
Other post-processing observed
- Diff headers (
diff --git,index,---/+++) are stripped; only filename and@@hunks shown +N -Mdiffstat appended per file (not standard git output)git logoutput truncated at ~30 lines with... (+N more lines)lsoutput gets a file-type summary appended- Plain command output (e.g.
echoin a loop) is NOT truncated
Workaround
git diff > /tmp/diff.txt
Then use the Read tool on /tmp/diff.txt.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version. Here is the exact same command with 2.1.79 and 2.1.80 side-by-side
<img width="996" height="1151" alt="Image" src="https://github.com/user-attachments/assets/0a6e4d03-ca0f-4d4a-9fc5-23efc3bf588b" />
<img width="1133" height="825" alt="Image" src="https://github.com/user-attachments/assets/3fffad79-a8d7-453e-ab67-609c7c7e12fc" />
Last Working Version
2.1.79
Claude Code Version
2.1.80
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
4 Comments
It happens even when I run the bash command myself using
!git diff<img width="1177" height="702" alt="Image" src="https://github.com/user-attachments/assets/ef07dc42-5ce8-4b4a-94c8-32d4b2d45eee" />
git diff -- test-file.txt | sed 's/^/ /'(adding a whitespace character at the start of each line), or removing the@@hunk header line by usingtailgets around the filter. obviously this is not a practical workaround, but there is obviously some newly-added postprocessing of bash outputs that is pattern matching on diff format.Updating to 2.1.92 fixed the issue. The only truncation happening now is hitting the 50K output threshold that redirects the output to a file. I updated from .79 to .92 directly so I do not know exactly which version resolved the issue.
NOTE: There was not a single mention in the CHANGELOG of the initial change that introduced the regression or of the fix.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.