All of lore.kernel.org
 help / color / mirror / Atom feed
* git-send-email and aliases
@ 2007-03-26  9:39 Francis Moreau
  2007-03-26  9:47 ` Junio C Hamano
  2007-03-26 10:08 ` Nicolas Vilz
  0 siblings, 2 replies; 11+ messages in thread
From: Francis Moreau @ 2007-03-26  9:39 UTC (permalink / raw)
  To: git

Hi,

I'm trying to make an alias for 'git send-email' as following but it's
not working:

[alias]
	send-email = send-email --no-signed-off-cc --suppress-from

Is it failing because git-send-email is an external command ?

Thanks
-- 
Francis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-26  9:39 git-send-email and aliases Francis Moreau
@ 2007-03-26  9:47 ` Junio C Hamano
  2007-03-26  9:57   ` Francis Moreau
  2007-03-27  9:38   ` Francis Moreau
  2007-03-26 10:08 ` Nicolas Vilz
  1 sibling, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2007-03-26  9:47 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

"Francis Moreau" <francis.moro@gmail.com> writes:

> Hi,
>
> I'm trying to make an alias for 'git send-email' as following but it's
> not working:
>
> [alias]
> 	send-email = send-email --no-signed-off-cc --suppress-from
>
> Is it failing because git-send-email is an external command ?

$ sed -ne '/^alias\.\*/,/^$/p' Documentation/config.txt

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-26  9:47 ` Junio C Hamano
@ 2007-03-26  9:57   ` Francis Moreau
  2007-03-27  9:38   ` Francis Moreau
  1 sibling, 0 replies; 11+ messages in thread
From: Francis Moreau @ 2007-03-26  9:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 3/26/07, Junio C Hamano <junkio@cox.net> wrote:
>
> $ sed -ne '/^alias\.\*/,/^$/p' Documentation/config.txt
>

oops sorry. I was so thinking about bash aliases that I didn't take a
look to the documentation.

sorry again.
-- 
Francis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-26  9:39 git-send-email and aliases Francis Moreau
  2007-03-26  9:47 ` Junio C Hamano
@ 2007-03-26 10:08 ` Nicolas Vilz
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Vilz @ 2007-03-26 10:08 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

On Mon, Mar 26, 2007 at 11:39:52AM +0200, Francis Moreau wrote:
> Hi,
> 
> I'm trying to make an alias for 'git send-email' as following but it's
> not working:
> 
> [alias]
> 	send-email = send-email --no-signed-off-cc --suppress-from
> 
> Is it failing because git-send-email is an external command ?

i remember that if this command exists in git (built-in or script), then
the built-in is used, for not breaking any scripts. I think, if you set
sm or s-m or something like that, it would work.

Sincerly
Nicolas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-26  9:47 ` Junio C Hamano
  2007-03-26  9:57   ` Francis Moreau
@ 2007-03-27  9:38   ` Francis Moreau
  2007-03-27 10:29     ` Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: Francis Moreau @ 2007-03-27  9:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 3/26/07, Junio C Hamano <junkio@cox.net> wrote:
> > [alias]
> >       send-email = send-email --no-signed-off-cc --suppress-from
> >
> > Is it failing because git-send-email is an external command ?
>
> $ sed -ne '/^alias\.\*/,/^$/p' Documentation/config.txt
>

That said I think it's not really convenient. I'll end up doing:

[aliases]
    my-send-email = send-email --no-signed-off-cc --suppress-from
    my-am = am -3 -s

etc...

Isn't possible to mimic bash alias handling:. From man: "Aliases are
not expanded when the shell is not interactive,... "

IOW is it possible for git to know if it has been invoked interactively ?

thanks
-- 
Francis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-27  9:38   ` Francis Moreau
@ 2007-03-27 10:29     ` Junio C Hamano
  2007-03-27 10:46       ` Jeff King
  2007-03-27 16:08       ` Francis Moreau
  0 siblings, 2 replies; 11+ messages in thread
From: Junio C Hamano @ 2007-03-27 10:29 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git

"Francis Moreau" <francis.moro@gmail.com> writes:

> On 3/26/07, Junio C Hamano <junkio@cox.net> wrote:
>> > [alias]
>> >       send-email = send-email --no-signed-off-cc --suppress-from
>> >
>> > Is it failing because git-send-email is an external command ?
>>
>> $ sed -ne '/^alias\.\*/,/^$/p' Documentation/config.txt
>
> That said I think it's not really convenient. I'll end up doing:
>
> [aliases]
>    my-send-email = send-email --no-signed-off-cc --suppress-from
>    my-am = am -3 -s
>
> etc...
>
> Isn't possible to mimic bash alias handling:. From man: "Aliases are
> not expanded when the shell is not interactive,... "
>
> IOW is it possible for git to know if it has been invoked interactively ?

I do not think so, but I think alias expanding "git foo" while
not expanding "git-foo" should not be too hard.  You need two
extra preparation steps for such a change to be useful, though.

 (1) Build with $(gitexecdir) set to outside the usual $PATH
     (/usr/libexec/git was suggested in the past) to make sure
     we still support that configuration.  Under this model,
     only a handful programs ("git" wrapper itself and "gitk")
     should be installed on user's PATH and everything else goes
     under $(gitexecdir).  The user's interactive session MUST
     run "git foo" and not "git-foo" as bulk of the stuff is now
     outside of $PATH.  Fix any breakage if found (I do not
     expect many, but there might be some problems around object
     transfers, such as git-daemon spawning git-upload-pack, or
     git-push running git-receive-pack on the other end of the
     connection).

 (2) Audit all our scripts so that they run git commands with
     "git-foo" form, not "git foo" form.  As "git" wrapper is
     supposed to add $(gitexecdir) early in the $PATH while it
     runs itself and its subprocesses, they should find the true
     "git-foo" binary even after $(gitexecdir) is set outside of
     the usual $PATH.  Make sure things still work.

After the above two steps is done, we can be confident that the
scripts will not be broken even if we allow a user to say
something silly like "alias.cat-file = log --stat", as the
scripts will never say "git cat-file" to cause the command to be
expanded to "git log --stat" (instead they say "git-cat-file",
thanks to your audit in step (2)), thusly avoid the confusion.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-27 10:29     ` Junio C Hamano
@ 2007-03-27 10:46       ` Jeff King
  2007-03-27 10:59         ` Junio C Hamano
  2007-03-27 16:08       ` Francis Moreau
  1 sibling, 1 reply; 11+ messages in thread
From: Jeff King @ 2007-03-27 10:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Francis Moreau, git

On Tue, Mar 27, 2007 at 03:29:37AM -0700, Junio C Hamano wrote:

> > Isn't possible to mimic bash alias handling:. From man: "Aliases are
> > not expanded when the shell is not interactive,... "
> I do not think so, but I think alias expanding "git foo" while
> not expanding "git-foo" should not be too hard.  You need two
> extra preparation steps for such a change to be useful, though.

Might it not be easier to simply add a GIT_NOALIAS variable, and set it
at the top of all git programs?

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-27 10:46       ` Jeff King
@ 2007-03-27 10:59         ` Junio C Hamano
  2007-03-27 11:02           ` Jeff King
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2007-03-27 10:59 UTC (permalink / raw)
  To: Jeff King; +Cc: Francis Moreau, git

Jeff King <peff@peff.net> writes:

> Might it not be easier to simply add a GIT_NOALIAS variable, and set it
> at the top of all git programs?

It might be easier but I do not think that is useful.  When
git-commit runs the $EDITOR for the commit log message, I think
people would expect (if you are using vi) "!!git log" to honor
their alias.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-27 10:59         ` Junio C Hamano
@ 2007-03-27 11:02           ` Jeff King
  2007-03-28  1:52             ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff King @ 2007-03-27 11:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Francis Moreau, git

On Tue, Mar 27, 2007 at 03:59:19AM -0700, Junio C Hamano wrote:

> It might be easier but I do not think that is useful.  When
> git-commit runs the $EDITOR for the commit log message, I think
> people would expect (if you are using vi) "!!git log" to honor
> their alias.

Then git-commit can unset GIT_NOALIAS when it expects to call into
"user" code such as the editor.

A potentially bigger problem with any such scheme is that non-git
scripts would have to set GIT_NOALIAS. Not a big deal for new scripts,
but it might break old scripts.

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-27 10:29     ` Junio C Hamano
  2007-03-27 10:46       ` Jeff King
@ 2007-03-27 16:08       ` Francis Moreau
  1 sibling, 0 replies; 11+ messages in thread
From: Francis Moreau @ 2007-03-27 16:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 3/27/07, Junio C Hamano <junkio@cox.net> wrote:
> "Francis Moreau" <francis.moro@gmail.com> writes:
> > IOW is it possible for git to know if it has been invoked interactively ?
>
> I do not think so, but I think alias expanding "git foo" while
> not expanding "git-foo" should not be too hard.  You need two
> extra preparation steps for such a change to be useful, though.
>

Isn't that too dangerous to rely on the fact that scripts will always
use "git-foo" syntax ?
-- 
Francis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git-send-email and aliases
  2007-03-27 11:02           ` Jeff King
@ 2007-03-28  1:52             ` Junio C Hamano
  0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2007-03-28  1:52 UTC (permalink / raw)
  To: Jeff King; +Cc: Francis Moreau, git

Jeff King <peff@peff.net> writes:

> On Tue, Mar 27, 2007 at 03:59:19AM -0700, Junio C Hamano wrote:
>
>> It might be easier but I do not think that is useful.  When
>> git-commit runs the $EDITOR for the commit log message, I think
>> people would expect (if you are using vi) "!!git log" to honor
>> their alias.
>
> Then git-commit can unset GIT_NOALIAS when it expects to call into
> "user" code such as the editor.

Surely, but then it is not just a matter of "setting GIT_NOALIAS
at the top of all git programs" anymore.  You need to audit the
code.

> A potentially bigger problem with any such scheme is that non-git
> scripts would have to set GIT_NOALIAS. Not a big deal for new scripts,
> but it might break old scripts.

You are right.  Both GIT_NOALIAS and "write git-foo if you do
not want to be affected with alias" would fail that.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-03-28  1:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-26  9:39 git-send-email and aliases Francis Moreau
2007-03-26  9:47 ` Junio C Hamano
2007-03-26  9:57   ` Francis Moreau
2007-03-27  9:38   ` Francis Moreau
2007-03-27 10:29     ` Junio C Hamano
2007-03-27 10:46       ` Jeff King
2007-03-27 10:59         ` Junio C Hamano
2007-03-27 11:02           ` Jeff King
2007-03-28  1:52             ` Junio C Hamano
2007-03-27 16:08       ` Francis Moreau
2007-03-26 10:08 ` Nicolas Vilz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.