]> granicus.if.org Git - git/commitdiff
resolve_ref_1(): reorder code
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 7 Apr 2016 19:02:59 +0000 (15:02 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Apr 2016 18:35:21 +0000 (11:35 -0700)
There is no need to adjust *flags if we're just about to fail.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c

index 69ec9036e0c8b70304e57f30a2f94d675340e914..60f149370abba16eb1bf8b0b206c5256457c9d5e 100644 (file)
@@ -1542,13 +1542,13 @@ static const char *resolve_ref_1(const char *refname,
                        return refname;
                }
                if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
-                       *flags |= REF_ISBROKEN;
-
                        if (!(resolve_flags & RESOLVE_REF_ALLOW_BAD_NAME) ||
                            !refname_is_safe(refname)) {
                                errno = EINVAL;
                                return NULL;
                        }
+
+                       *flags |= REF_ISBROKEN;
                        bad_name = 1;
                }
        }