{"thread":{"id":"12486","subject":"[PATCH 1/3] am: read from the right mailbox when started from a subdirectory","startedAt":"2008-03-04T08:25:04Z","lastAt":"2008-03-04T08:57:45Z","messageCount":4,"participants":["Junio C Hamano","Jay Soffian"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"70904","messageId":"1204619106-30449-1-git-send-email-gitster@pobox.com","threadId":"12486","inReplyTo":null,"subject":"[PATCH 1/3] am: read from the right mailbox when started from a subdirectory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-04T08:25:04Z","receivedAt":"2008-03-04T08:25:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"An earlier commit c149184 (allow git-am to run in a subdirectory) taught\ngit-am to start from a subdirectory by going up to the root of the work\ntree byitself, but it did not adjust the path to read the mbox from when\nit did so.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This is a fixed-up version of an earlier patch I sent to Jeff and the\n   list, and should be considered as a bugfix.\n\n git-am.sh            |   25 ++++++++++++++++-\n t/t4150-am-subdir.sh |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 95 insertions(+), 2 deletions(-)\n create mode 100755 t/t4150-am-subdir.sh\n\ndiff --git a/git-am.sh b/git-am.sh\nindex a2c6fea..2b5bbb7 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -24,6 +24,7 @@ r,resolved      to be used after a patch failure\n skip            skip the current patch\"\n \n . git-sh-setup\n+prefix=$(git rev-parse --show-prefix)\n set_reflog_action am\n require_work_tree\n cd_to_toplevel\n@@ -124,7 +125,8 @@ reread_subject () {\n }\n \n prec=4\n-dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary=\n+dotest=\"${prefix}.dotest\"\n+sign= utf8=t keep= skip= interactive= resolved= binary=\n resolvemsg= resume=\n git_apply_opt=\n \n@@ -150,7 +152,8 @@ do\n \t--skip)\n \t\tskip=t ;;\n \t-d|--dotest)\n-\t\tshift; dotest=$1;;\n+\t\tshift\n+\t\tcase \"$1\" in /*) dotest=$1;; *) dotest=\"$prefix$1\" ;; esac ;;\n \t--resolvemsg)\n \t\tshift; resolvemsg=$1 ;;\n \t--whitespace)\n@@ -206,6 +209,24 @@ else\n \t# Start afresh.\n \tmkdir -p \"$dotest\" || exit\n \n+\tif test -n \"$prefix\" && test $# != 0\n+\tthen\n+\t\tfirst=t\n+\t\tfor arg\n+\t\tdo\n+\t\t\ttest -n \"$first\" && {\n+\t\t\t\tset x\n+\t\t\t\tfirst=\n+\t\t\t}\n+\t\t\tcase \"$arg\" in\n+\t\t\t/*)\n+\t\t\t\tset \"$@\" \"$arg\" ;;\n+\t\t\t*)\n+\t\t\t\tset \"$@\" \"$prefix$arg\" ;;\n+\t\t\tesac\n+\t\tdone\n+\t\tshift\n+\tfi\n \tgit mailsplit -d\"$prec\" -o\"$dotest\" -b -- \"$@\" > \"$dotest/last\" ||  {\n \t\trm -fr \"$dotest\"\n \t\texit 1\ndiff --git a/t/t4150-am-subdir.sh b/t/t4150-am-subdir.sh\nnew file mode 100755\nindex 0000000..929d2cb\n--- /dev/null\n+++ b/t/t4150-am-subdir.sh\n@@ -0,0 +1,72 @@\n+#!/bin/sh\n+\n+test_description='git am running from a subdirectory'\n+\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\techo hello >world &&\n+\tgit add world &&\n+\ttest_tick &&\n+\tgit commit -m initial &&\n+\tgit tag initial &&\n+\techo goodbye >world &&\n+\tgit add world &&\n+\ttest_tick &&\n+\tgit commit -m second &&\n+\tgit format-patch --stdout HEAD^ >patchfile &&\n+\t: >expect\n+'\n+\n+test_expect_success 'am regularly from stdin' '\n+\tgit checkout initial &&\n+\tgit am <patchfile &&\n+\tgit diff master >actual &&\n+\tdiff -u expect actual\n+'\n+\n+test_expect_success 'am regularly from file' '\n+\tgit checkout initial &&\n+\tgit am patchfile &&\n+\tgit diff master >actual &&\n+\tdiff -u expect actual\n+'\n+\n+test_expect_success 'am regularly from stdin in subdirectory' '\n+\trm -fr subdir &&\n+\tgit checkout initial &&\n+\t(\n+\t\tmkdir -p subdir &&\n+\t\tcd subdir &&\n+\t\tgit am <../patchfile\n+\t) &&\n+\tgit diff master>actual &&\n+\tdiff -u expect actual\n+'\n+\n+test_expect_success 'am regularly from file in subdirectory' '\n+\trm -fr subdir &&\n+\tgit checkout initial &&\n+\t(\n+\t\tmkdir -p subdir &&\n+\t\tcd subdir &&\n+\t\tgit am ../patchfile\n+\t) &&\n+\tgit diff master >actual &&\n+\tdiff -u expect actual\n+'\n+\n+test_expect_success 'am regularly from file in subdirectory with full path' '\n+\trm -fr subdir &&\n+\tgit checkout initial &&\n+\tP=$(pwd) &&\n+\t(\n+\t\tmkdir -p subdir &&\n+\t\tcd subdir &&\n+\t\tgit am \"$P/patchfile\"\n+\t) &&\n+\tgit diff master >actual &&\n+\tdiff -u expect actual\n+'\n+\n+test_done\n-- \n1.5.4.3.529.gb25fb\n\n"},{"id":"70905","messageId":"1204619106-30449-2-git-send-email-gitster@pobox.com","threadId":"12486","inReplyTo":"1204619106-30449-1-git-send-email-gitster@pobox.com","subject":"[PATCH 2/3] am: remove support for -d .dotest","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-04T08:25:05Z","receivedAt":"2008-03-04T08:25:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It has been supported for a long time, but I do not think this feature has\nbeen in use in the real world at all.  We would eventually move this out\nof the toplevel of the work tree and to somewhere under $GIT_DIR, so let's\nremove the command line option to specify the location now.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-am.sh |   14 +++++---------\n 1 files changed, 5 insertions(+), 9 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 2b5bbb7..25129e6 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -9,7 +9,7 @@ git-am [options] <mbox>|<Maildir>...\n git-am [options] --resolved\n git-am [options] --skip\n --\n-d,dotest=       use <dir> and not .dotest\n+d,dotest=       (removed -- do not use)\n i,interactive   run interactively\n b,binary        pass --allo-binary-replacement to git-apply\n 3,3way          allow fall back on 3way merging if needed\n@@ -50,10 +50,6 @@ stop_here_user_resolve () {\n     then\n         cmdline=\"$cmdline -3\"\n     fi\n-    if test '.dotest' != \"$dotest\"\n-    then\n-        cmdline=\"$cmdline -d=$dotest\"\n-    fi\n     echo \"When you have resolved this problem run \\\"$cmdline --resolved\\\".\"\n     echo \"If you would prefer to skip this patch, instead run \\\"$cmdline --skip\\\".\"\n \n@@ -125,7 +121,7 @@ reread_subject () {\n }\n \n prec=4\n-dotest=\"${prefix}.dotest\"\n+dotest=\".dotest\"\n sign= utf8=t keep= skip= interactive= resolved= binary=\n resolvemsg= resume=\n git_apply_opt=\n@@ -152,8 +148,8 @@ do\n \t--skip)\n \t\tskip=t ;;\n \t-d|--dotest)\n-\t\tshift\n-\t\tcase \"$1\" in /*) dotest=$1;; *) dotest=\"$prefix$1\" ;; esac ;;\n+\t\tdie \"-d option is not longer supported.  Do not use.\"\n+\t\t;;\n \t--resolvemsg)\n \t\tshift; resolvemsg=$1 ;;\n \t--whitespace)\n@@ -189,7 +185,7 @@ then\n \t0,)\n \t\t# No file input but without resume parameters; catch\n \t\t# user error to feed us a patch from standard input\n-\t\t# when there is already .dotest.  This is somewhat\n+\t\t# when there is already $dotest.  This is somewhat\n \t\t# unreliable -- stdin could be /dev/null for example\n \t\t# and the caller did not intend to feed us a patch but\n \t\t# wanted to continue unattended.\n-- \n1.5.4.3.529.gb25fb\n\n"},{"id":"70906","messageId":"1204619106-30449-3-git-send-email-gitster@pobox.com","threadId":"12486","inReplyTo":"1204619106-30449-2-git-send-email-gitster@pobox.com","subject":"[PATCH 3/3] am: --rebasing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-04T08:25:06Z","receivedAt":"2008-03-04T08:25:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The new option --rebasing is used internally for rebase to tell am that\nit is being used for its purpose.  This would leave .dotest/rebasing to\nhelp \"completion\" scripts tell if the ongoing operation is am or rebase.\n\nAlso the option at the same time stands for --binary, -3 and -k which\nare always given when rebase drives am as its backend.\n\nUsing the information \"am\" leaves, git-completion.bash tells ongoing\nrebase and am apart.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/completion/git-completion.bash |   10 +++++++++-\n git-am.sh                              |   13 +++++++++++--\n git-rebase.sh                          |    2 +-\n 3 files changed, 21 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 8f70e1e..5ae8799 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -70,7 +70,15 @@ __git_ps1 ()\n \t\tlocal b\n \t\tif [ -d \"$g/../.dotest\" ]\n \t\tthen\n-\t\t\tr=\"|AM/REBASE\"\n+\t\t\tif test -f \"$g/../.dotest/rebasing\"\n+\t\t\tthen\n+\t\t\t\tr=\"|REBASE\"\n+\t\t\telif test -f \"$g/../.dotest/applying\"\n+\t\t\tthen\n+\t\t\t\tr=\"|AM\"\n+\t\t\telse\n+\t\t\t\tr=\"|AM/REBASE\"\n+\t\t\tfi\n \t\t\tb=\"$(git symbolic-ref HEAD 2>/dev/null)\"\n \t\telif [ -f \"$g/.dotest-merge/interactive\" ]\n \t\tthen\ndiff --git a/git-am.sh b/git-am.sh\nindex 25129e6..db8171c 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -21,7 +21,8 @@ C=              pass it through git-apply\n p=              pass it through git-apply\n resolvemsg=     override error message when patch failure occurs\n r,resolved      to be used after a patch failure\n-skip            skip the current patch\"\n+skip            skip the current patch\n+rebasing        (internal use for git-rebase)\"\n \n . git-sh-setup\n prefix=$(git rev-parse --show-prefix)\n@@ -122,7 +123,7 @@ reread_subject () {\n \n prec=4\n dotest=\".dotest\"\n-sign= utf8=t keep= skip= interactive= resolved= binary=\n+sign= utf8=t keep= skip= interactive= resolved= binary= rebasing=\n resolvemsg= resume=\n git_apply_opt=\n \n@@ -147,6 +148,8 @@ do\n \t\tresolved=t ;;\n \t--skip)\n \t\tskip=t ;;\n+\t--rebasing)\n+\t\trebasing=t threeway=t keep=t binary=t ;;\n \t-d|--dotest)\n \t\tdie \"-d option is not longer supported.  Do not use.\"\n \t\t;;\n@@ -237,6 +240,12 @@ else\n \techo \"$utf8\" >\"$dotest/utf8\"\n \techo \"$keep\" >\"$dotest/keep\"\n \techo 1 >\"$dotest/next\"\n+\tif test -n \"$rebasing\"\n+\tthen\n+\t\t: >\"$dotest/rebasing\"\n+\telse\n+\t\t: >\"$dotest/applying\"\n+\tfi\n fi\n \n case \"$resolved\" in\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 6b9af96..452c5e7 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -376,7 +376,7 @@ fi\n if test -z \"$do_merge\"\n then\n \tgit format-patch -k --stdout --full-index --ignore-if-in-upstream \"$upstream\"..ORIG_HEAD |\n-\tgit am $git_am_opt --binary -3 -k --resolvemsg=\"$RESOLVEMSG\" &&\n+\tgit am $git_am_opt --rebasing --resolvemsg=\"$RESOLVEMSG\" &&\n \tmove_to_original_branch\n \tret=$?\n \ttest 0 != $ret -a -d .dotest &&\n-- \n1.5.4.3.529.gb25fb\n\n"},{"id":"70911","messageId":"76718490803040057i16cc31b6nee459f560f5386f5@mail.gmail.com","threadId":"12486","inReplyTo":"1204619106-30449-2-git-send-email-gitster@pobox.com","subject":"Re: [PATCH 2/3] am: remove support for -d .dotest","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2008-03-04T08:57:45Z","receivedAt":"2008-03-04T08:57:45Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 4, 2008 at 3:25 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> @@ -152,8 +148,8 @@ do\n>        --skip)\n>                skip=t ;;\n>        -d|--dotest)\n> -               shift\n> -               case \"$1\" in /*) dotest=$1;; *) dotest=\"$prefix$1\" ;; esac ;;\n> +               die \"-d option is not longer supported.  Do not use.\"\n\ns/not longer/no longer/\n\nAlso, probably want to remove mention of the option from\nDocumentation/git-am.txt as well.\n\nj.\n"}]}