{"thread":{"id":"9104","subject":"[PATCH (REVISED)] Add core.editor configuration variable","startedAt":"2007-07-19T06:55:30Z","lastAt":"2007-07-20T00:20:55Z","messageCount":11,"participants":["Adam Roben","Andy Parkins","Johannes Schindelin","Brian Gernhardt","Nicolas Pitre","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47817","messageId":"11848281302504-git-send-email-aroben@apple.com","threadId":"9104","inReplyTo":null,"subject":"[PATCH (REVISED)] Add core.editor configuration variable","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-07-19T06:55:30Z","receivedAt":"2007-07-19T06:55:30Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"This variable lets you specify an editor that will be launched in preference to\nthe EDITOR and VISUAL environment variables.\n\nSigned-off-by: Adam Roben <aroben@apple.com>\n---\nOn Jul 18, 2007, at 11:23 PM, Shawn O. Pearce wrote:\n> We only launch an editor for three reasons: commit messages, tag\n> messages and git-rebase -i.  If we were to ever add a new editor\n> using thingy, odds are the user would want the same editor by\n> default for that too.\n\n   Well, it turns out we already do launch an editor in other places, namely\n\"git am -i\" and \"git send-email --compose\". So, this patch takes care of those\ncases as well.\n\n   My original intent had been to have an editor that really was *just* for\ncommit messages, but I realize now that that is probably something that not too\nmany people want, whereas core.editor is much more generally useful. Thanks\nJunio and Shawn for the advice.\n\n Documentation/git-commit.txt     |    9 +++++----\n Documentation/git-send-email.txt |    4 ++--\n git-am.sh                        |    2 +-\n git-commit.sh                    |   13 +++++++------\n git-rebase--interactive.sh       |    2 +-\n git-send-email.perl              |    3 +--\n git-tag.sh                       |    2 +-\n 7 files changed, 18 insertions(+), 17 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex f96142f..5caad56 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -244,10 +244,11 @@ on the Subject: line and the rest of the commit in the body.\n \n include::i18n.txt[]\n \n-ENVIRONMENT VARIABLES\n----------------------\n-The command specified by either the VISUAL or EDITOR environment\n-variables is used to edit the commit log message.\n+ENVIRONMENT AND CONFIGURATION VARIABLES\n+---------------------------------------\n+The editor used to edit the commit log message will be chosen from the\n+core.editor configuration variable, the VISUAL environment variable, or the\n+EDITOR environment variable (in that order).\n \n HOOKS\n -----\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 293686c..e7723c9 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -44,8 +44,8 @@ The --cc option must be repeated for each user you want on the cc list.\n \tvalue; if that is unspecified, default to --chain-reply-to.\n \n --compose::\n-\tUse $EDITOR to edit an introductory message for the\n-\tpatch series.\n+\tUse core.editor, $VISUAL, or $EDITOR to edit an introductory message\n+\tfor the patch series.\n \n --from::\n \tSpecify the sender of the emails.  This will default to\ndiff --git a/git-am.sh b/git-am.sh\nindex e5e6f2c..3a651ae 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -364,7 +364,7 @@ do\n \t\t[yY]*) action=yes ;;\n \t\t[aA]*) action=yes interactive= ;;\n \t\t[nN]*) action=skip ;;\n-\t\t[eE]*) \"${VISUAL:-${EDITOR:-vi}}\" \"$dotest/final-commit\"\n+\t\t[eE]*) \"$(git config core.editor || echo ${VISUAL:-${EDITOR:-vi}})\" \"$dotest/final-commit\"\n \t\t       action=again ;;\n \t\t[vV]*) action=again\n \t\t       LESS=-S ${PAGER:-less} \"$dotest/patch\" ;;\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 3f3de17..72e4cf0 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -544,18 +544,19 @@ fi\n \n case \"$no_edit\" in\n '')\n-\tcase \"${VISUAL:-$EDITOR},$TERM\" in\n+\tcommit_editor=$(git config core.editor || echo ${VISUAL:-$EDITOR})\n+\tcase \"$commit_editor,$TERM\" in\n \t,dumb)\n-\t\techo >&2 \"Terminal is dumb but no VISUAL nor EDITOR defined.\"\n-\t\techo >&2 \"Please supply the commit log message using either\"\n-\t\techo >&2 \"-m or -F option.  A boilerplate log message has\"\n-\t\techo >&2 \"been prepared in $GIT_DIR/COMMIT_EDITMSG\"\n+\t\techo >&2 \"Terminal is dumb but core.editor, VISUAL, and EDITOR\"\n+\t\techo >&2 \"are undefined. Please supply the commit log message\"\n+\t\techo >&2 \"using either -m or -F option.  A boilerplate log message\"\n+\t\techo >&2 \"has been prepared in $GIT_DIR/COMMIT_EDITMSG\"\n \t\texit 1\n \t\t;;\n \tesac\n \tgit-var GIT_AUTHOR_IDENT > /dev/null  || die\n \tgit-var GIT_COMMITTER_IDENT > /dev/null  || die\n-\t${VISUAL:-${EDITOR:-vi}} \"$GIT_DIR/COMMIT_EDITMSG\"\n+\t${commit_editor:-vi} \"$GIT_DIR/COMMIT_EDITMSG\"\n \t;;\n esac\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex f395076..2e15abb 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -414,7 +414,7 @@ EOF\n \t\t\tdie_abort \"Nothing to do\"\n \n \t\tcp \"$TODO\" \"$TODO\".backup\n-\t\t${VISUAL:-${EDITOR:-vi}} \"$TODO\" ||\n+\t\t$(git config core.editor || echo ${VISUAL:-${EDITOR:-vi}}) \"$TODO\" ||\n \t\t\tdie \"Could not execute editor\"\n \n \t\ttest -z \"$(grep -ve '^$' -e '^#' < $TODO)\" &&\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 7552cac..ad17b4e 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -341,8 +341,7 @@ GIT: for the patch you are writing.\n EOT\n \tclose(C);\n \n-\tmy $editor = $ENV{EDITOR};\n-\t$editor = 'vi' unless defined $editor;\n+\tmy $editor = $repo->config(\"core.editor\") || $ENV{VISUAL} || $ENV{EDITOR} || \"vi\";\n \tsystem($editor, $compose_filename);\n \n \topen(C2,\">\",$compose_filename . \".final\")\ndiff --git a/git-tag.sh b/git-tag.sh\nindex 1c25d88..9aa30b4 100755\n--- a/git-tag.sh\n+++ b/git-tag.sh\n@@ -177,7 +177,7 @@ if [ \"$annotate\" ]; then\n         ( echo \"#\"\n           echo \"# Write a tag message\"\n           echo \"#\" ) > \"$GIT_DIR\"/TAG_EDITMSG\n-        ${VISUAL:-${EDITOR:-vi}} \"$GIT_DIR\"/TAG_EDITMSG || exit\n+        $(git config core.editor || echo ${VISUAL:-${EDITOR:-vi}}) \"$GIT_DIR\"/TAG_EDITMSG || exit\n     else\n         printf '%s\\n' \"$message\" >\"$GIT_DIR\"/TAG_EDITMSG\n     fi\n-- \n1.5.3.rc2.19.gc4fba-dirty\n"},{"id":"47822","messageId":"200707190848.54655.andyparkins@gmail.com","threadId":"9104","inReplyTo":"11848281302504-git-send-email-aroben@apple.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-07-19T07:48:51Z","receivedAt":"2007-07-19T07:48:51Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Thursday 2007 July 19, Adam Roben wrote:\n\n>    Well, it turns out we already do launch an editor in other places,\n> namely \"git am -i\" and \"git send-email --compose\". So, this patch takes\n> care of those cases as well.\n\nPerhaps I'm being overly pedantic, but it seems odd to put options that are \nrelevant only to porcelain under the \"core\" section.\n\ncore.pager is in the same category - but that's already in.\n\nWould porcelain.editor be a better name for this variable?\n\n\nAndy\n\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"47832","messageId":"Pine.LNX.4.64.0707191058090.14781@racer.site","threadId":"9104","inReplyTo":"200707190848.54655.andyparkins@gmail.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-19T10:00:19Z","receivedAt":"2007-07-19T10:00:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 19 Jul 2007, Andy Parkins wrote:\n\n> On Thursday 2007 July 19, Adam Roben wrote:\n> \n> >    Well, it turns out we already do launch an editor in other places,\n> > namely \"git am -i\" and \"git send-email --compose\". So, this patch takes\n> > care of those cases as well.\n> \n> Perhaps I'm being overly pedantic, but it seems odd to put options that are \n> relevant only to porcelain under the \"core\" section.\n> \n> core.pager is in the same category - but that's already in.\n> \n> Would porcelain.editor be a better name for this variable?\n\n>From my point of view you can put into \"myWonderfulGit.editor\".  It does \nnot matter.\n\nSo why not just leave it in \"core\", also because -- strictly speaking -- \nthose commands in git.git are not really your regular porcelain. They are \ntested with almost every commit, and therefore have a much better chance \nnot to be broken inadvertently by changes to the core.\n\nCiao,\nDscho\n"},{"id":"47836","messageId":"200707191148.46228.andyparkins@gmail.com","threadId":"9104","inReplyTo":"Pine.LNX.4.64.0707191058090.14781@racer.site","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-07-19T10:48:44Z","receivedAt":"2007-07-19T10:48:44Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Thursday 2007 July 19, Johannes Schindelin wrote:\n> Hi,\n>\n> On Thu, 19 Jul 2007, Andy Parkins wrote:\n> > On Thursday 2007 July 19, Adam Roben wrote:\n> > >    Well, it turns out we already do launch an editor in other places,\n> > > namely \"git am -i\" and \"git send-email --compose\". So, this patch takes\n> > > care of those cases as well.\n> >\n> > Perhaps I'm being overly pedantic, but it seems odd to put options that\n> > are relevant only to porcelain under the \"core\" section.\n> >\n> > core.pager is in the same category - but that's already in.\n> >\n> > Would porcelain.editor be a better name for this variable?\n>\n> From my point of view you can put into \"myWonderfulGit.editor\".  It does\n> not matter.\n\nBy that argument, why do we bother with subsections at all.  In fact why not \ncall the variable \"xhxhxjjjll.yqlaoospsp\"?\n\nThey are meant to help the human remembering it.\n\n> So why not just leave it in \"core\", also because -- strictly speaking --\n\nThat's what I said for pager - since it's already there.  However, since the \neditor isn't already in, it's not a question of _leaving_ it anywhere.  \nBetter that it goes in the right place when it is first introduced.\n\n> those commands in git.git are not really your regular porcelain. They are\n> tested with almost every commit, and therefore have a much better chance\n\nSo is every other porcelain command - almost by definition, porcelain commands \nare the ones we use.\n\n> not to be broken inadvertently by changes to the core.\n\nI don't understand the point you're making here.  Are you saying that we can \nrely on porcelain not to change or the core not to change?  I'm also \nwondering about these \"inadvertent\" changes that are getting made to git \ncore - I've not noticed them before :-)\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"47842","messageId":"Pine.LNX.4.64.0707191213300.14781@racer.site","threadId":"9104","inReplyTo":"200707191148.46228.andyparkins@gmail.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-19T11:15:10Z","receivedAt":"2007-07-19T11:15:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 19 Jul 2007, Andy Parkins wrote:\n\n> On Thursday 2007 July 19, Johannes Schindelin wrote:\n> >\n> > On Thu, 19 Jul 2007, Andy Parkins wrote:\n> >\n> > > Would porcelain.editor be a better name for this variable?\n> >\n> > From my point of view you can put into \"myWonderfulGit.editor\".  It \n> > does not matter.\n> \n> By that argument, why do we bother with subsections at all.  In fact why \n> not call the variable \"xhxhxjjjll.yqlaoospsp\"?\n\nNo.  I said, and I quote here, \"From my point of view\".\n\n> They are meant to help the human remembering it.\n> \n> > So why not just leave it in \"core\", also because -- strictly speaking \n> > --\n> \n> That's what I said for pager - since it's already there.  However, since \n> the editor isn't already in, it's not a question of _leaving_ it \n> anywhere.  Better that it goes in the right place when it is first \n> introduced.\n\nAnd how would having \"core.pager\" but \"porcelain.editor\" be easier to \nremember?  Nah, not really.\n\nCiao,\nDscho\n"},{"id":"47863","messageId":"200707191523.42086.andyparkins@gmail.com","threadId":"9104","inReplyTo":"Pine.LNX.4.64.0707191213300.14781@racer.site","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-07-19T14:23:40Z","receivedAt":"2007-07-19T14:23:40Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Thursday 2007 July 19, Johannes Schindelin wrote:\n> Hi,\n>\n> On Thu, 19 Jul 2007, Andy Parkins wrote:\n> > On Thursday 2007 July 19, Johannes Schindelin wrote:\n> > > On Thu, 19 Jul 2007, Andy Parkins wrote:\n> > > > Would porcelain.editor be a better name for this variable?\n> > >\n> > > From my point of view you can put into \"myWonderfulGit.editor\".  It\n> > > does not matter.\n> >\n> > By that argument, why do we bother with subsections at all.  In fact why\n> > not call the variable \"xhxhxjjjll.yqlaoospsp\"?\n>\n> No.  I said, and I quote here, \"From my point of view\".\n\nThat doesn't change my point - these things are named to give meaning, they \naren't just arbitrary strings of characters.\n\n> And how would having \"core.pager\" but \"porcelain.editor\" be easier to\n> remember?  Nah, not really.\n\nIf there is no difference, then do you object so strongly?\n\nBesides, memory isn't just about having words, it's about meaning too.  \nCategorisation and hierarchy are important.  If I'm searching my brain for a \nfunction that does something to strings then the fact that it starts \nwith \"str\" gets me a long way there.  The fact that they _all_ start \nwith \"str\" is what's important.\n\nI don't care _that_ strongly; just like you it won't make any difference to me \npersonally as I'll cope either way.  I'm trying to think like a noob, and it \nseems that coherency is broken when we make distinctions between porcelain \nand plumbing and then don't stick to them in the config file.\n\nPerhaps I am wrong in my assumption: I have always thought of core.* options \nbeing those options which apply to plumbing - i.e. if I were a git-guru and \ndid everything with plumbing I would still need those options.\n\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"47864","messageId":"95E642DA-F848-4398-9D9D-52B03A235887@silverinsanity.com","threadId":"9104","inReplyTo":"200707190848.54655.andyparkins@gmail.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-07-19T14:24:37Z","receivedAt":"2007-07-19T14:24:37Z","isPatch":true,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Jul 19, 2007, at 3:48 AM, Andy Parkins wrote:\n\n> On Thursday 2007 July 19, Adam Roben wrote:\n>\n>>    Well, it turns out we already do launch an editor in other places,\n>> namely \"git am -i\" and \"git send-email --compose\". So, this patch  \n>> takes\n>> care of those cases as well.\n>\n> Perhaps I'm being overly pedantic, but it seems odd to put options  \n> that are\n> relevant only to porcelain under the \"core\" section.\n>\n> core.pager is in the same category - but that's already in.\n\nSince I'm the one who added that, I feel compelled to add in my $0.02.\n\nFirst, there wasn't much argument on the list when core.pager was  \nadded...  But that's not my major point.\n\nTo many git users (myself included), claiming that commands like git- \ncommit, git-log, and other \"porcelain\" isn't part of \"core\" git is  \nridiculous.  These are the commands that I use every day, and are a  \npart of the main git package, source, and repository.  If the  \nporcelain was maintained separately from the pluming, like cognito  \nwas, perhaps that would be a more compelling argument to me.\n\nFor many people commit is more \"core\" to their git usage than write- \ntree and commit-tree.  At this point, it's less an extra layer  \nporcelain and more the standard interface.  It's a result of the  \nwonderful attempts to make git more user friendly.\n\nAs far as [core] being only for plumbing, I disagree with that  \npremise as well.  Any option that is used across many of the git  \ncommands is a core (meaning central) option.\n\n~~ Brian\n"},{"id":"47868","messageId":"200707191552.37825.andyparkins@gmail.com","threadId":"9104","inReplyTo":"95E642DA-F848-4398-9D9D-52B03A235887@silverinsanity.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-07-19T14:52:36Z","receivedAt":"2007-07-19T14:52:36Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Thursday 2007 July 19, Brian Gernhardt wrote:\n\n> As far as [core] being only for plumbing, I disagree with that\n> premise as well.  Any option that is used across many of the git\n> commands is a core (meaning central) option.\n\nFair enough.  With the definition core != plumbing; my argument has no weight.\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIET\nandyparkins@gmail.com\n"},{"id":"47896","messageId":"alpine.LFD.0.999.0707191525160.22541@xanadu.home","threadId":"9104","inReplyTo":"200707191523.42086.andyparkins@gmail.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-07-19T19:28:53Z","receivedAt":"2007-07-19T19:28:53Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 19 Jul 2007, Andy Parkins wrote:\n\n> On Thursday 2007 July 19, Johannes Schindelin wrote:\n> > And how would having \"core.pager\" but \"porcelain.editor\" be easier to\n> > remember?  Nah, not really.\n> \n> If there is no difference, then do you object so strongly?\n\nIf anything I think it is core.pager which is a misnommer.  A pager is \ncertainly more porcelainish. by nature.\n\nGiven that core.pager already exists, I think it would be yet another \nmistake to put editor in a different section separate from pager.\n\nIMHO both of them should have been user.pager and user.editor.\n\n\nNicolas\n"},{"id":"47898","messageId":"alpine.LFD.0.999.0707191531330.22541@xanadu.home","threadId":"9104","inReplyTo":"95E642DA-F848-4398-9D9D-52B03A235887@silverinsanity.com","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-07-19T19:32:37Z","receivedAt":"2007-07-19T19:32:37Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 19 Jul 2007, Brian Gernhardt wrote:\n\n> For many people commit is more \"core\" to their git usage than write-tree and\n> commit-tree.  At this point, it's less an extra layer porcelain and more the\n> standard interface.  It's a result of the wonderful attempts to make git more\n> user friendly.\n> \n> As far as [core] being only for plumbing, I disagree with that premise as\n> well.  Any option that is used across many of the git commands is a core\n> (meaning central) option.\n\nThat pov certainly makes sense to me.\n\n\nNicolas\n"},{"id":"47914","messageId":"7v7iow2ae0.fsf@assigned-by-dhcp.cox.net","threadId":"9104","inReplyTo":"alpine.LFD.0.999.0707191531330.22541@xanadu.home","subject":"Re: [PATCH (REVISED)] Add core.editor configuration variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-20T00:20:55Z","receivedAt":"2007-07-20T00:20:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@cam.org> writes:\n\n> On Thu, 19 Jul 2007, Brian Gernhardt wrote:\n>\n>> For many people commit is more \"core\" to their git usage than write-tree and\n>> commit-tree.  At this point, it's less an extra layer porcelain and more the\n>> standard interface.  It's a result of the wonderful attempts to make git more\n>> user friendly.\n>> \n>> As far as [core] being only for plumbing, I disagree with that premise as\n>> well.  Any option that is used across many of the git commands is a core\n>> (meaning central) option.\n>\n> That pov certainly makes sense to me.\n\nGood to see the discussion converged while I was trapped in the\nday job.  So core.editor it is?\n \n"}]}