Re: git-send-email and aliases

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: git-send-email and aliases

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:01

"Francis Moreau" [off-list ref] 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

Re: git-send-email and aliases

From: Francis Moreau <hidden>
Date: 2016-06-15 22:43:01

On 3/26/07, Junio C Hamano [off-list ref] 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

Re: git-send-email and aliases

From: Francis Moreau <hidden>
Date: 2016-06-15 22:43:01

On 3/26/07, Junio C Hamano [off-list ref] wrote:
quoted
[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

Re: git-send-email and aliases

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:01

"Francis Moreau" [off-list ref] writes:
On 3/26/07, Junio C Hamano [off-list ref] wrote:
quoted
quoted
[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.

Re: git-send-email and aliases

From: Jeff King <hidden>
Date: 2016-06-15 22:43:01

On Tue, Mar 27, 2007 at 03:29:37AM -0700, Junio C Hamano wrote:
quoted
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

Re: git-send-email and aliases

From: Francis Moreau <hidden>
Date: 2016-06-15 22:43:01

On 3/27/07, Junio C Hamano [off-list ref] wrote:
"Francis Moreau" [off-list ref] writes:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help