Commit Diff


commit - 5f5d5a73a7cc577673dbe0358d961fecf40919b1
commit + 2d0f364c3c7dcf075322c2a61665f8624e44bf0c
blob - 216586765e6c46489da686b0fac76236066f3c6c
blob + 11d36a730e5039b5bccac10a1560f5830fd0eb1c
--- got/got.c
+++ got/got.c
@@ -8372,20 +8372,10 @@ cmd_cherrypick(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	error = got_repo_match_object_id_prefix(&commit_id, argv[0],
-	    GOT_OBJ_TYPE_COMMIT, repo);
-	if (error != NULL) {
-		struct got_reference *ref;
-		if (error->code != GOT_ERR_BAD_OBJ_ID_STR)
-			goto done;
-		error = got_ref_open(&ref, repo, argv[0], 0);
-		if (error != NULL)
-			goto done;
-		error = got_ref_resolve(&commit_id, repo, ref);
-		got_ref_close(ref);
-		if (error != NULL)
-			goto done;
-	}
+	error = got_repo_match_object_id(&commit_id, NULL, argv[0],
+	    GOT_OBJ_TYPE_COMMIT, NULL, repo);
+	if (error)
+		goto done;
 	error = got_object_id_str(&commit_id_str, commit_id);
 	if (error)
 		goto done;
@@ -8479,20 +8469,10 @@ cmd_backout(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	error = got_repo_match_object_id_prefix(&commit_id, argv[0],
-	    GOT_OBJ_TYPE_COMMIT, repo);
-	if (error != NULL) {
-		struct got_reference *ref;
-		if (error->code != GOT_ERR_BAD_OBJ_ID_STR)
-			goto done;
-		error = got_ref_open(&ref, repo, argv[0], 0);
-		if (error != NULL)
-			goto done;
-		error = got_ref_resolve(&commit_id, repo, ref);
-		got_ref_close(ref);
-		if (error != NULL)
-			goto done;
-	}
+	error = got_repo_match_object_id(&commit_id, NULL, argv[0],
+	    GOT_OBJ_TYPE_COMMIT, NULL, repo);
+	if (error)
+		goto done;
 	error = got_object_id_str(&commit_id_str, commit_id);
 	if (error)
 		goto done;