aboutsummaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2016-04-21 23:42:19 +0200
committerMichael Haggerty <mhagger@alum.mit.edu>2016-05-05 16:37:30 +0200
commite711b1af2ead2ffad5c510aadbbc387c7d8aa4c7 (patch)
tree461295a831a3cc2794a48472c25b6eaf17f02bbc /refs
parent76fc394d50efef8f1308a0f0d56087f502dac689 (diff)
downloadgit-e711b1af2ead2ffad5c510aadbbc387c7d8aa4c7.tar.gz
git-e711b1af2ead2ffad5c510aadbbc387c7d8aa4c7.tar.xz
rename_ref(): remove unneeded local variable
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Diffstat (limited to 'refs')
-rw-r--r--refs/files-backend.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 2d3a8c669..80d346fd3 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -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;