{"thread":{"id":"31934","subject":"strange problems applying --no-prefix patch with -p0 and added files","startedAt":"2012-10-24T20:54:30Z","lastAt":"2012-10-26T22:14:50Z","messageCount":2,"participants":["Sergey Shelukhin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201825","messageId":"CAHXxaiCELHomSPQoZWw+SdV61Y0gVb9MEdRv-gCOfkJG50xCeQ@mail.gmail.com","threadId":"31934","inReplyTo":null,"subject":"strange problems applying --no-prefix patch with -p0 and added files","fromName":"Sergey Shelukhin","fromEmail":"sergey@hortonworks.com","sentAt":"2012-10-24T20:54:30Z","receivedAt":"2012-10-24T20:54:30Z","isPatch":false,"sender":{"key":"sergey@hortonworks.com","avatar":null},"body":"Hello.\nI am trying to apply a patch made via {git diff somehash^ somehash >\n....} before (same version of Git, same machine). I have no-prefix\nenabled by default.\nIf I try to apply the patch with -p0, it fails.\nIf I go to a directory where all the changed files are (\"src/\" below)\nto \"simulate\" the prefix for -p1, it silently does nothing.\nOnly if I make it a -p1 patch, it actually tries to do apply (and\napplies the new files that cause problems in -p0 alright too, if used\nwith --reject).\n\nI am relatively new to git, so while researching I realized I might be\nusing wrong ways to do things (e.g. not using cherry-pick), but this\nseems like a bug regardless.\n\nHere's the log of my interactions with git:\n\nreznor-mbp:git-hbase-089 sergey$ git version\ngit version 1.7.10.2 (Apple Git-33)\nreznor-mbp:git-hbase-089 sergey$ git status\n# On branch 0.94\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#    HBASE-6371.patch\nnothing added to commit but untracked files present (use \"git add\" to track)\nreznor-mbp:git-hbase-089 sergey$ git apply -p0 HBASE-6371.patch\nfatal: git apply: bad git-diff - inconsistent new filename on line 128\nreznor-mbp:git-hbase-089 sergey$ sed -n 125,129p HBASE-6371.patch\ndiff --git src/main/java/org/apache/\nhadoop/hbase/regionserver/CompactSelection.java\nsrc/main/java/org/apache/hadoop/hbase/regionserver/CompactSelection.java\nnew file mode 100644\nindex 0000000..a9ee0d4\n--- /dev/null\n+++ src/main/java/org/apache/hadoop/hbase/regionserver/CompactSelection.java\nreznor-mbp:git-hbase-089 sergey$ cd src\nreznor-mbp:src sergey$ git apply -p1 -v --whitespace=nowarn ../HBASE-6371.patch\n[ there's nothing here, e.g. no output ]\nreznor-mbp:src sergey$ git status\n# On branch 0.94\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#    ../HBASE-6371.patch\nnothing added to commit but untracked files present (use \"git add\" to track)\nreznor-mbp:src sergey$ cd ..\nreznor-mbp:git-hbase-089 sergey$ sed -E \"s/(--git|---) src/\\1 a\\/src/\"\nHBASE-6371.patch | sed -E \"s/ src\\// b\\/src\\//\" >\nHBASE-6371-prefix.patch\nreznor-mbp:git-hbase-089 sergey$ git apply HBASE-6371-prefix.patch\nHBASE-6371-prefix.patch:169: trailing whitespace.\n ...\nerror: patch failed:\nsrc/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java:64\nerror: src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java:\npatch does not apply\n....\n"},{"id":"201995","messageId":"CAHXxaiDE-GwufHHjGXOB=1O44dcfF0exuXtP-XpY8TyJ90914w@mail.gmail.com","threadId":"31934","inReplyTo":"CAHXxaiCELHomSPQoZWw+SdV61Y0gVb9MEdRv-gCOfkJG50xCeQ@mail.gmail.com","subject":"Re: strange problems applying --no-prefix patch with -p0 and added files","fromName":"Sergey Shelukhin","fromEmail":"sergey@hortonworks.com","sentAt":"2012-10-26T22:14:50Z","receivedAt":"2012-10-26T22:14:50Z","isPatch":false,"sender":{"key":"sergey@hortonworks.com","avatar":null},"body":"Hi. Any pointers? Is there some bug tracking system to file a bug to?\nThanks.\n\nOn Wed, Oct 24, 2012 at 1:54 PM, Sergey Shelukhin\n<sergey@hortonworks.com> wrote:\n> Hello.\n> I am trying to apply a patch made via {git diff somehash^ somehash >\n> ....} before (same version of Git, same machine). I have no-prefix\n> enabled by default.\n> If I try to apply the patch with -p0, it fails.\n> If I go to a directory where all the changed files are (\"src/\" below)\n> to \"simulate\" the prefix for -p1, it silently does nothing.\n> Only if I make it a -p1 patch, it actually tries to do apply (and\n> applies the new files that cause problems in -p0 alright too, if used\n> with --reject).\n>\n> I am relatively new to git, so while researching I realized I might be\n> using wrong ways to do things (e.g. not using cherry-pick), but this\n> seems like a bug regardless.\n>\n> Here's the log of my interactions with git:\n>\n> reznor-mbp:git-hbase-089 sergey$ git version\n> git version 1.7.10.2 (Apple Git-33)\n> reznor-mbp:git-hbase-089 sergey$ git status\n> # On branch 0.94\n> # Untracked files:\n> #   (use \"git add <file>...\" to include in what will be committed)\n> #\n> #    HBASE-6371.patch\n> nothing added to commit but untracked files present (use \"git add\" to track)\n> reznor-mbp:git-hbase-089 sergey$ git apply -p0 HBASE-6371.patch\n> fatal: git apply: bad git-diff - inconsistent new filename on line 128\n> reznor-mbp:git-hbase-089 sergey$ sed -n 125,129p HBASE-6371.patch\n> diff --git src/main/java/org/apache/\n> hadoop/hbase/regionserver/CompactSelection.java\n> src/main/java/org/apache/hadoop/hbase/regionserver/CompactSelection.java\n> new file mode 100644\n> index 0000000..a9ee0d4\n> --- /dev/null\n> +++ src/main/java/org/apache/hadoop/hbase/regionserver/CompactSelection.java\n> reznor-mbp:git-hbase-089 sergey$ cd src\n> reznor-mbp:src sergey$ git apply -p1 -v --whitespace=nowarn ../HBASE-6371.patch\n> [ there's nothing here, e.g. no output ]\n> reznor-mbp:src sergey$ git status\n> # On branch 0.94\n> # Untracked files:\n> #   (use \"git add <file>...\" to include in what will be committed)\n> #\n> #    ../HBASE-6371.patch\n> nothing added to commit but untracked files present (use \"git add\" to track)\n> reznor-mbp:src sergey$ cd ..\n> reznor-mbp:git-hbase-089 sergey$ sed -E \"s/(--git|---) src/\\1 a\\/src/\"\n> HBASE-6371.patch | sed -E \"s/ src\\// b\\/src\\//\" >\n> HBASE-6371-prefix.patch\n> reznor-mbp:git-hbase-089 sergey$ git apply HBASE-6371-prefix.patch\n> HBASE-6371-prefix.patch:169: trailing whitespace.\n>  ...\n> error: patch failed:\n> src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java:64\n> error: src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java:\n> patch does not apply\n> ....\n"}]}