From 830f5b1e2e401cda7f6a11391219a081c11ae4b9 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 17 Jul 2021 12:04:47 -0700 Subject: [PATCH] gitcmds: do not pass the context to diff_helper() Signed-off-by: David Aguilar --- cola/gitcmds.py | 2 +- test/gitcmds_test.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cola/gitcmds.py b/cola/gitcmds.py index dfa2f1fa..5a9234cc 100644 --- a/cola/gitcmds.py +++ b/cola/gitcmds.py @@ -418,7 +418,7 @@ def diff_helper( if ref and endref: argv.append('%s..%s' % (ref, endref)) elif ref: - argv.extend(context, utils.shell_split(ref.strip())) + argv.extend(utils.shell_split(ref.strip())) elif head and amending and cached: argv.append(head) diff --git a/test/gitcmds_test.py b/test/gitcmds_test.py index 4c58607c..0de0b212 100644 --- a/test/gitcmds_test.py +++ b/test/gitcmds_test.py @@ -208,6 +208,14 @@ class GitCmdsTestCase(helper.GitRepositoryTestCase): assert gitcmds.is_valid_ref(self.context, 'test') assert gitcmds.is_valid_ref(self.context, 'refs/heads/test') + def test_diff_helper(self): + self.commit_files() + with open('A', 'w') as f: + f.write('A change\n') + self.run_git('add', 'A') + actual = gitcmds.diff_helper(self.context, ref='HEAD', cached=True) + assert '+A change\n' in actual + if __name__ == '__main__': unittest.main() -- 2.11.4.GIT