Commit ff84b26 1 parent 592ec84 commit ff84b26 Copy full SHA for ff84b26
File tree 3 files changed +14
-19
lines changed
3 files changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -406,15 +406,14 @@ def release(self) -> None:
406
406
return
407
407
408
408
try :
409
- try :
410
- self .write ()
411
- except IOError :
412
- log .error ("Exception during destruction of GitConfigParser" , exc_info = True )
413
- except ReferenceError :
414
- # This happens in PY3 ... and usually means that some state cannot be written
415
- # as the sections dict cannot be iterated
416
- # Usually when shutting down the interpreter, don'y know how to fix this
417
- pass
409
+ self .write ()
410
+ except IOError :
411
+ log .error ("Exception during destruction of GitConfigParser" , exc_info = True )
412
+ except ReferenceError :
413
+ # This happens in PY3 ... and usually means that some state cannot be
414
+ # written as the sections dict cannot be iterated
415
+ # Usually when shutting down the interpreter, don't know how to fix this
416
+ pass
418
417
finally :
419
418
if self ._lock is not None :
420
419
self ._lock ._release_lock ()
Original file line number Diff line number Diff line change @@ -224,13 +224,11 @@ def write(
224
224
lfd = LockedFD (file_path or self ._file_path )
225
225
stream = lfd .open (write = True , stream = True )
226
226
227
- ok = False
228
227
try :
229
228
self ._serialize (stream , ignore_extension_data )
230
- ok = True
231
- finally :
232
- if not ok :
233
- lfd .rollback ()
229
+ except BaseException :
230
+ lfd .rollback ()
231
+ raise
234
232
235
233
lfd .commit ()
236
234
Original file line number Diff line number Diff line change @@ -370,14 +370,12 @@ def set_reference(
370
370
371
371
lfd = LockedFD (fpath )
372
372
fd = lfd .open (write = True , stream = True )
373
- ok = False
374
373
try :
375
374
fd .write (write_value .encode ("utf-8" ) + b"\n " )
376
375
lfd .commit ()
377
- ok = True
378
- finally :
379
- if not ok :
380
- lfd .rollback ()
376
+ except BaseException :
377
+ lfd .rollback ()
378
+ raise
381
379
# Adjust the reflog
382
380
if logmsg is not None :
383
381
self .log_append (oldbinsha , logmsg )
You can’t perform that action at this time.
0 commit comments