git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ben Keene via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Ben Keene <seraphire@gmail.com>
Subject: Re: [PATCH v2 2/3] Added general variable git-p4.binary and added a default for windows of 'P4.EXE'
Date: Sat, 16 Nov 2019 11:50:04 +0900	[thread overview]
Message-ID: <xmqq8sog5ycj.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <98bae92fda9ca01d01b2e9fb70b04b00470e7bec.1573828978.git.gitgitgadget@gmail.com> (Ben Keene via GitGitGadget's message of "Fri, 15 Nov 2019 14:42:57 +0000")

"Ben Keene via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Ben Keene <seraphire@gmail.com>
> Subject: Re: [PATCH v2 2/3] Added general variable git-p4.binary and added a default for windows of 'P4.EXE'

Again, this is "what" you did, without explaining "why".  You give
readers no hint to help them judge if/why it is a good idea to apply
this patch.

Perhaps

	Subject: [PATCH] git-p4: allow path to the "p4" program configurable

	Introduce "git-p4.p4program" configuration variable that can
	be used to explicitly tell the path to the perforce client
	program.  When unspecified, this defaults to "p4" except for
	Windows where "p4.exe" is used instead.

or something?  This is still weaker than ideal as an explanation of
"why", but better than not saying anything as your original did ;-)

The reason why I find it weaker than ideal is because I would expect
any P4 user to have their system set up so that they can say "p4"
and get "p4" without configuring anything specifically (iow, "%PATH%"
would have been set up to have something with the p4.exe you want),
and this change is to help those users, to whom that expectation
does not hold (and in that case, it is better to explain in the
proposed log message why their system would not let them run Perforce
without first configuring this variable).

Again, as I said, you do not want to introduce "git-p4.binary" in
2/3 and then turn around to "oops, that was a mistake and it was not
a good name, so let's rename it" in 3/3.  Pretend as if you are a
perfect developer with 100% foresight and have chosen the right name
from the get-go by using "git-p4.p4program" in this step and drop
patch 3/3.

Thanks.

> Signed-off-by: Ben Keene <seraphire@gmail.com>
> ---
>  Documentation/git-p4.txt |  5 +++++
>  git-p4.py                | 14 +++++++++++++-
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
> index 3494a1db3e..e206e69250 100644
> --- a/Documentation/git-p4.txt
> +++ b/Documentation/git-p4.txt
> @@ -547,6 +547,11 @@ git-p4.retries::
>  	Set the value to 0 to disable retries or if your p4 version
>  	does not support retries (pre 2012.2).
>  
> +git-p4.binary::
> +	Specifies the p4 executable used by git-p4 to process commands.
> +	The default value for Windows is `p4.exe` and for all other
> +	systems the default is `p4`. 
> +
>  Clone and sync variables
>  ~~~~~~~~~~~~~~~~~~~~~~~~
>  git-p4.syncFromOrigin::
> diff --git a/git-p4.py b/git-p4.py
> index 6e8b3a26cd..160d966ee1 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -26,6 +26,8 @@
>  import zlib
>  import ctypes
>  import errno
> +import os.path
> +from os import path
>  
>  # support basestring in python3
>  try:
> @@ -85,7 +87,17 @@ def p4_build_cmd(cmd):
>      location. It means that hooking into the environment, or other configuration
>      can be done more easily.
>      """
> -    real_cmd = ["p4"]
> +    # Look for the P4 binary
> +    p4bin = gitConfig("git-p4.binary")
> +    real_cmd = []
> +    if p4bin != "":
> +        if path.exists(p4bin):
> +            real_cmd = [p4bin]
> +    if real_cmd == []:
> +        if (platform.system() == "Windows"):
> +            real_cmd = ["p4.exe"]    
> +        else:
> +            real_cmd = ["p4"]
>  
>      user = gitConfig("git-p4.user")
>      if len(user) > 0:

  reply	other threads:[~2019-11-16  2:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 21:14 [PATCH 0/2] Feature: New Variable git-p4.binary Ben Keene via GitGitGadget
2019-11-13 21:14 ` [PATCH 1/2] Cast byte strings to unicode strings in python3 Ben Keene via GitGitGadget
2019-11-13 21:14 ` [PATCH 2/2] Added general variable git-p4.binary and added a default for windows of 'P4.EXE' Ben Keene via GitGitGadget
2019-11-14  2:36 ` [PATCH 0/2] Feature: New Variable git-p4.binary Junio C Hamano
2019-11-14  9:53   ` Luke Diamand
2019-11-14 20:16     ` Ben Keene
2019-11-15  9:28       ` Luke Diamand
2019-11-15 14:42 ` [PATCH v2 0/3] Feature: New Variable git-p4.p4program Ben Keene via GitGitGadget
2019-11-15 14:42   ` [PATCH v2 1/3] Cast byte strings to unicode strings in python3 Ben Keene via GitGitGadget
2019-11-16  2:40     ` Junio C Hamano
2019-11-16  3:52       ` Junio C Hamano
2019-11-15 14:42   ` [PATCH v2 2/3] Added general variable git-p4.binary and added a default for windows of 'P4.EXE' Ben Keene via GitGitGadget
2019-11-16  2:50     ` Junio C Hamano [this message]
2019-11-15 14:42   ` [PATCH v2 3/3] Changed the name of the parameter from git-p4.binary to git-p4.p4program Ben Keene via GitGitGadget
2019-11-16  2:40   ` [PATCH v2 0/3] Feature: New Variable git-p4.p4program Junio C Hamano
2019-11-18  1:15     ` Junio C Hamano
2019-12-03 15:59       ` Ben Keene

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqq8sog5ycj.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=seraphire@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).