Skip to content

Commit

Permalink
Fix rollback bug in SymbolicReference.set_reference
Browse files Browse the repository at this point in the history
This fixes the initialization of the "ok" flag by setting it to
False before the operation that might fail is attempted.

(This is a fix for the *specific* problem reported in #1669 about
how the pattern SymbolicReference.set_reference attempts to use
with LockedFD is not correctly implemented.)
  • Loading branch information
EliahKagan committed Sep 21, 2023
1 parent a5a6464 commit 592ec84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git/refs/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def set_reference(

lfd = LockedFD(fpath)
fd = lfd.open(write=True, stream=True)
ok = True
ok = False
try:
fd.write(write_value.encode("utf-8") + b"\n")
lfd.commit()
Expand Down

0 comments on commit 592ec84

Please sign in to comment.