rename_ref(): remove unneeded local variable
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 21 Apr 2016 21:42:19 +0000 (23:42 +0200)
committerMichael Haggerty <mhagger@alum.mit.edu>
Thu, 5 May 2016 14:37:30 +0000 (16:37 +0200)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
refs/files-backend.c
index 2d3a8c669a5b04a7e70da881f70e04dc5ba96c5e..80d346fd380fea91210b3706871b696bbc30c5b2 100644 (file)
@@ -2360,20 +2360,17 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
        struct ref_lock *lock;
        struct stat loginfo;
        int log = !lstat(git_path("logs/%s", oldrefname), &loginfo);
-       const char *symref = NULL;
        struct strbuf err = STRBUF_INIT;
 
        if (log && S_ISLNK(loginfo.st_mode))
                return error("reflog for %s is a symlink", oldrefname);
 
-       symref = resolve_ref_unsafe(oldrefname, RESOLVE_REF_READING,
-                                   orig_sha1, &flag);
+       if (!resolve_ref_unsafe(oldrefname, RESOLVE_REF_READING, orig_sha1, &flag))
+               return error("refname %s not found", oldrefname);
+
        if (flag & REF_ISSYMREF)
                return error("refname %s is a symbolic ref, renaming it is not supported",
                        oldrefname);
-       if (!symref)
-               return error("refname %s not found", oldrefname);
-
        if (!rename_ref_available(oldrefname, newrefname))
                return 1;