Commit 8dde7e1
committed
refdb_fs: refactor error handling in
The function `refdb_reflog_fs__delete` uses the `if (!error && foobar())`
pattern of checking, where error conditions are being checked by following calls
to different code. This does not match our current style, where the call-site of
a function is usually directly responsible for checking the return value.
Convert the function to use `if ((error = foobar()) < 0) goto out;` style. Note
that this changes the code flow a bit: previously, we were always trying to
delete empty reference hierarchies even if deleting the reflog entry has failed.
This wasn't much of a problem -- if deletion failed, the hierarchy will still
contain at least one file and thus the function call was an expensive no-op.
Now, we will only perform this deletion if we have successfully removed the
reflog.refdb_reflog_fs__delete
1 parent bc21965 commit 8dde7e1
1 file changed
+11
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
2049 | | - | |
| 2049 | + | |
2050 | 2050 | | |
2051 | | - | |
2052 | | - | |
2053 | | - | |
| 2051 | + | |
2054 | 2052 | | |
2055 | 2053 | | |
2056 | 2054 | | |
2057 | | - | |
2058 | | - | |
| 2055 | + | |
| 2056 | + | |
2059 | 2057 | | |
2060 | | - | |
| 2058 | + | |
| 2059 | + | |
2061 | 2060 | | |
2062 | | - | |
2063 | | - | |
2064 | | - | |
2065 | | - | |
| 2061 | + | |
| 2062 | + | |
2066 | 2063 | | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
2067 | 2067 | | |
2068 | 2068 | | |
2069 | 2069 | | |
2070 | | - | |
2071 | 2070 | | |
2072 | 2071 | | |
2073 | 2072 | | |
| |||
0 commit comments