threads / discuss / 40466

git 2.6.0 apply --cached failed

Subject: git 2.6.0 apply --cached failed

## tl;dr

2 messages between Oct 1, 2015 and Oct 1, 2015.

replies: 1people: 2as markdown or json

乙酸鋰· Oct 1, 2015, 05:38 UTC · lore
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· Oct 1, 2015, 05:57 UTC · re: 乙酸鋰 · lore

Re: git 2.6.0 apply --cached failed

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.

← back to recent threads