Skip to content

Commit f64549a

Browse files
authored
Reduce unnecessary console output validation in test_commands (#67)
We don't really need the pull behavior hint to validate what's we're trying to do in these checks, so we can disable it in newer git clients to achieve the same behavior across the board. Additionally, the addition of the static global .gitconfig file means that we don't need to worry about insteadOf mappings messing with our git URLs, so that workaround can be dropped. Signed-off-by: Scott K Logan <logans@cottsay.net>
1 parent 5e50f71 commit f64549a

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

test/.gitconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ abbrev = 7
66

77
[init]
88
defaultBranch = main
9+
10+
[pull]
11+
rebase = false

test/test_commands.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,6 @@ def test_pull(self):
110110
b'anch. Please specify which\nbranch you want to merge with. See',
111111
b'anch.\nPlease specify which branch you want to merge with.\nSee',
112112
)
113-
# newer git versions warn on pull with default config
114-
if GitClient.get_git_version() >= [2, 27, 0]:
115-
pull_warning = b"""
116-
warning: Pulling without specifying how to reconcile divergent branches is
117-
discouraged. You can squelch this message by running one of the following
118-
commands sometime before your next pull:
119-
120-
git config pull.rebase false # merge (the default strategy)
121-
git config pull.rebase true # rebase
122-
git config pull.ff only # fast-forward only
123-
124-
You can replace "git config" with "git config --global" to set a default
125-
preference for all repositories. You can also pass --rebase, --no-rebase,
126-
or --ff-only on the command line to override the configured default per
127-
invocation.
128-
"""
129-
output = output.replace(pull_warning, b'')
130113
self.assertEqual(output, expected)
131114

132115
def test_pull_api(self):
@@ -176,23 +159,6 @@ def test_pull_api(self):
176159
'anch. Please specify which\nbranch you want to merge with. See',
177160
'anch.\nPlease specify which branch you want to merge with.\nSee',
178161
)
179-
# newer git versions warn on pull with default config
180-
if GitClient.get_git_version() >= [2, 27, 0]:
181-
pull_warning = """
182-
warning: Pulling without specifying how to reconcile divergent branches is
183-
discouraged. You can squelch this message by running one of the following
184-
commands sometime before your next pull:
185-
186-
git config pull.rebase false # merge (the default strategy)
187-
git config pull.rebase true # rebase
188-
git config pull.ff only # fast-forward only
189-
190-
You can replace "git config" with "git config --global" to set a default
191-
preference for all repositories. You can also pass --rebase, --no-rebase,
192-
or --ff-only on the command line to override the configured default per
193-
invocation.
194-
"""
195-
output = output.replace(pull_warning, '')
196162
# the output was retrieved through a different way here
197163
output = adapt_command_output(output.encode()).decode()
198164
if sys.platform == 'win32':
@@ -449,8 +415,6 @@ def adapt_command_output(output, cwd=None):
449415
b'Turn off this advice by setting config variable '
450416
b'advice.detachedHead to false',
451417
)
452-
# replace GitHub SSH clone URL
453-
output = output.replace(b'git@github.com:', b'https://github.com/')
454418
if sys.platform == 'win32':
455419
if cwd:
456420
# on Windows, git prints full path to repos

0 commit comments

Comments
 (0)