summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_command.py14
-rw-r--r--subcmds/cherry_pick.py4
2 files changed, 8 insertions, 10 deletions
diff --git a/git_command.py b/git_command.py
index 51e856a8..6e285224 100644
--- a/git_command.py
+++ b/git_command.py
@@ -249,7 +249,7 @@ class GitCommand(object):
249 project, 249 project,
250 cmdv, 250 cmdv,
251 bare=False, 251 bare=False,
252 provide_stdin=False, 252 input=None,
253 capture_stdout=False, 253 capture_stdout=False,
254 capture_stderr=False, 254 capture_stderr=False,
255 merge_output=False, 255 merge_output=False,
@@ -298,11 +298,7 @@ class GitCommand(object):
298 command.append('--progress') 298 command.append('--progress')
299 command.extend(cmdv[1:]) 299 command.extend(cmdv[1:])
300 300
301 if provide_stdin: 301 stdin = subprocess.PIPE if input else None
302 stdin = subprocess.PIPE
303 else:
304 stdin = None
305
306 stdout = subprocess.PIPE 302 stdout = subprocess.PIPE
307 stderr = subprocess.STDOUT if merge_output else subprocess.PIPE 303 stderr = subprocess.STDOUT if merge_output else subprocess.PIPE
308 304
@@ -350,7 +346,11 @@ class GitCommand(object):
350 _add_ssh_client(p) 346 _add_ssh_client(p)
351 347
352 self.process = p 348 self.process = p
353 self.stdin = p.stdin 349 if input:
350 if isinstance(input, str):
351 input = input.encode('utf-8')
352 p.stdin.write(input)
353 p.stdin.close()
354 354
355 @staticmethod 355 @staticmethod
356 def _GetBasicEnv(): 356 def _GetBasicEnv():
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py
index c333fcf4..4b7f1412 100644
--- a/subcmds/cherry_pick.py
+++ b/subcmds/cherry_pick.py
@@ -72,11 +72,9 @@ change id will be added.
72 new_msg = self._Reformat(old_msg, sha1) 72 new_msg = self._Reformat(old_msg, sha1)
73 73
74 p = GitCommand(None, ['commit', '--amend', '-F', '-'], 74 p = GitCommand(None, ['commit', '--amend', '-F', '-'],
75 provide_stdin=True, 75 input=new_msg,
76 capture_stdout=True, 76 capture_stdout=True,
77 capture_stderr=True) 77 capture_stderr=True)
78 p.stdin.write(new_msg)
79 p.stdin.close()
80 if p.Wait() != 0: 78 if p.Wait() != 0:
81 print("error: Failed to update commit message", file=sys.stderr) 79 print("error: Failed to update commit message", file=sys.stderr)
82 sys.exit(1) 80 sys.exit(1)