Skip to content

Commit 49150e7

Browse files
committed
chore: s/strip_newline/&_in_stdout
1 parent 946b64b commit 49150e7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

git/cmd.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
execute_kwargs = {'istream', 'with_extended_output',
5656
'with_exceptions', 'as_process', 'stdout_as_string',
5757
'output_stream', 'with_stdout', 'kill_after_timeout',
58-
'universal_newlines', 'shell', 'env', 'max_chunk_size', 'strip_newline'}
58+
'universal_newlines', 'shell', 'env', 'max_chunk_size', 'strip_newline_in_stdout'}
5959

6060
log = logging.getLogger(__name__)
6161
log.addHandler(logging.NullHandler())
@@ -738,7 +738,7 @@ def execute(self,
738738
shell: Union[None, bool] = None,
739739
env: Union[None, Mapping[str, str]] = None,
740740
max_chunk_size: int = io.DEFAULT_BUFFER_SIZE,
741-
strip_newline: bool = True,
741+
strip_newline_in_stdout: bool = True,
742742
**subprocess_kwargs: Any
743743
) -> Union[str, bytes, Tuple[int, Union[str, bytes], str], AutoInterrupt]:
744744
"""Handles executing the command on the shell and consumes and returns
@@ -811,8 +811,8 @@ def execute(self,
811811
effects on a repository. For example, stale locks in case of git gc could
812812
render the repository incapable of accepting changes until the lock is manually
813813
removed.
814-
:param strip_newline:
815-
Whether to strip the trailing '\n' of the command output.
814+
:param strip_newline_in_stdout:
815+
Whether to strip the trailing '\n' of the command stdout.
816816
817817
:return:
818818
* str(output) if extended_output = False (Default)
@@ -947,7 +947,7 @@ def _kill_process(pid: int) -> None:
947947
if not universal_newlines:
948948
stderr_value = stderr_value.encode(defenc)
949949
# strip trailing "\n"
950-
if stdout_value.endswith(newline) and strip_newline: # type: ignore
950+
if stdout_value.endswith(newline) and strip_newline_in_stdout: # type: ignore
951951
stdout_value = stdout_value[:-1]
952952
if stderr_value.endswith(newline): # type: ignore
953953
stderr_value = stderr_value[:-1]

test/test_repo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,11 +1100,11 @@ def test_rebasing(self, rw_dir):
11001100
self.assertEqual(r.currently_rebasing_on(), commitSpanish)
11011101

11021102
@with_rw_directory
1103-
def test_do_not_strip_newline(self, rw_dir):
1103+
def test_do_not_strip_newline_in_stdout(self, rw_dir):
11041104
r = Repo.init(rw_dir)
11051105
fp = osp.join(rw_dir, 'hello.txt')
11061106
with open(fp, 'w') as fs:
11071107
fs.write("hello\n")
11081108
r.git.add(Git.polish_url(fp))
11091109
r.git.commit(message="init")
1110-
self.assertEqual(r.git.show("HEAD:hello.txt", strip_newline=False), 'hello\n')
1110+
self.assertEqual(r.git.show("HEAD:hello.txt", strip_newline_in_stdout=False), 'hello\n')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy