git: Use git's own editor precedence via git var GIT_EDITOR - #290
Open
aaron-skydio wants to merge 1 commit into
Open
git: Use git's own editor precedence via git var GIT_EDITOR#290aaron-skydio wants to merge 1 commit into
git var GIT_EDITOR#290aaron-skydio wants to merge 1 commit into
Conversation
Editor resolution put core.editor ahead of $GIT_EDITOR, ignored $VISUAL entirely, and fell back to nano. Git's actual order (see git-var(1)) is $GIT_EDITOR, core.editor, $VISUAL, $EDITOR, then its compile-time default, so a caller setting GIT_EDITOR to force an editor for a single invocation was silently overridden by config. Ask `git var GIT_EDITOR` instead of reimplementing the precedence. This also picks up git's handling of dumb terminals, where $VISUAL is skipped because it conventionally names a full-screen editor, and where git refuses to fall back to its compile-time default at all. When git reports no usable editor, error out at the point we need one rather than guessing at nano. Resolution stays in make_git so the many commands that never open an editor are unaffected, and the result is typed Optional[str] so the unavailable case is visible in signatures instead of hiding behind an empty-string sentinel. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Topic: editor Reviewers: jerry,brian-k
Contributor
Author
|
Reviews in this chain: |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Editor resolution put core.editor ahead of $GIT_EDITOR, ignored $VISUAL
entirely, and fell back to nano. Git's actual order (see git-var(1)) is
$GIT_EDITOR, core.editor, $VISUAL, $EDITOR, then its compile-time
default, so a caller setting GIT_EDITOR to force an editor for a single
invocation was silently overridden by config.
Ask
git var GIT_EDITORinstead of reimplementing the precedence. Thisalso picks up git's handling of dumb terminals, where $VISUAL is skipped
because it conventionally names a full-screen editor, and where git
refuses to fall back to its compile-time default at all.
When git reports no usable editor, error out at the point we need one
rather than guessing at nano. Resolution stays in make_git so the many
commands that never open an editor are unaffected, and the result is
typed Optional[str] so the unavailable case is visible in signatures
instead of hiding behind an empty-string sentinel.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Topic: editor
Reviewers: jerry,brian-k