From: Junio C Hamano <gitster@pobox.com>
To: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: Stefan Beller <sbeller@google.com>,
Jacob Keller <jacob.keller@gmail.com>,
Graeme Geldenhuys <graemeg@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Git's inconsistent command line options
Date: Wed, 26 Aug 2015 10:56:15 -0700 [thread overview]
Message-ID: <xmqqio822atc.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAE1pOi3e8KS9x5yD7CZLESvhXy1oXmQEgUnEFjww7L6JOdZ1Jg@mail.gmail.com> (Hilco Wijbenga's message of "Tue, 25 Aug 2015 18:30:18 -0700")
Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:
> On 25 August 2015 at 16:43, Junio C Hamano <gitster@pobox.com> wrote:
>> I do not see a good way to do such a safe transition with command
>> words approach, *unless* we are going to introduce new commands,
>> i.e. "git list-tag", "git create-tag", etc.
>
> Perhaps we could introduce a more explicit notion (in .git/config) of
> a Git API version (or, perhaps more accurate, a Git CLI API version)?
> ...
> I think that from a user's point of view this could work quite well.
> Obviously, (worst case scenario) Git commands might have to support up
> to 3 APIs at the same time (previous [2], current [3], and future [4]
> for Git 3.x) so from a code maintenance POV it would certainly
> introduce complexity and probably some duplication of code. I'm
> hopeful it would be limited to CL argument processing but I suspect
> that when Git code calls other Git code (especially in the Bash based
> commands) there might be some more complexity there.
>
> Would something like that be feasible?
A bigger issue you need to think about is what to do to scripts
people have. Your approach forces them to update a script to delete
a tag and do something else to say something silly like this:
#!/bin/sh
# My Script
case "$(git config core.apiVersion)" in
"" | 2)
git tag -d "$1"
do something else on "$1" using v2 API
;;
3)
git tag delete "$1"
do something else on "$1" using v3 API
;;
*)
echo >&2 "sorry, I do not know what Git you are using"
exit 1
;;
esac
So, it may be feasible to implement, but I do not think it would be
useful to do so.
Instead, if you really want to invent the multi-version world, you
would rather want to have something more like this:
#!/bin/sh
# My Script
GIT_API_VERSION=2
export GIT_API_VERSION
git tag -d "$1"
do something else on "$1" using v2 API
But notice that I said "if you really want to". I personally think
it is a road to madness.
next prev parent reply other threads:[~2015-08-26 17:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 8:01 Git's inconsistent command line options Graeme Geldenhuys
2015-08-25 15:13 ` Junio C Hamano
2015-08-25 21:49 ` Jacob Keller
2015-08-25 22:06 ` Stefan Beller
2015-08-25 22:21 ` Jacob Keller
2015-08-25 23:43 ` Junio C Hamano
2015-08-26 1:30 ` Hilco Wijbenga
2015-08-26 17:56 ` Junio C Hamano [this message]
2015-08-26 18:10 ` Jacob Keller
2015-08-26 20:48 ` Junio C Hamano
2015-08-26 22:52 ` Philip Oakley
2015-08-26 23:02 ` Jacob Keller
2015-08-26 23:03 ` Jacob Keller
2015-08-26 4:09 ` Jacob Keller
2015-08-26 6:28 ` Andreas Schwab
2015-08-26 6:33 ` Jacob Keller
2015-08-31 10:10 ` Duy Nguyen
2015-08-31 14:25 ` Barry Warsaw
2015-09-01 9:28 ` David Aguilar
2015-09-01 14:19 ` Barry Warsaw
2015-09-01 16:42 ` Junio C Hamano
2015-09-01 17:50 ` Barry Warsaw
2015-09-01 17:56 ` Stefan Beller
2015-09-09 9:42 ` Michael J Gruber
2015-09-09 9:42 ` Michael J Gruber
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=xmqqio822atc.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=graemeg@gmail.com \
--cc=hilco.wijbenga@gmail.com \
--cc=jacob.keller@gmail.com \
--cc=sbeller@google.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).