-
Notifications
You must be signed in to change notification settings - Fork 32
fix: editor var expansion #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Current Aviator status
This PR was merged using Aviator.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
✅ FlexReview StatusCommon Owner:
Review SLO: |
Summary of ChangesHello @Brookke, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where environment variables embedded within the editor command string were not being expanded, leading to incorrect editor invocation. By integrating Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to add support for environment variable expansion in the Git editor command, for cases like GIT_EDITOR="$EDITOR". However, the current implementation using os.ExpandEnv is not safe as it doesn't respect shell quoting rules, which can lead to incorrect behavior and potential security vulnerabilities. I've left a comment with a detailed explanation and a suggestion for a more robust implementation that involves executing the command through a shell, which is how Git itself handles it.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly changes the editor launching logic to use a shell, which enables support for environment variable expansion in the editor command (e.g., GIT_EDITOR="$EDITOR"). This also implicitly fixes a bug where filenames with spaces were not handled correctly. The approach is sound, but I have one suggestion to improve portability.
|
Can you explain what you want to solve? If the shell has |
This happens when the editor is read from the .gitconfig, I mistakenly thought it would also happen for GIT_EDITOR. So the steps for reproducing were as follows.
I'll also update the PR description |
Thanks. I added a reference as well to the PR description. |
This handles cases where the git editor is set to
$EDITOR. The steps for reproducing are as follows.av pr --editAccording to
man 1 git-var,GIT_EDITORis "meant to be interpreted by the shell when it is used". Hence, this variable needs to be interpreted.Credit to @tgandrews for spotting the issue