File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff 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 ()
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments