Skip to content

Run git command with certain environment variables #1153

@sassanh

Description

@sassanh

Is your feature request related to a problem? Please describe.
The problem is one may like to have different environment variables for git in different projects. For example to set different GIT_AUTHOR_EMAIL for work projects and personal projects. I know this particular environment variable can be set by git config, but there are variables that can't be set by git config or one may want to be able to implement an automation to set GIT_AUTHOR_EMAIL not per repository, but based on other conditions.

Describe the solution you'd like
To solve this issue generally for most cases, it would be nice if we had these options to config the execution of git command in neogit:

  1. Set environment variables for git for one particular action, in neogit.action parameters.
  2. Set environment variables for git for one particular neogit session, in neogit.open parameters.
  3. Set environment variables for git generally for all neogit actions and sessions, in neogit.setup parameters.
  4. Set custom executable for git for one particular action, in neogit.action parameters.
  5. Set custom executable for git for one particular neogit session, in neogit.open parameters.
  6. Set custom executable for git generally for all neogit actions and sessions, in neogit.setup parameters.

Examples:

neogit.action('commit', 'commit', {'--verbose'}, {env_vars = {GIT_AUTHOR_EMAIL = '[email protected]'}})
neogit.open({git_executable = '/usr/bin/custom_git'})
neogit.setup({git_execttable = '~/bin/my_fancy_git', env_vars = {HOME = '/home/x/'}})

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions