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

Appearance settings

Commit 723f100

Browse filesBrowse 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 issues are handled by PushInfo flags accordingly. Related gitpython-developers#271
1 parent 98f6995 commit 723f100
Copy full SHA for 723f100

2 files changed

+28-3Lines changed: 28 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎git/test/lib/helper.py‎

Copy file name to clipboardExpand all lines: git/test/lib/helper.py
+11-3Lines 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-
return func(self, rw_repo, rw_remote_repo)
235+
try:
236+
return func(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
if gd is not None:
@@ -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+
if repo_dir:
251+
shutil.rmtree(repo_dir, onerror=_rmtree_onerror)
252+
if remote_repo_dir:
253+
shutil.rmtree(remote_repo_dir, onerror=_rmtree_onerror)
246254

247255
if gd is not None:
248256
gd.proc.wait()
Collapse file

‎git/util.py‎

Copy file name to clipboardExpand all lines: git/util.py
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,23 @@ def finalize_process(proc):
159159
except GitCommandError:
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
if proc.poll() == 128:
163180
raise
164181
pass

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.