git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Diamand <luke@diamand.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Pete Wyckoff <pw@padd.com>,
	Vitor Antunes <vitor.hda@gmail.com>
Subject: Re: [PATCHv2 1/2] git p4: Fixing script editor checks
Date: Wed, 11 Apr 2012 21:24:40 +0200	[thread overview]
Message-ID: <CAE5ih7-49ynPFrHDn_a0fiskSjfovS4qX2eHh9W3G08HaHHRkw@mail.gmail.com> (raw)
In-Reply-To: <7vpqbejdf4.fsf@alter.siamese.dyndns.org>

On Wed, Apr 11, 2012 at 9:06 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Luke Diamand <luke@diamand.org> writes:
>
>> On Wed, Apr 11, 2012 at 7:14 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Luke Diamand <luke@diamand.org> writes:
>>>
>>>> If P4EDITOR is defined, the tests will fail when "git p4" starts an
>>>> editor.
>>>
>>> Is that a problem specific to tests, or should "git p4" itself unset that
>>> environment? If it is a problem specific to tests, would it be a better
>>> fix to add "P4EDITOR=:" like we do for EDITOR in t/test-lib.sh?
>>
>> Yes and no - git-p4.py will run $P4EDITOR if it is set, even if it's
>> just empty. So it would need a small fix to check for an empty string.
>> I can submit a suitable patch.
>
> How does real "p4" run $P4EDITOR?  For example, if you have:
>
>        P4EDITOR='vi -e'
>
> does it start "vi" in its "ex" mode, implying that it behaves as if the
> invocation were like this in a hypothetical implementation of "p4" as a
> shell script:
>
>        #!/bin/sh
>        ... do some stuff p4 does ...
>        $P4EDITOR file-to-be-edited
>
> Whatever it does needs to be emulated by the code in git-p4.py that runs
> it, as that is the way the end users expect, and if it turns out to be
> like the above, setting P4EDITOR to ':' just like we do to EDITOR in
> t/test-lib.sh should be the right thing to do.  The always-true command
> colon will leave the file-to-be-edited unmodified and report success.
>
> Similarly, what happens with "p4" when $P4EDITOR is set to an empty
> string?  If it ignores and falls back to the other usual way to find your
> preferred editor, you should emulate that as well in git-p4.py.
>
> Thanks.

"vi -e" => vi in ex mode
":" => always-true-command
"" => falls back to $EDITOR, and then to vi(UNIX or Win32 if $SHELL is
set) or notepad(Win32).

  reply	other threads:[~2012-04-11 19:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 15:21 [PATCHv2 0/2] git p4 - import/export of git/p4 tags and labels Luke Diamand
2012-04-11 15:21 ` [PATCHv2 1/2] git p4: Fixing script editor checks Luke Diamand
2012-04-11 17:14   ` Junio C Hamano
2012-04-11 18:51     ` Luke Diamand
2012-04-11 19:06       ` Junio C Hamano
2012-04-11 19:24         ` Luke Diamand [this message]
2012-04-11 15:21 ` [PATCHv2 2/2] git p4: import/export of labels to/from p4 Luke Diamand
2012-04-18 11:34   ` Pete Wyckoff
2012-04-21 17:59     ` Luke Diamand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE5ih7-49ynPFrHDn_a0fiskSjfovS4qX2eHh9W3G08HaHHRkw@mail.gmail.com \
    --to=luke@diamand.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pw@padd.com \
    --cc=vitor.hda@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).