# git 2.6.0 apply --cached failed

2 messages from 2015-10-01 to 2015-10-01. Participants: 乙酸鋰, Junio C Hamano.
Thread: https://gitlist.dev/t/40466

## 乙酸鋰, 2015-10-01 05:38

Subject: git 2.6.0 apply --cached failed
Message-ID: <CAHtLG6TxAZsd54g+_eH2R3M=5oZ65V5cJ-0kkBt4vjbga+h9rQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAHtLG6TxAZsd54g%2B_eH2R3M%3D5oZ65V5cJ-0kkBt4vjbga%2Bh9rQ%40mail.gmail.com

```
Hi,

Using git 2.6.0 on Linux 64-bit
git apply --cached failed

Please test with command with the repository inside the attached tarball.

With git 2.6,
git apply --cached < patch.patch

fatal: corrupt patch at line 27


Expected result: no error

Step to reproduce: Please run the following shell script.

#/bin/sh
set -e
mkdir 2
cd 2

cat > d0c886e2-2cfe-4636-825b-3622fac0b27f <<EOF
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
EOF
git init
git status -s -b -u
git diff --numstat --cached --
git diff --numstat --
git update-index --add --stdin <<EOF
d0c886e2-2cfe-4636-825b-3622fac0b27f
EOF
git commit --file=- <<EOF
a commit for d0c886e2-2cfe-4636-825b-3622fac0b27f
EOF
git status -s -b -u
git diff --numstat --cached --
git diff --numstat --
git diff d0c886e2-2cfe-4636-825b-3622fac0b27f
git apply --cached <<EOF
diff --git a/d0c886e2-2cfe-4636-825b-3622fac0b27f
b/d0c886e2-2cfe-4636-825b-3622fac0b27f
index 749b185..1627b6b 100644
--- a/d0c886e2-2cfe-4636-825b-3622fac0b27f
+++ b/d0c886e2-2cfe-4636-825b-3622fac0b27f
@@ -1,8 +1,8 @@
 0
 1
-2
-3
-4
+2!
+3!
+4!
 5
 6
 7
@@ -10,9 +10,9 @@
 9
 10
 11
 12
 13
 14
 15
 16
 17
@@ -20,9 +20,9 @@
 19
 20
 21
-22
-23
-24
+22!
+23!
+24!
 25
 26
 27
EOF

```

## Junio C Hamano, 2015-10-01 05:57

Subject: Re: git 2.6.0 apply --cached failed
Message-ID: <xmqqzj035dwl.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqzj035dwl.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CAHtLG6TxAZsd54g+_eH2R3M=5oZ65V5cJ-0kkBt4vjbga+h9rQ@mail.gmail.com>

```
It probably is this one:

    http://thread.gmane.org/gmane.comp.version-control.git/270370/focus=270501

Older Git was loose and did not notice it, but the second hunk of
your patch is judged to be broken, with no added or deleted line
whatsoever, by the latest version.

```
