Merge branch 'js/unreachable-workaround-for-no-symlink-head'

Code clean-up.

* js/unreachable-workaround-for-no-symlink-head:
  refs: forbid clang to complain about unreachable code
main
Junio C Hamano 2025-10-20 14:12:17 -07:00
commit 5a34f66fb9
1 changed files with 7 additions and 1 deletions

View File

@ -3327,7 +3327,13 @@ static int files_transaction_finish(struct ref_store *ref_store,
* next update. If not, we try and create a regular symref. * next update. If not, we try and create a regular symref.
*/ */
if (update->new_target && refs->prefer_symlink_refs) if (update->new_target && refs->prefer_symlink_refs)
if (!create_ref_symlink(lock, update->new_target)) /*
* By using the `NOT_CONSTANT()` trick, we can avoid
* errors by `clang`'s `-Wunreachable` logic that would
* report that the `continue` statement is not reachable
* when `NO_SYMLINK_HEAD` is `#define`d.
*/
if (NOT_CONSTANT(!create_ref_symlink(lock, update->new_target)))
continue; continue;


if (update->flags & REF_NEEDS_COMMIT) { if (update->flags & REF_NEEDS_COMMIT) {