From: Christoph Anton Mitterer <calestyo@scientia•org>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org
Subject: Re: why can't one alias `git stash`?
Date: Tue, 19 Aug 2025 23:38:35 +0200 [thread overview]
Message-ID: <67090cec91d92af5616651de29950ecb3e8810f6.camel@scientia.org> (raw)
In-Reply-To: <xmqqh5y4gm4v.fsf@gitster.g>
On Mon, 2025-08-18 at 18:01 -0700, Junio C Hamano wrote:
> As a program, how would you tell when you are run by a script?
>
> If you are a shell, you go into "interactive" mode when you are
> taking your command stream from a tty, and otherwise assume you are
> not interactive. The same trick would not work at all for programs
> started by a shell, would it?
Not for all, but it might still give enough "teaching" to prevent
people from using aliases in scripts.
Checking whether the parent process is a well known shell would
probably not help, as it would also be for the interactive case, where
aliasing is wanted.
> Asking script writers to pass "--no-alias" option to all of their
> "git" invocation will probably not be a viable way forward, either.
Again at least not a safe one. And doing the opposite, i.e. requring --
enable-aliasing (which people would then have to set as shell alias),
would probably end up in generating quite a few annoyed people. ;-)
It could be made optional. E.g. some gitconf option that per default
enables aliasing always but allows to require a --aliasing option
(which then again is intended to be set via a shell alias) in order for
git aliasing to be enabled.
Whether it's worth the effort is of course another question.
Cheers,
Chris.
next prev parent reply other threads:[~2025-08-19 21:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 0:33 why can't one alias `git stash`? Christoph Anton Mitterer
2025-08-15 1:23 ` Junio C Hamano
2025-08-15 2:02 ` Christoph Anton Mitterer
2025-08-15 4:04 ` Elijah Newren
2025-08-15 11:22 ` rsbecker
2025-08-16 2:03 ` Christoph Anton Mitterer
2025-08-15 15:27 ` Junio C Hamano
2025-08-16 2:11 ` Christoph Anton Mitterer
2025-08-16 9:15 ` Matthias Aßhauer
2025-08-19 1:01 ` Junio C Hamano
2025-08-19 21:38 ` Christoph Anton Mitterer [this message]
2025-08-16 1:35 ` Christoph Anton Mitterer
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=67090cec91d92af5616651de29950ecb3e8810f6.camel@scientia.org \
--to=calestyo@scientia$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox