{"thread":{"id":"7408","subject":"git-send-email and aliases","startedAt":"2007-03-26T09:39:52Z","lastAt":"2007-03-28T01:52:33Z","messageCount":11,"participants":["Francis Moreau","Junio C Hamano","Nicolas Vilz","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"38018","messageId":"38b2ab8a0703260239j3f3f0be2teee70fc502f6f7c1@mail.gmail.com","threadId":"7408","inReplyTo":null,"subject":"git-send-email and aliases","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2007-03-26T09:39:52Z","receivedAt":"2007-03-26T09:39:52Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Hi,\n\nI'm trying to make an alias for 'git send-email' as following but it's\nnot working:\n\n[alias]\n\tsend-email = send-email --no-signed-off-cc --suppress-from\n\nIs it failing because git-send-email is an external command ?\n\nThanks\n-- \nFrancis\n"},{"id":"38019","messageId":"7vwt14wd38.fsf@assigned-by-dhcp.cox.net","threadId":"7408","inReplyTo":"38b2ab8a0703260239j3f3f0be2teee70fc502f6f7c1@mail.gmail.com","subject":"Re: git-send-email and aliases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-26T09:47:39Z","receivedAt":"2007-03-26T09:47:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Francis Moreau\" <francis.moro@gmail.com> writes:\n\n> Hi,\n>\n> I'm trying to make an alias for 'git send-email' as following but it's\n> not working:\n>\n> [alias]\n> \tsend-email = send-email --no-signed-off-cc --suppress-from\n>\n> Is it failing because git-send-email is an external command ?\n\n$ sed -ne '/^alias\\.\\*/,/^$/p' Documentation/config.txt\n"},{"id":"38020","messageId":"38b2ab8a0703260257i29d374f9kb63dc18aad0572b8@mail.gmail.com","threadId":"7408","inReplyTo":"7vwt14wd38.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-send-email and aliases","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2007-03-26T09:57:59Z","receivedAt":"2007-03-26T09:57:59Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On 3/26/07, Junio C Hamano <junkio@cox.net> wrote:\n>\n> $ sed -ne '/^alias\\.\\*/,/^$/p' Documentation/config.txt\n>\n\noops sorry. I was so thinking about bash aliases that I didn't take a\nlook to the documentation.\n\nsorry again.\n-- \nFrancis\n"},{"id":"38028","messageId":"20070326100849.GA5822@fry.bender.fht","threadId":"7408","inReplyTo":"38b2ab8a0703260239j3f3f0be2teee70fc502f6f7c1@mail.gmail.com","subject":"Re: git-send-email and aliases","fromName":"Nicolas Vilz","fromEmail":"niv@iaglans.de","sentAt":"2007-03-26T10:08:49Z","receivedAt":"2007-03-26T10:08:49Z","isPatch":false,"sender":{"key":"niv@iaglans.de","avatar":"https://gravatar.com/avatar/e4d43a32d721241212d4edb1d2210327e28423c913071b4bfeeaa0ce15296110?d=mp&s=160"},"body":"On Mon, Mar 26, 2007 at 11:39:52AM +0200, Francis Moreau wrote:\n> Hi,\n> \n> I'm trying to make an alias for 'git send-email' as following but it's\n> not working:\n> \n> [alias]\n> \tsend-email = send-email --no-signed-off-cc --suppress-from\n> \n> Is it failing because git-send-email is an external command ?\n\ni remember that if this command exists in git (built-in or script), then\nthe built-in is used, for not breaking any scripts. I think, if you set\nsm or s-m or something like that, it would work.\n\nSincerly\nNicolas\n"},{"id":"38121","messageId":"38b2ab8a0703270238n655bdee1kac227a6675261210@mail.gmail.com","threadId":"7408","inReplyTo":"7vwt14wd38.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-send-email and aliases","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2007-03-27T09:38:51Z","receivedAt":"2007-03-27T09:38:51Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On 3/26/07, Junio C Hamano <junkio@cox.net> wrote:\n> > [alias]\n> >       send-email = send-email --no-signed-off-cc --suppress-from\n> >\n> > Is it failing because git-send-email is an external command ?\n>\n> $ sed -ne '/^alias\\.\\*/,/^$/p' Documentation/config.txt\n>\n\nThat said I think it's not really convenient. I'll end up doing:\n\n[aliases]\n    my-send-email = send-email --no-signed-off-cc --suppress-from\n    my-am = am -3 -s\n\netc...\n\nIsn't possible to mimic bash alias handling:. From man: \"Aliases are\nnot expanded when the shell is not interactive,... \"\n\nIOW is it possible for git to know if it has been invoked interactively ?\n\nthanks\n-- \nFrancis\n"},{"id":"38129","messageId":"7vircnou7i.fsf@assigned-by-dhcp.cox.net","threadId":"7408","inReplyTo":"38b2ab8a0703270238n655bdee1kac227a6675261210@mail.gmail.com","subject":"Re: git-send-email and aliases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-27T10:29:37Z","receivedAt":"2007-03-27T10:29:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Francis Moreau\" <francis.moro@gmail.com> writes:\n\n> On 3/26/07, Junio C Hamano <junkio@cox.net> wrote:\n>> > [alias]\n>> >       send-email = send-email --no-signed-off-cc --suppress-from\n>> >\n>> > Is it failing because git-send-email is an external command ?\n>>\n>> $ sed -ne '/^alias\\.\\*/,/^$/p' Documentation/config.txt\n>\n> That said I think it's not really convenient. I'll end up doing:\n>\n> [aliases]\n>    my-send-email = send-email --no-signed-off-cc --suppress-from\n>    my-am = am -3 -s\n>\n> etc...\n>\n> Isn't possible to mimic bash alias handling:. From man: \"Aliases are\n> not expanded when the shell is not interactive,... \"\n>\n> IOW is it possible for git to know if it has been invoked interactively ?\n\nI do not think so, but I think alias expanding \"git foo\" while\nnot expanding \"git-foo\" should not be too hard.  You need two\nextra preparation steps for such a change to be useful, though.\n\n (1) Build with $(gitexecdir) set to outside the usual $PATH\n     (/usr/libexec/git was suggested in the past) to make sure\n     we still support that configuration.  Under this model,\n     only a handful programs (\"git\" wrapper itself and \"gitk\")\n     should be installed on user's PATH and everything else goes\n     under $(gitexecdir).  The user's interactive session MUST\n     run \"git foo\" and not \"git-foo\" as bulk of the stuff is now\n     outside of $PATH.  Fix any breakage if found (I do not\n     expect many, but there might be some problems around object\n     transfers, such as git-daemon spawning git-upload-pack, or\n     git-push running git-receive-pack on the other end of the\n     connection).\n\n (2) Audit all our scripts so that they run git commands with\n     \"git-foo\" form, not \"git foo\" form.  As \"git\" wrapper is\n     supposed to add $(gitexecdir) early in the $PATH while it\n     runs itself and its subprocesses, they should find the true\n     \"git-foo\" binary even after $(gitexecdir) is set outside of\n     the usual $PATH.  Make sure things still work.\n\nAfter the above two steps is done, we can be confident that the\nscripts will not be broken even if we allow a user to say\nsomething silly like \"alias.cat-file = log --stat\", as the\nscripts will never say \"git cat-file\" to cause the command to be\nexpanded to \"git log --stat\" (instead they say \"git-cat-file\",\nthanks to your audit in step (2)), thusly avoid the confusion.\n"},{"id":"38136","messageId":"20070327104623.GA26796@sigill.intra.peff.net","threadId":"7408","inReplyTo":"7vircnou7i.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-send-email and aliases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-27T10:46:23Z","receivedAt":"2007-03-27T10:46:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 03:29:37AM -0700, Junio C Hamano wrote:\n\n> > Isn't possible to mimic bash alias handling:. From man: \"Aliases are\n> > not expanded when the shell is not interactive,... \"\n> I do not think so, but I think alias expanding \"git foo\" while\n> not expanding \"git-foo\" should not be too hard.  You need two\n> extra preparation steps for such a change to be useful, though.\n\nMight it not be easier to simply add a GIT_NOALIAS variable, and set it\nat the top of all git programs?\n\n-Peff\n"},{"id":"38139","messageId":"7vlkhjne9k.fsf@assigned-by-dhcp.cox.net","threadId":"7408","inReplyTo":"20070327104623.GA26796@sigill.intra.peff.net","subject":"Re: git-send-email and aliases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-27T10:59:19Z","receivedAt":"2007-03-27T10:59:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Might it not be easier to simply add a GIT_NOALIAS variable, and set it\n> at the top of all git programs?\n\nIt might be easier but I do not think that is useful.  When\ngit-commit runs the $EDITOR for the commit log message, I think\npeople would expect (if you are using vi) \"!!git log\" to honor\ntheir alias.\n"},{"id":"38140","messageId":"20070327110246.GA30217@sigill.intra.peff.net","threadId":"7408","inReplyTo":"7vlkhjne9k.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-send-email and aliases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-27T11:02:46Z","receivedAt":"2007-03-27T11:02:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 03:59:19AM -0700, Junio C Hamano wrote:\n\n> It might be easier but I do not think that is useful.  When\n> git-commit runs the $EDITOR for the commit log message, I think\n> people would expect (if you are using vi) \"!!git log\" to honor\n> their alias.\n\nThen git-commit can unset GIT_NOALIAS when it expects to call into\n\"user\" code such as the editor.\n\nA potentially bigger problem with any such scheme is that non-git\nscripts would have to set GIT_NOALIAS. Not a big deal for new scripts,\nbut it might break old scripts.\n\n-Peff\n"},{"id":"38157","messageId":"38b2ab8a0703270908y331a372du7cd340f1d884456d@mail.gmail.com","threadId":"7408","inReplyTo":"7vircnou7i.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-send-email and aliases","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2007-03-27T16:08:12Z","receivedAt":"2007-03-27T16:08:12Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On 3/27/07, Junio C Hamano <junkio@cox.net> wrote:\n> \"Francis Moreau\" <francis.moro@gmail.com> writes:\n> > IOW is it possible for git to know if it has been invoked interactively ?\n>\n> I do not think so, but I think alias expanding \"git foo\" while\n> not expanding \"git-foo\" should not be too hard.  You need two\n> extra preparation steps for such a change to be useful, though.\n>\n\nIsn't that too dangerous to rely on the fact that scripts will always\nuse \"git-foo\" syntax ?\n-- \nFrancis\n"},{"id":"38221","messageId":"7vk5x2m8wu.fsf@assigned-by-dhcp.cox.net","threadId":"7408","inReplyTo":"20070327110246.GA30217@sigill.intra.peff.net","subject":"Re: git-send-email and aliases","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-28T01:52:33Z","receivedAt":"2007-03-28T01:52:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Mar 27, 2007 at 03:59:19AM -0700, Junio C Hamano wrote:\n>\n>> It might be easier but I do not think that is useful.  When\n>> git-commit runs the $EDITOR for the commit log message, I think\n>> people would expect (if you are using vi) \"!!git log\" to honor\n>> their alias.\n>\n> Then git-commit can unset GIT_NOALIAS when it expects to call into\n> \"user\" code such as the editor.\n\nSurely, but then it is not just a matter of \"setting GIT_NOALIAS\nat the top of all git programs\" anymore.  You need to audit the\ncode.\n\n> A potentially bigger problem with any such scheme is that non-git\n> scripts would have to set GIT_NOALIAS. Not a big deal for new scripts,\n> but it might break old scripts.\n\nYou are right.  Both GIT_NOALIAS and \"write git-foo if you do\nnot want to be affected with alias\" would fail that.\n"}]}