Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit723f100

Browse files
committed
fix(docs): be clear about exit code handling
When pushing/pulling, we ignore errors unless it's exit code 128.The reason for this is now made explicit to make clear that issuesare handled by PushInfo flags accordingly.Related#271
1 parent98f6995 commit723f100

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

‎git/test/lib/helper.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,13 @@ def remote_repo_creator(self):
232232
prev_cwd=os.getcwd()
233233
os.chdir(rw_repo.working_dir)
234234
try:
235-
returnfunc(self,rw_repo,rw_remote_repo)
235+
try:
236+
returnfunc(self,rw_repo,rw_remote_repo)
237+
except:
238+
print("Keeping repos after failure: repo_dir = %s, remote_repo_dir = %s"
239+
% (repo_dir,remote_repo_dir),file=sys.stderr)
240+
repo_dir=remote_repo_dir=None
241+
raise
236242
finally:
237243
# gd.proc.kill() ... no idea why that doesn't work
238244
ifgdisnotNone:
@@ -241,8 +247,10 @@ def remote_repo_creator(self):
241247
os.chdir(prev_cwd)
242248
rw_repo.git.clear_cache()
243249
rw_remote_repo.git.clear_cache()
244-
shutil.rmtree(repo_dir,onerror=_rmtree_onerror)
245-
shutil.rmtree(remote_repo_dir,onerror=_rmtree_onerror)
250+
ifrepo_dir:
251+
shutil.rmtree(repo_dir,onerror=_rmtree_onerror)
252+
ifremote_repo_dir:
253+
shutil.rmtree(remote_repo_dir,onerror=_rmtree_onerror)
246254

247255
ifgdisnotNone:
248256
gd.proc.wait()

‎git/util.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,23 @@ def finalize_process(proc):
159159
exceptGitCommandError:
160160
# if a push has rejected items, the command has non-zero return status
161161
# a return status of 128 indicates a connection error - reraise the previous one
162+
# Everything else will still be parsed and made available through PushInfo flags
163+
# Estimated error results look like this:
164+
# ```bash
165+
# To /var/folders/xp/m48gs2tx2vg95tmtzw7tprs40000gn/T/tmpk5jeBeremote_repo_test_base
166+
# ! refs/heads/master:refs/heads/master [rejected] (non-fast-forward)
167+
# Done
168+
# error: failed to push some refs to
169+
# '/var/folders/xp/m48gs2tx2vg95tmtzw7tprs40000gn/T/tmpk5jeBeremote_repo_test_base'
170+
# hint: Updates were rejected because the tip of your current branch is behind
171+
# hint: its remote counterpart. Integrate the remote changes (e.g.
172+
# hint: 'git pull ...') before pushing again.
173+
# hint: See the 'Note about fast-forwards' in 'git push --help' for details.
174+
# ```
175+
# See https://github.com/gitpython-developers/GitPython/blob/master/git/test/test_remote.py#L305
176+
# on how to check for these kinds of errors.
177+
# Also see this issue for a reason for this verbosity:
178+
# https://github.com/gitpython-developers/GitPython/issues/271
162179
ifproc.poll()==128:
163180
raise
164181
pass

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp