From: <rsbecker@nexbridge•com>
To: "'Junio C Hamano'" <gitster@pobox•com>
Cc: "'Carlo Arenas'" <carenas@gmail•com>, <git@vger•kernel.org>
Subject: RE: preparing for 2.34.1
Date: Mon, 22 Nov 2021 18:51:34 -0500 [thread overview]
Message-ID: <039401d7dffb$e5198800$af4c9800$@nexbridge.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2111230025440.63@tvgsbejvaqbjf.bet>
On November 22, 2021 6:30 PM, Johannes Schindelin wrote:
> On Mon, 22 Nov 2021, Junio C Hamano wrote:
>
> > Johannes Schindelin <Johannes.Schindelin@gmx•de> writes:
> >
> > > The quickest workaround for this is probably to special-case the
> > > editor
> > > `echo`:
> >
> > "GIT_EDITOR=: git cmd" would also be a common trick people would use
> > to bypass editor and take whatever is given as an initial template.
>
> GIT_EDITOR=: is not a problem because of
> https://github.com/git/git/blob/v2.34.0/editor.c#L59:
>
> if (strcmp(editor, ":")) {
> [...]
> term_fail = save_term(1);
> if (start_command(&p) < 0) {
> if (!term_fail)
> restore_term();
> [...]
> }
>
> [...]
> if (!term_fail)
> restore_term();
> [...]
> }
>
> > > However, I could imagine that other scenarios call for an editor
> > > that _also_ does not run in the terminal, and where also no real
> > > terminal is available for saving and restoring.
> > >
> > > I was tempted to suggest an `isatty(2)`, but that probably comes
> > > with its own problems, too.
> >
> > I think isatty(2) is pretty much our synonym to "are we talking to an
> > end-user sitting in front of the terminal". Mostly we use it as a way
> > to control the progress bars, and use of editor on terminal would be
> > in line with these existing uses.
>
> Indeed, I think that isatty(2) is a better indicator than isatty(1). We
> sometimes _do_ redirect the output of, say, `git commit`, to capture the
> commit hash that was generated. We typically do not redirect stderr,
though,
> unless calling from an application and capturing everything via pipes. So
> isatty(2) strikes me as the best balance we can strike here.
Please be careful of this one. isatty(2) may not be the issue, but the
filedes provided by Jenkins and other CI/CD systems over SSH often
mischaracterises the results from this call. Hacking the file descriptor
(2>&1 etc) prior to going to git is a common thing in scripts. Stdin is
frequently wrong when Jenkins sets up the environment to prompt for an SSH
passphrase - happens in non-Docker nohup situations - where git will end up
thinking it is interactive when it is not - not on NonStop fortunately, but
this happens with a Gentoo Hypervisor and Ubuntu VM. Also, stderr gets
redirected in scripts frequently in my experience - particularly on exotic
operating systems, crossing over from say, legacy NonStop or IBM TSO to
each's POSIX environment. I would expect breakages from this assumption, so
please be cautious.
-Randall
next prev parent reply other threads:[~2021-11-22 23:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 17:37 preparing for 2.34.1 Junio C Hamano
2021-11-22 20:51 ` Carlo Arenas
2021-11-22 22:28 ` Johannes Schindelin
2021-11-22 22:42 ` Junio C Hamano
2021-11-22 23:30 ` Johannes Schindelin
2021-11-22 23:51 ` rsbecker [this message]
2021-11-22 22:50 ` Carlo Arenas
2021-11-22 21:50 ` Derrick Stolee
2021-11-22 22:45 ` Junio C Hamano
2021-11-23 17:18 ` preparing for 2.34.1 (2nd round) Junio C Hamano
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='039401d7dffb$e5198800$af4c9800$@nexbridge.com' \
--to=rsbecker@nexbridge$(echo .)com \
--cc=carenas@gmail$(echo .)com \
--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