{"thread":{"id":"8228","subject":"[PATCH] git-applymbox: Remove command","startedAt":"2007-05-20T00:10:13Z","lastAt":"2007-05-25T02:33:09Z","messageCount":3,"participants":["Petr Baudis","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"42660","messageId":"20070520001012.5051.38142.stgit@rover","threadId":"8228","inReplyTo":null,"subject":"[PATCH] git-applymbox: Remove command","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2007-05-20T00:10:13Z","receivedAt":"2007-05-20T00:10:13Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"I believe noone uses git-applymbox, and noone definitely should, since it\nis supposed to be completely superseded and everything by its younger\ncousin git-am. The only known person in the universe to use it was Linus\nand he declared some time ago that he will try to use git-am instead in his\nfamous dotest script.\n\nThe trouble is that git-applymbox existence creates confusing UI. I'm a bit\nlike a recycled newbie to the git porcelain and *I* was confused by\ngit-applymbox primitiveness until I've realized a while later that I'm of\ncourse using the wrong command.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n\n(Admittelly this patch is a bit brave and maybe we should make applymbox\nprint some scary messages first for some time. I'm testing the water here\nto see if anyone complains. I still think that noone really uses it,\nthough.)\n---\n\n .gitignore                      |    1 \n Documentation/cmd-list.perl     |    1 \n Documentation/git-am.txt        |    5 +-\n Documentation/git-applymbox.txt |   98 --------------------------------\n Documentation/hooks.txt         |    6 +-\n Makefile                        |    2 -\n git-applymbox.sh                |  121 ---------------------------------------\n 7 files changed, 6 insertions(+), 228 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex d0b67da..16f4aba 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -7,7 +7,6 @@ git-add--interactive\n git-am\n git-annotate\n git-apply\n-git-applymbox\n git-applypatch\n git-archimport\n git-archive\ndiff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl\nindex 443802a..0bca346 100755\n--- a/Documentation/cmd-list.perl\n+++ b/Documentation/cmd-list.perl\n@@ -72,7 +72,6 @@ __DATA__\n git-add                                 mainporcelain\n git-am                                  mainporcelain\n git-annotate                            ancillaryinterrogators\n-git-applymbox                           ancillaryinterrogators\n git-applypatch                          purehelpers\n git-apply                               plumbingmanipulators\n git-archimport                          foreignscminterface\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex ba79773..bf07e43 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -126,8 +126,7 @@ is terminated before the first occurrence of such a line.\n \n When initially invoking it, you give it names of the mailboxes\n to crunch.  Upon seeing the first patch that does not apply, it\n-aborts in the middle, just like 'git-applymbox' does.  You can\n-recover from this in one of two ways:\n+aborts in the middle,.  You can recover from this in one of two ways:\n \n . skip the current patch by re-running the command with '--skip'\n   option.\n@@ -144,7 +143,7 @@ names.\n \n SEE ALSO\n --------\n-gitlink:git-applymbox[1], gitlink:git-applypatch[1], gitlink:git-apply[1].\n+gitlink:git-applypatch[1], gitlink:git-apply[1].\n \n \n Author\ndiff --git a/Documentation/git-applymbox.txt b/Documentation/git-applymbox.txt\ndeleted file mode 100644\nindex ea919ba..0000000\n--- a/Documentation/git-applymbox.txt\n+++ /dev/null\n@@ -1,98 +0,0 @@\n-git-applymbox(1)\n-================\n-\n-NAME\n-----\n-git-applymbox - Apply a series of patches in a mailbox\n-\n-\n-SYNOPSIS\n---------\n-'git-applymbox' [-u] [-k] [-q] [-m] ( -c .dotest/<num> | <mbox> ) [ <signoff> ]\n-\n-DESCRIPTION\n------------\n-Splits mail messages in a mailbox into commit log message,\n-authorship information and patches, and applies them to the\n-current branch.\n-\n-\n-OPTIONS\n--------\n--q::\n-\tApply patches interactively.  The user will be given\n-\topportunity to edit the log message and the patch before\n-\tattempting to apply it.\n-\n--k::\n-\tUsually the program 'cleans up' the Subject: header line\n-\tto extract the title line for the commit log message,\n-\tamong which (1) remove 'Re:' or 're:', (2) leading\n-\twhitespaces, (3) '[' up to ']', typically '[PATCH]', and\n-\tthen prepends \"[PATCH] \".  This flag forbids this\n-\tmunging, and is most useful when used to read back 'git\n-\tformat-patch -k' output.\n-\n--m::\n-\tPatches are applied with `git-apply` command, and unless\n-\tit cleanly applies without fuzz, the processing fails.\n-\tWith this flag, if a tree that the patch applies cleanly\n-\tis found in a repository, the patch is applied to the\n-\ttree and then a 3-way merge between the resulting tree\n-\tand the current tree.\n-\n--u::\n-\tPass `-u` flag to `git-mailinfo` (see gitlink:git-mailinfo[1]).\n-\tThe proposed commit log message taken from the e-mail\n-\tare re-coded into UTF-8 encoding (configuration variable\n-\t`i18n.commitencoding` can be used to specify project's\n-\tpreferred encoding if it is not UTF-8).  This used to be\n-\toptional but now it is the default.\n-+\n-Note that the patch is always used as-is without charset\n-conversion, even with this flag.\n-\n--n::\n-\tPass `-n` flag to `git-mailinfo` (see\n-\tgitlink:git-mailinfo[1]).\n-\n--c .dotest/<num>::\n-\tWhen the patch contained in an e-mail does not cleanly\n-\tapply, the command exits with an error message. The\n-\tpatch and extracted message are found in .dotest/, and\n-\tyou could re-run 'git applymbox' with '-c .dotest/<num>'\n-\tflag to restart the process after inspecting and fixing\n-\tthem.\n-\n-<mbox>::\n-\tThe name of the file that contains the e-mail messages\n-\twith patches.  This file should be in the UNIX mailbox\n-\tformat.  See 'SubmittingPatches' document to learn about\n-\tthe formatting convention for e-mail submission.\n-\n-<signoff>::\n-\tThe name of the file that contains your \"Signed-off-by\"\n-\tline.  See 'SubmittingPatches' document to learn what\n-\t\"Signed-off-by\" line means.  You can also just say\n-\t'yes', 'true', 'me', or 'please' to use an automatically\n-\tgenerated \"Signed-off-by\" line based on your committer\n-\tidentity.\n-\n-\n-SEE ALSO\n---------\n-gitlink:git-am[1], gitlink:git-applypatch[1].\n-\n-\n-Author\n-------\n-Written by Linus Torvalds <torvalds@osdl.org>\n-\n-Documentation\n---------------\n-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.\n-\n-GIT\n----\n-Part of the gitlink:git[7] suite\n-\ndiff --git a/Documentation/hooks.txt b/Documentation/hooks.txt\nindex aabb975..aad1744 100644\n--- a/Documentation/hooks.txt\n+++ b/Documentation/hooks.txt\n@@ -13,7 +13,7 @@ applypatch-msg\n --------------\n \n This hook is invoked by `git-applypatch` script, which is\n-typically invoked by `git-applymbox`.  It takes a single\n+typically invoked by `git-am`.  It takes a single\n parameter, the name of the file that holds the proposed commit\n log message.  Exiting with non-zero status causes\n `git-applypatch` to abort before applying the patch.\n@@ -30,7 +30,7 @@ pre-applypatch\n --------------\n \n This hook is invoked by `git-applypatch` script, which is\n-typically invoked by `git-applymbox`.  It takes no parameter,\n+typically invoked by `git-am`.  It takes no parameter,\n and is invoked after the patch is applied, but before a commit\n is made.  Exiting with non-zero status causes the working tree\n after application of the patch not committed.\n@@ -45,7 +45,7 @@ post-applypatch\n ---------------\n \n This hook is invoked by `git-applypatch` script, which is\n-typically invoked by `git-applymbox`.  It takes no parameter,\n+typically invoked by `git-am`.  It takes no parameter,\n and is invoked after the patch is applied and a commit is made.\n \n This hook is meant primarily for notification, and cannot affect\ndiff --git a/Makefile b/Makefile\nindex de74851..77d3ad0 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -208,7 +208,7 @@ SCRIPT_SH = \\\n \tgit-repack.sh git-request-pull.sh git-reset.sh \\\n \tgit-sh-setup.sh \\\n \tgit-tag.sh git-verify-tag.sh \\\n-\tgit-applymbox.sh git-applypatch.sh git-am.sh \\\n+\tgit-applypatch.sh git-am.sh \\\n \tgit-merge.sh git-merge-stupid.sh git-merge-octopus.sh \\\n \tgit-merge-resolve.sh git-merge-ours.sh \\\n \tgit-lost-found.sh git-quiltimport.sh\ndiff --git a/git-applymbox.sh b/git-applymbox.sh\ndeleted file mode 100755\nindex c18e80f..0000000\n--- a/git-applymbox.sh\n+++ /dev/null\n@@ -1,121 +0,0 @@\n-#!/bin/sh\n-##\n-## \"dotest\" is my stupid name for my patch-application script, which\n-## I never got around to renaming after I tested it. We're now on the\n-## second generation of scripts, still called \"dotest\".\n-##\n-## Update: Ryan Anderson finally shamed me into naming this \"applymbox\".\n-##\n-## You give it a mbox-format collection of emails, and it will try to\n-## apply them to the kernel using \"applypatch\"\n-##\n-## The patch application may fail in the middle.  In which case:\n-## (1) look at .dotest/patch and fix it up to apply\n-## (2) re-run applymbox with -c .dotest/msg-number for the current one.\n-## Pay a special attention to the commit log message if you do this and\n-## use a Signoff_file, because applypatch wants to append the sign-off\n-## message to msg-clean every time it is run.\n-##\n-## git-am is supposed to be the newer and better tool for this job.\n-\n-USAGE='[-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]'\n-. git-sh-setup\n-\n-git var GIT_COMMITTER_IDENT >/dev/null || exit\n-\n-keep_subject= query_apply= continue= utf8=-u resume=t\n-while case \"$#\" in 0) break ;; esac\n-do\n-\tcase \"$1\" in\n-\t-u)\tutf8=-u ;;\n-\t-n)\tutf8=-n ;;\n-\t-k)\tkeep_subject=-k ;;\n-\t-q)\tquery_apply=t ;;\n-\t-c)\tcontinue=\"$2\"; resume=f; shift ;;\n-\t-m)\tfall_back_3way=t ;;\n-\t-*)\tusage ;;\n-\t*)\tbreak ;;\n-\tesac\n-\tshift\n-done\n-\n-case \"$continue\" in\n-'')\n-\trm -rf .dotest\n-\tmkdir .dotest\n-\tnum_msgs=$(git-mailsplit \"$1\" .dotest) || exit 1\n-\techo \"$num_msgs patch(es) to process.\"\n-\tshift\n-esac\n-\n-files=$(git-diff-index --cached --name-only HEAD) || exit\n-if [ \"$files\" ]; then\n-   echo \"Dirty index: cannot apply patches (dirty: $files)\" >&2\n-   exit 1\n-fi\n-\n-case \"$query_apply\" in\n-t)\ttouch .dotest/.query_apply\n-esac\n-case \"$fall_back_3way\" in\n-t)\t: >.dotest/.3way\n-esac\n-case \"$keep_subject\" in\n--k)\t: >.dotest/.keep_subject\n-esac\n-\n-signoff=\"$1\"\n-set x .dotest/0*\n-shift\n-while case \"$#\" in 0) break;; esac\n-do\n-    i=\"$1\" \n-    case \"$resume,$continue\" in\n-    f,$i)\tresume=t;;\n-    f,*)\tshift\n-\t\tcontinue;;\n-    *)\n-\t    git-mailinfo $keep_subject $utf8 \\\n-\t\t.dotest/msg .dotest/patch <$i >.dotest/info || exit 1\n-\t    test -s .dotest/patch || {\n-\t\techo \"Patch is empty.  Was it split wrong?\"\n-\t\texit 1\n-\t    }\n-\t    git-stripspace < .dotest/msg > .dotest/msg-clean\n-\t    ;;\n-    esac\n-    while :; # for fixing up and retry\n-    do\n-\tgit-applypatch .dotest/msg-clean .dotest/patch .dotest/info \"$signoff\"\n-\tcase \"$?\" in\n-\t0)\n-\t\t# Remove the cleanly applied one to reduce clutter.\n-\t\trm -f .dotest/$i\n-\t\t;;\n-\t2)\n-\t\t# 2 is a special exit code from applypatch to indicate that\n-\t    \t# the patch wasn't applied, but continue anyway \n-\t\t;;\n-\t*)\n-\t\tret=$?\n-\t\tif test -f .dotest/.query_apply\n-\t\tthen\n-\t\t\techo >&2 \"* Patch failed.\"\n-\t\t\techo >&2 \"* You could fix it up in your editor and\"\n-\t\t\techo >&2 \"  retry.  If you want to do so, say yes here\"\n-\t\t\techo >&2 \"  AFTER fixing .dotest/patch up.\"\n-\t\t\techo >&2 -n \"Retry [y/N]? \"\n-\t\t\tread yesno\n-\t\t\tcase \"$yesno\" in\n-\t\t\t[Yy]*)\n-\t\t\t\tcontinue ;;\n-\t\t        esac\n-\t\tfi\n-\t\texit $ret\n-\tesac\n-\tbreak\n-    done\n-    shift\n-done\n-# return to pristine\n-rm -fr .dotest\n"},{"id":"43057","messageId":"7vejl719vf.fsf@assigned-by-dhcp.cox.net","threadId":"8228","inReplyTo":"20070520001012.5051.38142.stgit@rover","subject":"Re: [PATCH] git-applymbox: Remove command","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-23T21:57:24Z","receivedAt":"2007-05-23T21:57:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> I believe noone uses git-applymbox, and noone definitely should, since it\n> is supposed to be completely superseded and everything by its younger\n> cousin git-am. The only known person in the universe to use it was Linus\n> and he declared some time ago that he will try to use git-am instead in his\n> famous dotest script.\n>\n> The trouble is that git-applymbox existence creates confusing UI. I'm a bit\n> like a recycled newbie to the git porcelain and *I* was confused by\n> git-applymbox primitiveness until I've realized a while later that I'm of\n> course using the wrong command.\n>\n> Signed-off-by: Petr Baudis <pasky@suse.cz>\n>\n> ---\n>\n> (Admittelly this patch is a bit brave and maybe we should make applymbox\n> print some scary messages first for some time. I'm testing the water here\n> to see if anyone complains. I still think that noone really uses it,\n> though.)\n\nBrave.\n\nI suspect nobody really uses it, too.\n"},{"id":"43211","messageId":"7vr6p5tyxm.fsf_-_@assigned-by-dhcp.cox.net","threadId":"8228","inReplyTo":"7vejl719vf.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Remove git-applypatch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-25T02:33:09Z","receivedAt":"2007-05-25T02:33:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The previous one removed git-applymbox, which was the sole user\nof this tool.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n .gitignore                       |    1 -\n Documentation/SubmittingPatches  |    4 +-\n Documentation/cmd-list.perl      |    1 -\n Documentation/git-am.txt         |    2 +-\n Documentation/git-applypatch.txt |   53 ----------\n Documentation/git-mailinfo.txt   |    2 +-\n Documentation/hooks.txt          |   13 +--\n Makefile                         |    2 +-\n git-applypatch.sh                |  212 --------------------------------------\n 9 files changed, 10 insertions(+), 280 deletions(-)\n delete mode 100644 Documentation/git-applypatch.txt\n delete mode 100755 git-applypatch.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 76c0e1b..b4e72f5 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -7,7 +7,6 @@ git-add--interactive\n git-am\n git-annotate\n git-apply\n-git-applypatch\n git-archimport\n git-archive\n git-bisect\ndiff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches\nindex b94d9a8..b5f2ecd 100644\n--- a/Documentation/SubmittingPatches\n+++ b/Documentation/SubmittingPatches\n@@ -239,7 +239,7 @@ One test you could do yourself if your MUA is set up correctly is:\n     $ git fetch http://kernel.org/pub/scm/git/git.git master:test-apply\n     $ git checkout test-apply\n     $ git reset --hard\n-    $ git applymbox a.patch\n+    $ git am a.patch\n \n If it does not apply correctly, there can be various reasons.\n \n@@ -247,7 +247,7 @@ If it does not apply correctly, there can be various reasons.\n   does not have much to do with your MUA.  Please rebase the\n   patch appropriately.\n \n-* Your MUA corrupted your patch; applymbox would complain that\n+* Your MUA corrupted your patch; \"am\" would complain that\n   the patch does not apply.  Look at .dotest/ subdirectory and\n   see what 'patch' file contains and check for the common\n   corruption patterns mentioned above.\ndiff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl\nindex 0bca346..645e437 100755\n--- a/Documentation/cmd-list.perl\n+++ b/Documentation/cmd-list.perl\n@@ -72,7 +72,6 @@ __DATA__\n git-add                                 mainporcelain\n git-am                                  mainporcelain\n git-annotate                            ancillaryinterrogators\n-git-applypatch                          purehelpers\n git-apply                               plumbingmanipulators\n git-archimport                          foreignscminterface\n git-archive                             mainporcelain\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 049e46f..7658fbd 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -145,7 +145,7 @@ names.\n \n SEE ALSO\n --------\n-gitlink:git-applypatch[1], gitlink:git-apply[1].\n+gitlink:git-apply[1].\n \n \n Author\ndiff --git a/Documentation/git-applypatch.txt b/Documentation/git-applypatch.txt\ndeleted file mode 100644\nindex 451434a..0000000\n--- a/Documentation/git-applypatch.txt\n+++ /dev/null\n@@ -1,53 +0,0 @@\n-git-applypatch(1)\n-=================\n-\n-NAME\n-----\n-git-applypatch - Apply one patch extracted from an e-mail\n-\n-\n-SYNOPSIS\n---------\n-'git-applypatch' <msg> <patch> <info> [<signoff>]\n-\n-DESCRIPTION\n------------\n-This is usually not what an end user wants to run directly.  See\n-gitlink:git-am[1] instead.\n-\n-Takes three files <msg>, <patch>, and <info> prepared from an\n-e-mail message by 'git-mailinfo', and creates a commit.  It is\n-usually not necessary to use this command directly.\n-\n-This command can run `applypatch-msg`, `pre-applypatch`, and\n-`post-applypatch` hooks.  See link:hooks.html[hooks] for more\n-information.\n-\n-\n-OPTIONS\n--------\n-<msg>::\n-\tCommit log message (sans the first line, which comes\n-\tfrom e-mail Subject stored in <info>).\n-\n-<patch>::\n-\tThe patch to apply.\n-\n-<info>::\n-\tAuthor and subject information extracted from e-mail,\n-\tused on \"author\" line and as the first line of the\n-\tcommit log message.\n-\n-\n-Author\n-------\n-Written by Linus Torvalds <torvalds@osdl.org>\n-\n-Documentation\n---------------\n-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.\n-\n-GIT\n----\n-Part of the gitlink:git[7] suite\n-\ndiff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt\nindex 8eadceb..1695695 100644\n--- a/Documentation/git-mailinfo.txt\n+++ b/Documentation/git-mailinfo.txt\n@@ -16,7 +16,7 @@ DESCRIPTION\n Reading a single e-mail message from the standard input, and\n writes the commit log message in <msg> file, and the patches in\n <patch> file.  The author name, e-mail and e-mail subject are\n-written out to the standard output to be used by git-applypatch\n+written out to the standard output to be used by git-am\n to create a commit.  It is usually not necessary to use this\n command directly.  See gitlink:git-am[1] instead.\n \ndiff --git a/Documentation/hooks.txt b/Documentation/hooks.txt\nindex aad1744..6836477 100644\n--- a/Documentation/hooks.txt\n+++ b/Documentation/hooks.txt\n@@ -12,11 +12,10 @@ This document describes the currently defined hooks.\n applypatch-msg\n --------------\n \n-This hook is invoked by `git-applypatch` script, which is\n-typically invoked by `git-am`.  It takes a single\n+This hook is invoked by `git-am` script.  It takes a single\n parameter, the name of the file that holds the proposed commit\n log message.  Exiting with non-zero status causes\n-`git-applypatch` to abort before applying the patch.\n+`git-am` to abort before applying the patch.\n \n The hook is allowed to edit the message file in place, and can\n be used to normalize the message into some project standard\n@@ -29,8 +28,7 @@ The default 'applypatch-msg' hook, when enabled, runs the\n pre-applypatch\n --------------\n \n-This hook is invoked by `git-applypatch` script, which is\n-typically invoked by `git-am`.  It takes no parameter,\n+This hook is invoked by `git-am`.  It takes no parameter,\n and is invoked after the patch is applied, but before a commit\n is made.  Exiting with non-zero status causes the working tree\n after application of the patch not committed.\n@@ -44,12 +42,11 @@ The default 'pre-applypatch' hook, when enabled, runs the\n post-applypatch\n ---------------\n \n-This hook is invoked by `git-applypatch` script, which is\n-typically invoked by `git-am`.  It takes no parameter,\n+This hook is invoked by `git-am`.  It takes no parameter,\n and is invoked after the patch is applied and a commit is made.\n \n This hook is meant primarily for notification, and cannot affect\n-the outcome of `git-applypatch`.\n+the outcome of `git-am`.\n \n pre-commit\n ----------\ndiff --git a/Makefile b/Makefile\nindex 870179b..4e63a69 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -206,7 +206,7 @@ SCRIPT_SH = \\\n \tgit-repack.sh git-request-pull.sh git-reset.sh \\\n \tgit-sh-setup.sh \\\n \tgit-tag.sh git-verify-tag.sh \\\n-\tgit-applypatch.sh git-am.sh \\\n+\tgit-am.sh \\\n \tgit-merge.sh git-merge-stupid.sh git-merge-octopus.sh \\\n \tgit-merge-resolve.sh git-merge-ours.sh \\\n \tgit-lost-found.sh git-quiltimport.sh\ndiff --git a/git-applypatch.sh b/git-applypatch.sh\ndeleted file mode 100755\nindex 8df2aee..0000000\n--- a/git-applypatch.sh\n+++ /dev/null\n@@ -1,212 +0,0 @@\n-#!/bin/sh\n-##\n-## applypatch takes four file arguments, and uses those to\n-## apply the unpacked patch (surprise surprise) that they\n-## represent to the current tree.\n-##\n-## The arguments are:\n-##\t$1 - file with commit message\n-##\t$2 - file with the actual patch\n-##\t$3 - \"info\" file with Author, email and subject\n-##\t$4 - optional file containing signoff to add\n-##\n-\n-USAGE='<msg> <patch> <info> [<signoff>]'\n-. git-sh-setup\n-\n-case \"$#\" in 3|4) ;; *) usage ;; esac\n-\n-final=.dotest/final-commit\n-##\n-## If this file exists, we ask before applying\n-##\n-query_apply=.dotest/.query_apply\n-\n-## We do not munge the first line of the commit message too much\n-## if this file exists.\n-keep_subject=.dotest/.keep_subject\n-\n-## We do not attempt the 3-way merge fallback unless this file exists.\n-fall_back_3way=.dotest/.3way\n-\n-MSGFILE=$1\n-PATCHFILE=$2\n-INFO=$3\n-SIGNOFF=$4\n-EDIT=${VISUAL:-${EDITOR:-vi}}\n-\n-export GIT_AUTHOR_NAME=\"$(sed -n '/^Author/ s/Author: //p' \"$INFO\")\"\n-export GIT_AUTHOR_EMAIL=\"$(sed -n '/^Email/ s/Email: //p' \"$INFO\")\"\n-export GIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$INFO\")\"\n-export SUBJECT=\"$(sed -n '/^Subject/ s/Subject: //p' \"$INFO\")\"\n-\n-if test '' != \"$SIGNOFF\"\n-then\n-\tif test -f \"$SIGNOFF\"\n-\tthen\n-\t\tSIGNOFF=`cat \"$SIGNOFF\"` || exit\n-\telif case \"$SIGNOFF\" in yes | true | me | please) : ;; *) false ;; esac\n-\tthen\n-\t\tSIGNOFF=`git-var GIT_COMMITTER_IDENT | sed -e '\n-\t\t\t\ts/>.*/>/\n-\t\t\t\ts/^/Signed-off-by: /'\n-\t\t`\n-\telse\n-\t\tSIGNOFF=\n-\tfi\n-\tif test '' != \"$SIGNOFF\"\n-\tthen\n-\t\tLAST_SIGNED_OFF_BY=`\n-\t\t\tsed -ne '/^Signed-off-by: /p' \"$MSGFILE\" |\n-\t\t\ttail -n 1\n-\t\t`\n-\t\ttest \"$LAST_SIGNED_OFF_BY\" = \"$SIGNOFF\" || {\n-\t\t    test '' = \"$LAST_SIGNED_OFF_BY\" && echo\n-\t\t    echo \"$SIGNOFF\"\n-\t\t} >>\"$MSGFILE\"\n-\tfi\n-fi\n-\n-patch_header=\n-test -f \"$keep_subject\" || patch_header='[PATCH] '\n-\n-{\n-\techo \"$patch_header$SUBJECT\"\n-\tif test -s \"$MSGFILE\"\n-\tthen\n-\t\techo\n-\t\tcat \"$MSGFILE\"\n-\tfi\n-} >\"$final\"\n-\n-interactive=yes\n-test -f \"$query_apply\" || interactive=no\n-\n-while [ \"$interactive\" = yes ]; do\n-\techo \"Commit Body is:\"\n-\techo \"--------------------------\"\n-\tcat \"$final\"\n-\techo \"--------------------------\"\n-\tprintf \"Apply? [y]es/[n]o/[e]dit/[a]ccept all \"\n-\tread reply\n-\tcase \"$reply\" in\n-\t\ty|Y) interactive=no;;\n-\t\tn|N) exit 2;;\t# special value to tell dotest to keep going\n-\t\te|E) \"$EDIT\" \"$final\";;\n-\t\ta|A) rm -f \"$query_apply\"\n-\t\t     interactive=no ;;\n-\tesac\n-done\n-\n-if test -x \"$GIT_DIR\"/hooks/applypatch-msg\n-then\n-\t\"$GIT_DIR\"/hooks/applypatch-msg \"$final\" || exit\n-fi\n-\n-echo\n-echo Applying \"'$SUBJECT'\"\n-echo\n-\n-git-apply --index \"$PATCHFILE\" || {\n-\n-\t# git-apply exits with status 1 when the patch does not apply,\n-\t# but it die()s with other failures, most notably upon corrupt\n-\t# patch.  In the latter case, there is no point to try applying\n-\t# it to another tree and do 3-way merge.\n-\ttest $? = 1 || exit 1\n-\n-\ttest -f \"$fall_back_3way\" || exit 1\n-\n-\t# Here if we know which revision the patch applies to,\n-\t# we create a temporary working tree and index, apply the\n-\t# patch, and attempt 3-way merge with the resulting tree.\n-\n-\tO_OBJECT=`cd \"$GIT_OBJECT_DIRECTORY\" && pwd`\n-\trm -fr .patch-merge-*\n-\n-\tif git-apply -z --index-info \"$PATCHFILE\" \\\n-\t\t>.patch-merge-index-info 2>/dev/null &&\n-\t\tGIT_INDEX_FILE=.patch-merge-tmp-index \\\n-\t\tgit-update-index -z --index-info <.patch-merge-index-info &&\n-\t\tGIT_INDEX_FILE=.patch-merge-tmp-index \\\n-\t\tgit-write-tree >.patch-merge-tmp-base &&\n-\t\t(\n-\t\t\tmkdir .patch-merge-tmp-dir &&\n-\t\t\tcd .patch-merge-tmp-dir &&\n-\t\t\tGIT_INDEX_FILE=\"../.patch-merge-tmp-index\" \\\n-\t\t\tGIT_OBJECT_DIRECTORY=\"$O_OBJECT\" \\\n-\t\t\tgit-apply $binary --index\n-\t\t) <\"$PATCHFILE\"\n-\tthen\n-\t\techo Using index info to reconstruct a base tree...\n-\t\tmv .patch-merge-tmp-base .patch-merge-base\n-\t\tmv .patch-merge-tmp-index .patch-merge-index\n-\telse\n-\t(\n-\t\tN=10\n-\n-\t\t# Otherwise, try nearby trees that can be used to apply the\n-\t\t# patch.\n-\t\tgit-rev-list --max-count=$N HEAD\n-\n-\t\t# or hoping the patch is against known tags...\n-\t\tgit-ls-remote --tags .\n-\t) |\n-\t    while read base junk\n-\t    do\n-\t\t# Try it if we have it as a tree.\n-\t\tgit-cat-file tree \"$base\" >/dev/null 2>&1 || continue\n-\n-\t\trm -fr .patch-merge-tmp-* &&\n-\t\tmkdir .patch-merge-tmp-dir || break\n-\t\t(\n-\t\t\tcd .patch-merge-tmp-dir &&\n-\t\t\tGIT_INDEX_FILE=../.patch-merge-tmp-index &&\n-\t\t\tGIT_OBJECT_DIRECTORY=\"$O_OBJECT\" &&\n-\t\t\texport GIT_INDEX_FILE GIT_OBJECT_DIRECTORY &&\n-\t\t\tgit-read-tree \"$base\" &&\n-\t\t\tgit-apply --index &&\n-\t\t\tmv ../.patch-merge-tmp-index ../.patch-merge-index &&\n-\t\t\techo \"$base\" >../.patch-merge-base\n-\t\t) <\"$PATCHFILE\"  2>/dev/null && break\n-\t    done\n-\tfi\n-\n-\ttest -f .patch-merge-index &&\n-\this_tree=$(GIT_INDEX_FILE=.patch-merge-index git-write-tree) &&\n-\torig_tree=$(cat .patch-merge-base) &&\n-\trm -fr .patch-merge-* || exit 1\n-\n-\techo Falling back to patching base and 3-way merge using $orig_tree...\n-\n-\t# This is not so wrong.  Depending on which base we picked,\n-\t# orig_tree may be wildly different from ours, but his_tree\n-\t# has the same set of wildly different changes in parts the\n-\t# patch did not touch, so resolve ends up canceling them,\n-\t# saying that we reverted all those changes.\n-\n-\tif git-merge-resolve $orig_tree -- HEAD $his_tree\n-\tthen\n-\t\techo Done.\n-\telse\n-\t\techo Failed to merge in the changes.\n-\t\texit 1\n-\tfi\n-}\n-\n-if test -x \"$GIT_DIR\"/hooks/pre-applypatch\n-then\n-\t\"$GIT_DIR\"/hooks/pre-applypatch || exit\n-fi\n-\n-tree=$(git-write-tree) || exit 1\n-echo Wrote tree $tree\n-parent=$(git-rev-parse --verify HEAD) &&\n-commit=$(git-commit-tree $tree -p $parent <\"$final\") || exit 1\n-echo Committed: $commit\n-git-update-ref -m \"applypatch: $SUBJECT\" HEAD $commit $parent || exit\n-\n-if test -x \"$GIT_DIR\"/hooks/post-applypatch\n-then\n-\t\"$GIT_DIR\"/hooks/post-applypatch\n-fi\n-- \n1.5.2.70.g17b3ac\n"}]}