Re: [PATCH 7/8] Provide a build time default-editor setting
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 31, 2009, 19:51 UTC
- Message-ID
- <7vzl775ol5.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20091031032647.GA5583@progeny.tock>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 14 quoted lines
> Junio C Hamano wrote: >> Jonathan Nieder <jrnieder@gmail.com> writes: > >>> +test_expect_success 'does editor have a simple name (no slashes, etc)?' ' >>> + >>> + editor=$(TERM=vt100 git var GIT_EDITOR) && >>> + test -n "$editor" && >>> + simple=t && >>> + case "$editor" in >>> + */* | core_editor | [A-Z]*) >> >> Hmm, what are the latter two cases designed to catch? > > Both are meant to allow the test to work without too many changes.
Honestly speaking, my preference is to see if the built-in editor is exactly spelled as 'v' 'i', and skip this test altogether if it isn't. Then the patch only needs to insert these lines (and reword "default editor name too complicated" to "using customized default editor") without touching the rest. It simply does not look worth the complication.
You _might_ be able to skip only the "vi" part of the test when you see that the built-in default is customized, though. I didn't look closely enough.
Show 17 quoted lines
> diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh > ... > +unset EDITOR VISUAL GIT_EDITOR > + > +test_expect_success 'determine default editor' ' > + > + editor=$(TERM=vt100 git var GIT_EDITOR) && > + test -n "$editor" > + > +' > + > +if ! test -z "$(printf '%s\n' "$editor" | sed '/^[a-z]*$/d')" > +then > + say 'skipping editor tests, default editor name too complicated' > + test_done > +fi > +