threads / patch / 27313

patchlock_any_ref_for_update(): clarify switch case statement

Subject: [PATCH] lock_any_ref_for_update(): clarify switch case statement

## tl;dr

2 messages between May 10, 2011 and May 10, 2011. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Michael Schubert· May 10, 2011, 11:48 UTC · lore
Write CHECK_REF_FORMAT_OK instead of '0' to be more verbose.
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
---
 refs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to refs.c +1 −1
diff --git a/refs.c b/refs.c
index e3c0511..67d6bbd 100644
--- a/refs.c
+++ b/refs.c
@@ -1092,7 +1092,7 @@ struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *o
 	switch (check_ref_format(ref)) {
 	default:
 		return NULL;
-	case 0:
+	case CHECK_REF_FORMAT_OK:
 	case CHECK_REF_FORMAT_ONELEVEL:
 		return lock_ref_sha1_basic(ref, old_sha1, flags, NULL);
 	}
-- 
1.7.5.1
Junio C Hamano· May 10, 2011, 20:07 UTC · re: Michael Schubert · lore

Re: [PATCH] lock_any_ref_for_update(): clarify switch case statement

Michael Schubert <mschub@elegosoft.com> writes:
> Write CHECK_REF_FORMAT_OK instead of '0' to be more verbose.

It is not wrong per-se to spell it out to be more descriptive, but I would think 0 is clear enough that there is no error.

In any case, being verbose is never a goal ;-).

← back to recent threads