{"thread":{"id":"18183","subject":"allowing aliases to override builtins to support default options","startedAt":"2009-03-06T22:30:43Z","lastAt":"2009-03-07T03:10:31Z","messageCount":7,"participants":["Jay Soffian","Sverre Rabbelier","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"107248","messageId":"76718490903061430s2fbea2dfibe06282fd22b1588@mail.gmail.com","threadId":"18183","inReplyTo":null,"subject":"allowing aliases to override builtins to support default options","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-06T22:30:43Z","receivedAt":"2009-03-06T22:30:43Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Currently git does not allow aliases to override builtins. I\nunderstand the reasoning behind this, but I wonder if it's overly\nconservative.\n\nMost shells support overriding commands with aliases, and I'm not sure\nwhy git needs to be more conservative than the shell. (Although, I\nwill say, I hate when vendors alias rm to \"rm -i\", etc...)\n\nIt seems like this would be an elegant way to support default options.\nWere it to be supported, it should probably have an escape hatch, such\nas git --no-alias COMMAND, and it should probably only apply to\nporcelains.\n\nThoughts?\n\nj.\n"},{"id":"107249","messageId":"fabb9a1e0903061437t2df5620bn58c6c087214f994b@mail.gmail.com","threadId":"18183","inReplyTo":"76718490903061430s2fbea2dfibe06282fd22b1588@mail.gmail.com","subject":"Re: allowing aliases to override builtins to support default options","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-03-06T22:37:30Z","receivedAt":"2009-03-06T22:37:30Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Mar 6, 2009 at 23:30, Jay Soffian <jaysoffian@gmail.com> wrote:\n> Most shells support overriding commands with aliases, and I'm not sure\n> why git needs to be more conservative than the shell. (Although, I\n> will say, I hate when vendors alias rm to \"rm -i\", etc...)\n\nHmmm, maybe we could require marking such an alias somehow, to signify\nthat you're aware that you're overriding a builtin? Also, what would\nwe do the alias 'foo' calling 'git foo'? Does it call the original\ncommand, or itself?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"107254","messageId":"7vhc26qls3.fsf@gitster.siamese.dyndns.org","threadId":"18183","inReplyTo":"76718490903061430s2fbea2dfibe06282fd22b1588@mail.gmail.com","subject":"Re: allowing aliases to override builtins to support default options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-06T23:22:36Z","receivedAt":"2009-03-06T23:22:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> Currently git does not allow aliases to override builtins. I\n> understand the reasoning behind this, but I wonder if it's overly\n> conservative.\n\nIt is not.\n\n> Most shells support overriding commands with aliases, and I'm not sure\n> why git needs to be more conservative than the shell.\n\nBecause sane shells do not expand aliases when used in a script, and gives\na handy way to defeat the alias even from the command line.\n\n    $ alias ls='ls -aF'\n    $ echo ls >script\n    $ chmod +x script\n\nand compare:\n\n    $ ./script\n    $ ls\n    $ /bin/ls\n"},{"id":"107255","messageId":"76718490903061551m24a95ed8r2e334ff0e6f0fcf3@mail.gmail.com","threadId":"18183","inReplyTo":"7vhc26qls3.fsf@gitster.siamese.dyndns.org","subject":"Re: allowing aliases to override builtins to support default options","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-06T23:51:22Z","receivedAt":"2009-03-06T23:51:22Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Fri, Mar 6, 2009 at 6:22 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Because sane shells do not expand aliases when used in a script, and gives\n> a handy way to defeat the alias even from the command line.\n>\n>    $ alias ls='ls -aF'\n>    $ echo ls >script\n>    $ chmod +x script\n>\n> and compare:\n>\n>    $ ./script\n>    $ ls\n>    $ /bin/ls\n\nUnderstood. And if git could do the same, still no?\n\nj.\n"},{"id":"107265","messageId":"alpine.DEB.1.00.0903070336200.10279@pacific.mpi-cbg.de","threadId":"18183","inReplyTo":"76718490903061430s2fbea2dfibe06282fd22b1588@mail.gmail.com","subject":"Re: allowing aliases to override builtins to support default options","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-07T02:37:33Z","receivedAt":"2009-03-07T02:37:33Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 6 Mar 2009, Jay Soffian wrote:\n\n> Currently git does not allow aliases to override builtins. I understand \n> the reasoning behind this, but I wonder if it's overly conservative.\n> \n> Most shells support overriding commands with aliases, and I'm not sure \n> why git needs to be more conservative than the shell. (Although, I will \n> say, I hate when vendors alias rm to \"rm -i\", etc...)\n> \n> It seems like this would be an elegant way to support default options.\n\nWhat you dream about breaks a lot of scripts.\n\nSo while it might be nice for you, you would make life of others much, \nmuch, much harder.  Not nice at all.\n\nCiao,\nDscho\n"},{"id":"107271","messageId":"76718490903061857y5446098by3633559697508c2e@mail.gmail.com","threadId":"18183","inReplyTo":"alpine.DEB.1.00.0903070336200.10279@pacific.mpi-cbg.de","subject":"Re: allowing aliases to override builtins to support default options","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-07T02:57:08Z","receivedAt":"2009-03-07T02:57:08Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Fri, Mar 6, 2009 at 9:37 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> What you dream about breaks a lot of scripts.\n\nI said I understood the implications.\n\n> So while it might be nice for you, you would make life of others much,\n> much, much harder.  Not nice at all.\n\nThis is not something I am dreaming about, and I'm only interested to\nthe extent that it improves git w/o hindering existing users. I'm\ncertainly not aiming to be not nice to anyone!\n\nFor example, what if:\n\n1. The aliases applied only to porcelain commands, not to plumbing.\n2. The aliases worked only if stdout was a terminal, using the same\nmethod that git uses for detecting when it is okay to start a pager.\n3. git took --alias-builtins and --no-alias-builtins just like it\ntakes --paginate and --no-pager to override (2).\n\nj.\n"},{"id":"107272","messageId":"alpine.DEB.1.00.0903070407480.10279@pacific.mpi-cbg.de","threadId":"18183","inReplyTo":"76718490903061857y5446098by3633559697508c2e@mail.gmail.com","subject":"Re: allowing aliases to override builtins to support default options","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-07T03:10:31Z","receivedAt":"2009-03-07T03:10:31Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 6 Mar 2009, Jay Soffian wrote:\n\n> For example, what if:\n> \n> 1. The aliases applied only to porcelain commands, not to plumbing.\n\nInconsistency like this is bad for a couple of reasons.  Just 3 out of \nthem:\n\n- it makes it hard for users to understand,\n\n- it is prone for subtle breakages,\n\n- the code will be complicated, and therefore ugly.\n\n> 2. The aliases worked only if stdout was a terminal, using the same \n>    method that git uses for detecting when it is okay to start a pager.\n\nThis would be even more complicated to understand for the regular Git user \nwho just wants to use the darned thing and not care about its internals.\n\n> 3. git took --alias-builtins and --no-alias-builtins just like it takes \n>    --paginate and --no-pager to override (2).\n\nAnd this makes it even more complicated.\n\nI'd rather stay with our current notion that aliases cannot override Git \nprograms.  This is _very_ easy to explain, and also _very_ easy to defend.\n\nCiao,\nDscho\n"}]}