[ 
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.002.patch

Thanks [~ajisakaa], I'm attaching a fixed patch.
As for the first comment, the previous patch was a bit verbose. We can simplify 
it as an awk one-liner:

{code}
[sekikn@mobile ~]$ cat sample.patch 
diff --git 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/resources/images/rm-ha-overview.png
 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/resources/images/rm-ha-overview.png
deleted file mode 100644
[sekikn@mobile ~]$ awk '/^diff --git / { if ($3 !~ "^a/" || $4 !~ "^b/") { exit 
1 } }
> /^\+{3}|-{3} / { if ($2 !~ "^[ab]/" && $2 !~ "/dev/null") { exit 1 } }' 
> sample.patch
[sekikn@mobile ~]$ echo $?
1
[sekikn@mobile ~]$ 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 ~]$ awk '/^diff --git / { if ($3 !~ "^a/" || $4 !~ "^b/") { exit 
1 } }
> /^\+{3}|-{3} / { if ($2 !~ "^[ab]/" && $2 !~ "/dev/null") { exit 1 } }' 
> noprefix.patch
[sekikn@mobile ~]$ echo $?
1
[sekikn@mobile ~]$ 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 ~]$ awk '/^diff --git / { if ($3 !~ "^a/" || $4 !~ "^b/") { exit 
1 } }
> /^\+{3}|-{3} / { if ($2 !~ "^[ab]/" && $2 !~ "/dev/null") { exit 1 } }' 
> prefix.patch
[sekikn@mobile ~]$ echo $?
0
{code}

It seems fine.

> 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.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