* git silently ignores aliases of existing commands
@ 2009-07-18 0:52 Michael G Schwern
2009-07-18 2:01 ` Sean Estabrooks
0 siblings, 1 reply; 9+ messages in thread
From: Michael G Schwern @ 2009-07-18 0:52 UTC (permalink / raw)
To: git
Everyone says "git tag" does the wrong thing by default and what you really
want is an annotated tag with "git tag -a". So I figured I'd fix the default
and in my .gitconfig added:
[alias]
tag = tag -a
and considered it done. Weeks later I discovered git was ignoring that alias
and I was still making lightweight tags.
It would be nice if git used the alias *before* the installed command. This
lets me fix/change default behaviors without having to come up with a new
command. (Another handy example: blame = blame -w) It doesn't do anything
useful right now anyway.
Whether or not that changes, if an alias is being ignored git should warn me.
This informs the user their perfectly sensible action has not done what they
expected. In addition, should git add a command in the future which conflicts
with the name of an alias they'll know.
PS I couldn't find anything obvious about where to send bug reports / feature
requests in the git man page, just "general upbringing" pointing here. It
would be helpful if it was a bit more clear. None of "bug", "report" or
"issue" pointed at anything relevant.
--
184. When operating a military vehicle I may *not* attempt something
"I saw in a cartoon".
-- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
http://skippyslist.com/list/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 0:52 git silently ignores aliases of existing commands Michael G Schwern
@ 2009-07-18 2:01 ` Sean Estabrooks
2009-07-18 7:16 ` Michael G Schwern
0 siblings, 1 reply; 9+ messages in thread
From: Sean Estabrooks @ 2009-07-18 2:01 UTC (permalink / raw)
To: Michael G Schwern; +Cc: git
On Fri, 17 Jul 2009 17:52:49 -0700
Michael G Schwern <schwern@pobox.com> wrote:
[...]
> It would be nice if git used the alias *before* the installed command. This
> lets me fix/change default behaviors without having to come up with a new
> command. (Another handy example: blame = blame -w) It doesn't do anything
> useful right now anyway.
Hi Michael,
This has been discussed a few times on the list already. Here is one such
discussion:
http://thread.gmane.org/gmane.comp.version-control.git/112487/focus=112493
You'll see that it was decided that Git would not allow commands to be overridden
so that you could always be sure what a given command would do when you sit
down at any installation. This is especially important for scripting but can
also be a problem for everyday usage. You'll just have to choose a new command
name for the alternate default you want.
[...]
> PS I couldn't find anything obvious about where to send bug reports / feature
> requests in the git man page, just "general upbringing" pointing here. It
> would be helpful if it was a bit more clear. None of "bug", "report" or
> "issue" pointed at anything relevant.
This list is the appropriate place for any of the issues you enumerate.
Cheers,
Sean
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 2:01 ` Sean Estabrooks
@ 2009-07-18 7:16 ` Michael G Schwern
2009-07-18 9:30 ` demerphq
0 siblings, 1 reply; 9+ messages in thread
From: Michael G Schwern @ 2009-07-18 7:16 UTC (permalink / raw)
To: Sean Estabrooks; +Cc: git
Sean Estabrooks wrote:
> On Fri, 17 Jul 2009 17:52:49 -0700
> Michael G Schwern <schwern@pobox.com> wrote:
>
> [...]
>> It would be nice if git used the alias *before* the installed command. This
>> lets me fix/change default behaviors without having to come up with a new
>> command. (Another handy example: blame = blame -w) It doesn't do anything
>> useful right now anyway.
>
> This has been discussed a few times on the list already. Here is one such
> discussion:
>
> http://thread.gmane.org/gmane.comp.version-control.git/112487/focus=112493
>
> You'll see that it was decided that Git would not allow commands to be overridden
> so that you could always be sure what a given command would do when you sit
> down at any installation. This is especially important for scripting but can
> also be a problem for everyday usage. You'll just have to choose a new command
> name for the alternate default you want.
I'm in the "more than enough rope" camp myself, so count that as a -1 fwiw.
More importantly, what about the warning telling the user that what they did
is not allowed and didn't work?
--
<Schwern> What we learned was if you get confused, grab someone and swing
them around a few times
-- Life's lessons from square dancing
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 7:16 ` Michael G Schwern
@ 2009-07-18 9:30 ` demerphq
2009-07-18 10:46 ` Jeff King
0 siblings, 1 reply; 9+ messages in thread
From: demerphq @ 2009-07-18 9:30 UTC (permalink / raw)
To: Michael G Schwern; +Cc: Sean Estabrooks, git
2009/7/18 Michael G Schwern <schwern@pobox.com>:
> Sean Estabrooks wrote:
>> On Fri, 17 Jul 2009 17:52:49 -0700
>> Michael G Schwern <schwern@pobox.com> wrote:
>>
>> [...]
>>> It would be nice if git used the alias *before* the installed command. This
>>> lets me fix/change default behaviors without having to come up with a new
>>> command. (Another handy example: blame = blame -w) It doesn't do anything
>>> useful right now anyway.
>>
>> This has been discussed a few times on the list already. Here is one such
>> discussion:
>>
>> http://thread.gmane.org/gmane.comp.version-control.git/112487/focus=112493
>>
>> You'll see that it was decided that Git would not allow commands to be overridden
>> so that you could always be sure what a given command would do when you sit
>> down at any installation. This is especially important for scripting but can
>> also be a problem for everyday usage. You'll just have to choose a new command
>> name for the alternate default you want.
>
> I'm in the "more than enough rope" camp myself, so count that as a -1 fwiw.
>
> More importantly, what about the warning telling the user that what they did
> is not allowed and didn't work?
Yeah it seems reasonable that if its going to be ignored it should not
be silently ignored.
Especially given that the silentness effectively means there cant be
any new git tools added without possible breakage of installed setups.
cheers,
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 9:30 ` demerphq
@ 2009-07-18 10:46 ` Jeff King
2009-07-18 10:55 ` demerphq
0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2009-07-18 10:46 UTC (permalink / raw)
To: demerphq; +Cc: Michael G Schwern, Sean Estabrooks, git
On Sat, Jul 18, 2009 at 11:30:25AM +0200, demerphq wrote:
> Yeah it seems reasonable that if its going to be ignored it should not
> be silently ignored.
I agree that there should be a warning. However, it's hard to do with
the code structured as it is now; we don't know that a command exists
as an external command until we try to exec it. And if it succeeds, we
don't get to execute any more code.
It's certainly possible, but sadly it is more surgery than just
if (alias_lookup(cmd))
warn("you also have an alias defined");
> Especially given that the silentness effectively means there cant be
> any new git tools added without possible breakage of installed setups.
The silentness makes it harder to diagnose problems, but even with a
warning, we can break things by creating new commands. If you have an
alias "foo" and we ship "git-foo" in a newer version of git, your alias
will just stop working.
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 10:46 ` Jeff King
@ 2009-07-18 10:55 ` demerphq
2009-07-18 10:58 ` Jeff King
0 siblings, 1 reply; 9+ messages in thread
From: demerphq @ 2009-07-18 10:55 UTC (permalink / raw)
To: Jeff King; +Cc: Michael G Schwern, Sean Estabrooks, git
2009/7/18 Jeff King <peff@peff.net>:
> On Sat, Jul 18, 2009 at 11:30:25AM +0200, demerphq wrote:
>
>> Yeah it seems reasonable that if its going to be ignored it should not
>> be silently ignored.
>
> I agree that there should be a warning. However, it's hard to do with
> the code structured as it is now; we don't know that a command exists
> as an external command until we try to exec it. And if it succeeds, we
> don't get to execute any more code.
>
> It's certainly possible, but sadly it is more surgery than just
>
> if (alias_lookup(cmd))
> warn("you also have an alias defined");
>
>> Especially given that the silentness effectively means there cant be
>> any new git tools added without possible breakage of installed setups.
>
> The silentness makes it harder to diagnose problems, but even with a
> warning, we can break things by creating new commands. If you have an
> alias "foo" and we ship "git-foo" in a newer version of git, your alias
> will just stop working.
That was my point. At least if there were warnings about this the risk
would be mitigated.
cheers,
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 10:55 ` demerphq
@ 2009-07-18 10:58 ` Jeff King
2009-07-18 11:20 ` demerphq
0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2009-07-18 10:58 UTC (permalink / raw)
To: demerphq; +Cc: Michael G Schwern, Sean Estabrooks, git
On Sat, Jul 18, 2009 at 12:55:26PM +0200, demerphq wrote:
> > The silentness makes it harder to diagnose problems, but even with a
> > warning, we can break things by creating new commands. If you have an
> > alias "foo" and we ship "git-foo" in a newer version of git, your alias
> > will just stop working.
>
> That was my point. At least if there were warnings about this the risk
> would be mitigated.
I don't see how it's mitigated. You don't get any warning until _after_
things are broken. So yes, it may help you diagnose the breakage, but
presumably the fact that the command is doing something completely
different would also alert you to the breakage.
The real problem comes from scripted use, where you don't necessarily
have a user reading warnings on stderr, or notice that some totally
bogus code is being run (especially if said code happens not to produce
a non-zero exit code).
But perhaps that's what you meant, and I'm just nitpicking your
language.
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 10:58 ` Jeff King
@ 2009-07-18 11:20 ` demerphq
2009-07-18 16:12 ` A Large Angry SCM
0 siblings, 1 reply; 9+ messages in thread
From: demerphq @ 2009-07-18 11:20 UTC (permalink / raw)
To: Jeff King; +Cc: Michael G Schwern, Sean Estabrooks, git
2009/7/18 Jeff King <peff@peff.net>:
> On Sat, Jul 18, 2009 at 12:55:26PM +0200, demerphq wrote:
>
>> > The silentness makes it harder to diagnose problems, but even with a
>> > warning, we can break things by creating new commands. If you have an
>> > alias "foo" and we ship "git-foo" in a newer version of git, your alias
>> > will just stop working.
>>
>> That was my point. At least if there were warnings about this the risk
>> would be mitigated.
>
> I don't see how it's mitigated. You don't get any warning until _after_
> things are broken. So yes, it may help you diagnose the breakage, but
> presumably the fact that the command is doing something completely
> different would also alert you to the breakage.
>
> The real problem comes from scripted use, where you don't necessarily
> have a user reading warnings on stderr, or notice that some totally
> bogus code is being run (especially if said code happens not to produce
> a non-zero exit code).
>
> But perhaps that's what you meant, and I'm just nitpicking your
> language.
I think we are more or less in agreement, except maybe that i think
the situation would be marginally better if git detected this.
:-)
Seems an awkward position actually. Maybe a switch like
--ignore-command-aliases which would be used by all internal commands
when they expect to find another internal command would resolve it.
Then aliases of internal commands to control default switches could
actually be allowed to work, and there would not be the future
compatibility trap that there seems to be now.
cheers,
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: git silently ignores aliases of existing commands
2009-07-18 11:20 ` demerphq
@ 2009-07-18 16:12 ` A Large Angry SCM
0 siblings, 0 replies; 9+ messages in thread
From: A Large Angry SCM @ 2009-07-18 16:12 UTC (permalink / raw)
To: demerphq; +Cc: Jeff King, Michael G Schwern, Sean Estabrooks, git
demerphq wrote:
> 2009/7/18 Jeff King <peff@peff.net>:
>> On Sat, Jul 18, 2009 at 12:55:26PM +0200, demerphq wrote:
>>
>>>> The silentness makes it harder to diagnose problems, but even with a
>>>> warning, we can break things by creating new commands. If you have an
>>>> alias "foo" and we ship "git-foo" in a newer version of git, your alias
>>>> will just stop working.
>>> That was my point. At least if there were warnings about this the risk
>>> would be mitigated.
>> I don't see how it's mitigated. You don't get any warning until _after_
>> things are broken. So yes, it may help you diagnose the breakage, but
>> presumably the fact that the command is doing something completely
>> different would also alert you to the breakage.
>>
>> The real problem comes from scripted use, where you don't necessarily
>> have a user reading warnings on stderr, or notice that some totally
>> bogus code is being run (especially if said code happens not to produce
>> a non-zero exit code).
>>
>> But perhaps that's what you meant, and I'm just nitpicking your
>> language.
>
> I think we are more or less in agreement, except maybe that i think
> the situation would be marginally better if git detected this.
>
> :-)
>
> Seems an awkward position actually. Maybe a switch like
> --ignore-command-aliases which would be used by all internal commands
> when they expect to find another internal command would resolve it.
> Then aliases of internal commands to control default switches could
> actually be allowed to work, and there would not be the future
> compatibility trap that there seems to be now.
The real solution is to (re)move the aliases from the git name-space.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-07-18 16:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-18 0:52 git silently ignores aliases of existing commands Michael G Schwern
2009-07-18 2:01 ` Sean Estabrooks
2009-07-18 7:16 ` Michael G Schwern
2009-07-18 9:30 ` demerphq
2009-07-18 10:46 ` Jeff King
2009-07-18 10:55 ` demerphq
2009-07-18 10:58 ` Jeff King
2009-07-18 11:20 ` demerphq
2009-07-18 16:12 ` A Large Angry SCM
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).