← 返回首页
test if it accepts environment variables in commands · gitpython-developers/GitPython@67260a3 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit 67260a3

Browse files
committed
test if it accepts environment variables in commands
1 parent cf8dc25 commit 67260a3

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎git/test/fixtures/ls_tree_empty‎

Whitespace-only changes.

‎git/test/test_git.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ def test_it_ignores_false_kwargs(self, git):
105105
self.git.version(pass_this_kwarg=False)
106106
assert_true("pass_this_kwarg" not in git.call_args[1])
107107

108+
def test_it_accepts_environment_variables(self):
109+
filename = fixture_path("ls_tree_empty")
110+
with open(filename, 'r') as fh:
111+
tree = self.git.mktree(istream=fh)
112+
env = {
113+
'GIT_AUTHOR_NAME': 'Author Name',
114+
'GIT_AUTHOR_EMAIL': 'author@example.com',
115+
'GIT_AUTHOR_DATE': '1400000000+0000',
116+
'GIT_COMMITTER_NAME': 'Committer Name',
117+
'GIT_COMMITTER_EMAIL': 'committer@example.com',
118+
'GIT_COMMITTER_DATE': '1500000000+0000',
119+
}
120+
commit = self.git.commit_tree(tree, m='message', env=env)
121+
assert_equal(commit, '4cfd6b0314682d5a58f80be39850bad1640e9241')
122+
108123
def test_persistent_cat_file_command(self):
109124
# read header only
110125
import subprocess as sp

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.