[ 
https://issues.apache.org/jira/browse/HADOOP-12018?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kengo Seki updated HADOOP-12018:
--------------------------------
    Attachment: HADOOP-12018.004.patch

bq. Developers may upload the patch created by git format-patch, so grepping 
the line starts with diff --git would be fine.

Thanks [~ajisakaa], I didn't recognize such a case.
Attaching a revised patch. It seems to work fine.

{code}
[sekikn@mobile hadoop]$ cat ~/noprefix.patch 
diff --git NOTICE.txt NOTICE.txt
deleted file mode 100644
index 62fc581..0000000
--- NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This product includes software developed by The Apache Software
-Foundation (http://www.apache.org/).
[sekikn@mobile hadoop]$ dev-support/test-patch.sh ~/noprefix.patch 

(snip)

Going to apply git patch with: git apply --binary -v -p0 --stat --apply
Checking patch NOTICE.txt...
Applied patch NOTICE.txt cleanly.
 NOTICE.txt |    2 --
 1 file changed, 2 deletions(-)
{code}

{code}
[sekikn@mobile hadoop]$ cat ~/prefix.patch 
diff --git a/NOTICE.txt b/NOTICE.txt
deleted file mode 100644
index 62fc581..0000000
--- a/NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This product includes software developed by The Apache Software
-Foundation (http://www.apache.org/).
[sekikn@mobile hadoop]$ dev-support/test-patch.sh ~/prefix.patch 

(snip)

Going to apply git patch with: git apply --binary -v -p1 --stat --apply
Checking patch NOTICE.txt...
Applied patch NOTICE.txt cleanly.
 NOTICE.txt |    2 --
 1 file changed, 2 deletions(-)
{code}

{code}
[sekikn@mobile hadoop]$ cat ~/noprefix-formatted.patch 
>From acdf7412d765a4d3f9980c1648e86c921c6948c5 Mon Sep 17 00:00:00 2001
From: sekikn <[email protected]>
Date: Thu, 4 Jun 2015 09:43:02 +0900
Subject: [PATCH 1/2] a

---
 NOTICE.txt | 2 --
 1 file changed, 2 deletions(-)
 delete mode 100644 NOTICE.txt

diff --git NOTICE.txt NOTICE.txt
deleted file mode 100644
index 62fc581..0000000
--- NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This product includes software developed by The Apache Software
-Foundation (http://www.apache.org/).
-- 
2.3.2 (Apple Git-55)

[sekikn@mobile hadoop]$ dev-support/test-patch.sh ~/noprefix-formatted.patch 

(snip)

Going to apply git patch with: git apply --binary -v -p0 --stat --apply
Checking patch NOTICE.txt...
Applied patch NOTICE.txt cleanly.
 NOTICE.txt |    2 --
 1 file changed, 2 deletions(-)
{code}

{code}
[sekikn@mobile hadoop]$ cat ~/prefix-formatted.patch 
>From acdf7412d765a4d3f9980c1648e86c921c6948c5 Mon Sep 17 00:00:00 2001
From: sekikn <[email protected]>
Date: Thu, 4 Jun 2015 09:43:02 +0900
Subject: [PATCH 1/2] a

---
 NOTICE.txt | 2 --
 1 file changed, 2 deletions(-)
 delete mode 100644 NOTICE.txt

diff --git a/NOTICE.txt b/NOTICE.txt
deleted file mode 100644
index 62fc581..0000000
--- a/NOTICE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This product includes software developed by The Apache Software
-Foundation (http://www.apache.org/).
-- 
2.3.2 (Apple Git-55)

[sekikn@mobile hadoop]$ dev-support/test-patch.sh ~/prefix-formatted.patch 

(snip)

Going to apply git patch with: git apply --binary -v -p1 --stat --apply
Checking patch NOTICE.txt...
Applied patch NOTICE.txt cleanly.
 NOTICE.txt |    2 --
 1 file changed, 2 deletions(-)
{code}

> smart-apply-patch.sh fails if the patch edits CR+LF files and is created by 
> 'git diff --no-prefix'
> --------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-12018
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12018
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: build
>            Reporter: Akira AJISAKA
>            Assignee: Kengo Seki
>            Priority: Minor
>         Attachments: HADOOP-12018.001.patch, HADOOP-12018.002.patch, 
> HADOOP-12018.003.patch, HADOOP-12018.004.patch, 
> HADOOP-12018.test-noprefix.patch, HADOOP-12018.test-noprefix.patch
>
>
> If the patch edits a file includes CR+LF and created by "git diff 
> --no-prefix", smart-apply-patch.sh fails to patch. smart-apply-patch.sh 
> checks if the patch is created by "git diff" or "patch", however, if a patch 
> is created by "git diff --no-prefix", smart-apply-patch.sh detects the patch 
> is created by "patch" command. That's why 
> https://builds.apache.org/job/PreCommit-HADOOP-Build/6800/console fails.
> A workaround is to use "git diff" for creating patch if a file includes CR+LF 
> is edited.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to