[BUG] `Bash(git diff)` truncating hunks

Resolved 💬 4 comments Opened Mar 20, 2026 by inigohidalgo Closed Apr 7, 2026

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 -M diffstat appended per file (not standard git output)
  • git log output truncated at ~30 lines with ... (+N more lines)
  • ls output gets a file-type summary appended
  • Plain command output (e.g. echo in 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_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗