Commit Diff


commit - 4be911ed5341c159d93089befd31a1190dbd6353
commit + 39479daec29a845f84812b85418dc85dc3a433a9
blob - a8e02bf8f39f50b80a56e690e28c3ba7851cc7af
blob + 175740d9c6f4b9443624418107f8b2314f6f44b0
--- 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;