{"thread":{"id":"18439","subject":"git quiltimport and git apply fail importing the PREEMPT_RT patches","startedAt":"2009-03-20T19:06:17Z","lastAt":"2009-03-20T19:18:03Z","messageCount":2,"participants":["Uwe Kleine-König"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"108746","messageId":"20090320190617.GA28784@pengutronix.de","threadId":"18439","inReplyTo":null,"subject":"git quiltimport and git apply fail importing the PREEMPT_RT patches","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-03-20T19:06:17Z","receivedAt":"2009-03-20T19:06:17Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\n\t~/gsrc/linux-2.6$ git version\n\tgit version 1.5.6.5\n\n(but with newer git I get the same)\n\n\t~/gsrc/linux-2.6$ git checkout v2.6.29-rc8\n\tNote: moving to \"v2.6.29-rc8\" which isn't a local branch\n\tIf you want to create a new branch from this checkout, you may do so\n\t(now or later) by using -b with the checkout command again. Example:\n\t  git checkout -b <new_branch_name>\n\n\t~/gsrc/linux-2.6$ wget -O - http://www.kernel.org/pub/linux/kernel/projects/rt/patch-2.6.29-rc8-rt2-broken-out.tar.bz2 | tar xjf -\n\n\t~/gsrc/linux-2.6$ git quiltimport --author=\"do <nt@kn.ow>\"\n\torigin.patch.bz2\n\tPatch is empty.  Was it split wrong?\n\nhhmmm, quilt seems to support packed patches.\n\nAfter bunzip2 origin.patch.bz2 and editing series accordingly I get:\n\n\t~/gsrc/linux-2.6$ git quiltimport --author=\"do <nt@kn.ow>\"\n\torigin.patch\n\t.dotest/patch:12188: space before tab in indent.\n\t\t\t.platform_data  = &markeins_flash_data,\n\t.dotest/patch:19521: trailing whitespace.\n\t\t\n\t.dotest/patch:20778: trailing whitespace.\n\t\t[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4,\t/* BR_ISSUED */ \n\t.dotest/patch:21259: trailing whitespace.\n\t\t[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4,\t/* BR_ISSUED */ \n\t.dotest/patch:21548: trailing whitespace.\n\t\t[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x410a0,\t/* BR_PRED */ \n\terror: cannot apply binary patch to 'Documentation/logo.gif' without full index line\n\terror: Documentation/logo.gif: patch does not apply\n\nThe hunk for Documentation/logo.gif looks as follows:\n\n\tdiff --git a/Documentation/logo.gif b/Documentation/logo.gif\n\tdeleted file mode 100644\n\tindex 2eae75f..0000000\n\tBinary files a/Documentation/logo.gif and /dev/null differ\n\nFor me this looks complete enough to be applicable:\n\n\t~/gsrc/linux-2.6$ git ls-tree HEAD:Documentation | grep logo.gif\n\t100644 blob 2eae75fecfb965f49065c680063a40c594736ee5\tlogo.gif\n\n(For these who want to look into the 2nd issue, here is an easier\nreproduction recipe:\n\n\t~/gsrc/linux-2.6$ git apply --index -C1 - << EOF\n\t> diff --git a/Documentation/logo.gif b/Documentation/logo.gif\n\t> deleted file mode 100644\n\t> index 2eae75f..0000000\n\t> Binary files a/Documentation/logo.gif and /dev/null differ\n\t> EOF\n\terror: cannot apply binary patch to 'Documentation/logo.gif' without full index line\n\terror: Documentation/logo.gif: patch does not apply\n\n)\n\nFor the first issue I have a patch that I'll send as a reply to this\nmail.  Luckily this works around the second problem, too :-)\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"108748","messageId":"1237576683-5516-1-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"18439","inReplyTo":"20090320190617.GA28784@pengutronix.de","subject":"[PATCH] quiltimport: use quilt to do patch/series parsing and application","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-03-20T19:18:03Z","receivedAt":"2009-03-20T19:18:03Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"quilt supports packed patches that are not recognized by quiltimport.\nInstead of adding this feature explicitly, use quilt to do the dirty\nwork.\n\nSigned-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\nCc: Dan Nicholson <dbn.lists@gmail.com>\nCc: Eric W. Biederman <ebiederm@xmission.com>\nCc: Gerrit Pape <pape@smarden.org>\nCc: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nCc: Junio C Hamano <gitster@pobox.com>\nCc: Pierre Habouzit <madcoder@debian.org>\n---\nHello,\n\nnote I didn't test it deeply, but I succeeded to import the preempt-rt patch.\n\nThings that might be worth testing are:\n\n\tmissing patches referenced in series\n\tpatch conflicts\n\nBest regards\nUwe\n\n git-quiltimport.sh |   51 ++++++++++++++++++++++++---------------------------\n 1 files changed, 24 insertions(+), 27 deletions(-)\n\ndiff --git a/git-quiltimport.sh b/git-quiltimport.sh\nindex 9a6ba2b..8b76682 100755\n--- a/git-quiltimport.sh\n+++ b/git-quiltimport.sh\n@@ -51,6 +51,7 @@ if ! [ -d \"$QUILT_PATCHES\" ] ; then\n \techo \"The \\\"$QUILT_PATCHES\\\" directory does not exist.\"\n \texit 1\n fi\n+export QUILT_PATCHES\n \n # Temporary directories\n tmp_dir=\"$GIT_DIR\"/rebase-apply\n@@ -62,31 +63,23 @@ tmp_info=\"$tmp_dir/info\"\n # Find the intial commit\n commit=$(git rev-parse HEAD)\n \n+# TODO: assert wc == index == HEAD\n+# TODO: assert .pc doesn't exist\n+\n+# detach HEAD\n+git checkout -q \"$commit\"\n+\n mkdir $tmp_dir || exit 2\n-while read patch_name level garbage <&3\n+while quilt unapplied > /dev/null\n do\n-\tcase \"$patch_name\" in ''|'#'*) continue;; esac\n-\tcase \"$level\" in\n-\t-p*)\t;;\n-\t''|'#'*)\n-\t\tlevel=;;\n-\t*)\n-\t\techo \"unable to parse patch level, ignoring it.\"\n-\t\tlevel=;;\n-\tesac\n-\tcase \"$garbage\" in\n-\t''|'#'*);;\n-\t*)\n-\t\techo \"trailing garbage found in series file: $garbage\"\n-\t\texit 1;;\n-\tesac\n-\tif ! [ -f \"$QUILT_PATCHES/$patch_name\" ] ; then\n-\t\techo \"$patch_name doesn't exist. Skipping.\"\n-\t\tcontinue\n-\tfi\n+\t# apply patch\n+\tquilt push || exit 3\n+\n+\tpatch_name=\"$(quilt top)\";\n+\n \techo $patch_name\n-\tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n-\t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n+\t(quilt header; echo \"---\") | git mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n+\t\t>\"$tmp_info\" || exit 3\n \ttest -s \"$tmp_patch\" || {\n \t\techo \"Patch is empty.  Was it split wrong?\"\n \t\texit 1\n@@ -129,10 +122,14 @@ do\n \tfi\n \n \tif [ -z \"$dry_run\" ] ; then\n-\t\tgit apply --index -C1 ${level:+\"$level\"} \"$tmp_patch\" &&\n-\t\ttree=$(git write-tree) &&\n-\t\tcommit=$( (echo \"$SUBJECT\"; echo; cat \"$tmp_msg\") | git commit-tree $tree -p $commit) &&\n-\t\tgit update-ref -m \"quiltimport: $patch_name\" HEAD $commit || exit 4\n+\t\tquilt files | git update-index --add --remove --stdin &&\n+\t\t(echo \"$SUBJECT\"; echo; cat \"$tmp_msg\") | git commit -F - ||\n+\t\texit 4\n \tfi\n-done 3<\"$QUILT_PATCHES/series\"\n+done\n+\n+if [ -n \"$dry_run\" ] ; then\n+\tquilt pop -a;\n+fi\n+\n rm -rf $tmp_dir || exit 5\n-- \n1.6.2\n"}]}