All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "Francis Moreau" <francis.moro@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git-send-email and aliases
Date: Tue, 27 Mar 2007 03:29:37 -0700	[thread overview]
Message-ID: <7vircnou7i.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 38b2ab8a0703270238n655bdee1kac227a6675261210@mail.gmail.com

"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.

  reply	other threads:[~2007-03-27 10:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vircnou7i.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=francis.moro@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.