git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Derrick Stolee <stolee@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH] scalar: accept -C and -c options before the subcommand
Date: Sat, 29 Jan 2022 07:39:45 +0100	[thread overview]
Message-ID: <220129.86tudnavjl.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <2150a170-bf02-f510-3995-c103650ad8fc@gmail.com>


On Fri, Jan 28 2022, Derrick Stolee wrote:

> On 1/28/2022 1:21 PM, Ævar Arnfjörð Bjarmason wrote:
>> 
>> On Fri, Jan 28 2022, Johannes Schindelin wrote:
>> 
>>> On Thu, 27 Jan 2022, Derrick Stolee wrote:
>>>
>>>> The biggest benefits of using handle_options() is for other pre-command
>>>> options such as --exec-path, which I use on a regular basis when testing
>>>> new functionality.
>>>>
>>>> There are other options in handle_options() that might not be
>>>> appropriate, or might be incorrect if we just make handle_options()
>>>> non-static. For example, `scalar --list-cmds=parseopt` wouldn't show the
>>>> scalar commands and would instead show the git commands.
>>>
>>> Right, and since `handle_options()` lives in the same file as `git`'s
>>> `cmd_main()` function, we would not only have to disentangle options that
>>> work only for `git` from those that would also work for `scalar`, but we
>>> would have to extract the `handle_options()` function into a separate
>>> file.
>>>
>>> And while at it, a tangent someone with infinite time on their hands might
>>> suggest is: why not convert `handle_options()` to the `parse_options()`
>>> machinery? Which would of course solve one issue by adding several new
>>> ones. Don't get me wrong: I would find it useful to convert
>>> `git.c:handle_options()` to a function in `libgit.a` which uses the
>>> `parse_options()` machinery. It'll just require a lot of time, and I do
>>> not see enough benefit that would make it worth embarking on that
>>> particular journey.
>>>
>>> But since I had a look at `handle_options()` anyway, I might just as well
>>> summarize my insights about how applicable the supported options are for
>>> `scalar` here:
>>> [...]
>>> # Detrimental
>>>
>>>   --exec-path
>>>
>>> 	Since `scalar` is tightly coupled to a specific Git version, it
>>> 	would cause much more harm than benefit to encourage users to use
>>> 	a different Git version by offering them this option.
>> 
>> So just to clarify, do you and Stolee disagree about scalar supporting
>> --exec-path, per his comments above?
>
> I think it would be nice, but it's also not a blocker for me.
>
>> In this case I don't mind much, but speaking generally I see you and
>> Stolee tying yourselves in knots again about scalar being in contrib so
>> we shouldn't use libgit.
>> 
>> It already uses libgit, there's even (last I checked) at least one
>> function in it only used directly by the scalar code.
>
> My concern is not that we shouldn't use libgit (because we do) but that
> we shouldn't make significant changes to libgit.a only for Scalar's
> benefit until it is incorporated in a more final way.
>
> In my opinion, well-architected code is code that is easy to delete.
> Until we have Scalar mostly feature-complete and can make a decision
> about it living in the Git tree long-term (and _where_ it resides), I
> would like to have the following property: If I were to revert all
> commits that touch contrib/scalar/ and squash them into a single commit,
> then we would have a bunch of file deletions and a very small set of
> edits to the Makefile. I don't know how much the ship has sailed there
> already, but keeping the size of that "revert diff" small means that we
> are keeping the coupling low during this review process.

Fair enough.

I think there's cases where it won't make sense, and cases where it
will.

Maybe it doesn't make sense here, but generally I wouldn't take it being
needed for scalar heavily into account per-se, for the review & i18n
reasons I mentioned.

I.e. the list is already looking at these patches, and translators are
being presented these strings as part of our existing set.

So "this reuses existing tested code" and "you won't need to translate
this new thing" will be benefits whatever the current state of scalar
is.

>> I don't remember anyone having any objection to scalar using libgit
>> code, or even that there's libgit code just to help it along. That's a
>> self-imposed limitation you two seem to have invented.
>> 
>> Personally I find a patch like the below much easier to review. It's the
>> parts that aren't easy to review boilerplate are all things that we have
>> in-tree already.
>> 
>> Whereas proposing a new way to parse -c or -C will lead (at least me) to
>> carefully eyeballing that new implementation, looking at how it differs
>> (if at all) from the existing one, wondering why the i18n strings are
>> subtly different etc (I saw one reason is that since the code was
>> copy/pasted initially the git.c version was updated, but your patch
>> wasn't updated to copy it).
>
>> diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
>> index 1ce9c2b00e8..ee793ff6ccc 100644
>> --- a/contrib/scalar/scalar.c
>> +++ b/contrib/scalar/scalar.c
>
>> diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
>> index 1ce9c2b00e8..ee793ff6ccc 100644
>> --- a/contrib/scalar/scalar.c
>> +++ b/contrib/scalar/scalar.c
>
> Was this diff double-copied or something?

Yes, sorry the first 3 hunks are the same. I manually re-copied this
into my editor (I forgot a stray debugging printf) and screwed it up.

  reply	other threads:[~2022-01-29  6:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 11:15 [PATCH] scalar: accept -C and -c options before the subcommand Johannes Schindelin via GitGitGadget
2022-01-26 20:53 ` Taylor Blau
2022-01-28 11:43   ` Johannes Schindelin
2022-01-27  2:55 ` Ævar Arnfjörð Bjarmason
2022-01-27 14:46   ` Derrick Stolee
2022-01-28 11:27     ` Johannes Schindelin
2022-01-28 18:21       ` Ævar Arnfjörð Bjarmason
2022-01-28 19:52         ` Derrick Stolee
2022-01-29  6:39           ` Ævar Arnfjörð Bjarmason [this message]
2022-01-28 19:37       ` Derrick Stolee
2022-01-28 18:05     ` Junio C Hamano
2022-01-28 19:38       ` Derrick Stolee
2022-01-28 14:31 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2022-01-28 19:40   ` Derrick Stolee

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=220129.86tudnavjl.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=stolee@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).