Commit Diff


commit - f29d3e89671f0f97545aaf852f7c131b1ddaefdf
commit + 66b4983c7383b3536005f0f2480d65ea8c0c1c87
blob - ba0c80e5c8f31ded0ba552e5c2a4e3e7414d4828
blob + f3360e6a5d48fcf2e178a43ef89bd309c72d0443
--- tog/tog.c
+++ tog/tog.c
@@ -1149,26 +1149,28 @@ cmd_blame(int argc, char *argv[])
 	error = got_repo_open(&repo, repo_path);
 	free(repo_path);
 	if (error != NULL)
-		goto done;
+		return error;
 
 	if (commit_id_str == NULL) {
 		struct got_reference *head_ref;
 		error = got_ref_open(&head_ref, repo, GOT_REF_HEAD);
 		if (error != NULL)
-			return error;
+			goto done;
 		error = got_ref_resolve(&commit_id, repo, head_ref);
 		got_ref_close(head_ref);
 		if (error != NULL)
-			return error;
+			goto done;
 	} else {
 		struct got_object *obj;
 		error = got_object_open_by_id_str(&obj, repo, commit_id_str);
 		if (error != NULL)
-			return error;
+			goto done;
 		commit_id = got_object_get_id(obj);
-		if (commit_id == NULL)
-			error = got_error_from_errno();
 		got_object_close(obj);
+		if (commit_id == NULL) {
+			error = got_error_from_errno();
+			goto done;
+		}
 	}
 
 	error = show_blame_view(path, commit_id, repo);