mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 06:27:43 +00:00
transaction: report failure to close transaction only in debug builds
When a transaction gets dropped without being committed or explicitly discarded, we currently raise an assertion error. I added that check because I kept forgetting to commit transactions. However, it's quite normal to want to drop transactions in error cases. The current assertion means that we panic and don't report the actual error to the user in such cases. We should probably audit the code paths where we commit transactions and decide for each if we simply want to to discard the transaction or not. In some cases, we may want to commit the transaction without integrating it in the operation log (i.e. without creating a file entry in .jj/views/op_heads/). However, we can do that later. For now, let's just make sure we don't panic when dropping the transaction in release builds.
This commit is contained in:
parent
4ecbd89378
commit
e0112a4be0
1 changed files with 1 additions and 1 deletions
|
@ -176,7 +176,7 @@ impl<'r> Transaction<'r> {
|
|||
impl<'r> Drop for Transaction<'r> {
|
||||
fn drop(&mut self) {
|
||||
if !std::thread::panicking() {
|
||||
assert!(self.closed, "Transaction was dropped without being closed.");
|
||||
debug_assert!(self.closed, "Transaction was dropped without being closed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue