Commit 2ebc3c66c292539786b6ec1538f740c5e444fe16

Ben Straub 2013-04-15T11:57:24

Redeploy git_revparse_single.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
diff --git a/src/push.c b/src/push.c
index dcd8122..ce7af35 100644
--- a/src/push.c
+++ b/src/push.c
@@ -96,8 +96,9 @@ static int check_rref(char *ref)
 static int check_lref(git_push *push, char *ref)
 {
 	/* lref must be resolvable to an existing object */
-	git_oid oid;
-	int error = git_revparse(&oid, NULL, NULL, push->repo, ref);
+	git_object *obj;
+	int error = git_revparse_single(&obj, push->repo, ref);
+	git_object_free(obj);
 
 	if (!error)
 		return 0;
diff --git a/src/transports/local.c b/src/transports/local.c
index 1e27fc3..ce89bb2 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -236,13 +236,14 @@ static int local_negotiate_fetch(
 
 	/* Fill in the loids */
 	git_vector_foreach(&t->refs, i, rhead) {
-		git_oid oid;
+		git_object *obj;
 
-		int error = git_revparse(&oid, NULL, NULL, repo, rhead->name);
+		int error = git_revparse_single(&obj, repo, rhead->name);
 		if (!error)
-			git_oid_cpy(&rhead->loid, &oid);
+			git_oid_cpy(&rhead->loid, git_object_id(obj));
 		else if (error != GIT_ENOTFOUND)
 			return error;
+		git_object_free(obj);
 		giterr_clear();
 	}
 
diff --git a/tests-clar/checkout/tree.c b/tests-clar/checkout/tree.c
index ae4087f..0748b22 100644
--- a/tests-clar/checkout/tree.c
+++ b/tests-clar/checkout/tree.c
@@ -28,25 +28,19 @@ void test_checkout_tree__cleanup(void)
 
 void test_checkout_tree__cannot_checkout_a_non_treeish(void)
 {
-	git_oid oid;
-
 	/* blob */
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
-
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"));
 	cl_git_fail(git_checkout_tree(g_repo, g_object, NULL));
 }
 
 void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void)
 {
 	char *entries[] = { "ab/de/" };
-	git_oid oid;
 
 	g_opts.paths.strings = entries;
 	g_opts.paths.count = 1;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "subtrees"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees"));
 
 	cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
 
@@ -58,15 +52,12 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void)
 
 void test_checkout_tree__can_checkout_and_remove_directory(void)
 {
-	git_oid oid;
-
 	cl_assert_equal_i(false, git_path_isdir("./testrepo/ab/"));
 
 	/* Checkout brach "subtrees" and update HEAD, so that HEAD matches the
 	 * current working tree
 	 */
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "subtrees"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees"));
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 
 	cl_git_pass(git_repository_set_head(g_repo, "refs/heads/subtrees"));
@@ -81,8 +72,7 @@ void test_checkout_tree__can_checkout_and_remove_directory(void)
 	/* Checkout brach "master" and update HEAD, so that HEAD matches the
 	 * current working tree
 	 */
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "master"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "master"));
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 
 	cl_git_pass(git_repository_set_head(g_repo, "refs/heads/master"));
@@ -94,13 +84,11 @@ void test_checkout_tree__can_checkout_and_remove_directory(void)
 void test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree(void)
 {
 	char *entries[] = { "de/" };
-	git_oid oid;
 
 	g_opts.paths.strings = entries;
 	g_opts.paths.count = 1;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "subtrees:ab"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "subtrees:ab"));
 
 	cl_assert_equal_i(false, git_path_isdir("./testrepo/de/"));
 
@@ -120,13 +108,11 @@ static void progress(const char *path, size_t cur, size_t tot, void *payload)
 void test_checkout_tree__calls_progress_callback(void)
 {
 	bool was_called = 0;
-	git_oid oid;
 
 	g_opts.progress_cb = progress;
 	g_opts.progress_payload = &was_called;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "master"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "master"));
 
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 
@@ -290,16 +276,13 @@ void test_checkout_tree__can_update_only(void)
 void test_checkout_tree__can_checkout_with_pattern(void)
 {
 	char *entries[] = { "[l-z]*.txt" };
-	git_oid oid;
 
 	/* reset to beginning of history (i.e. just a README file) */
 
 	g_opts.checkout_strategy =
 		GIT_CHECKOUT_FORCE | GIT_CHECKOUT_REMOVE_UNTRACKED;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo,
-		"8496071c1b46c854b31185ea97743be6a8774479"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "8496071c1b46c854b31185ea97743be6a8774479"));
 
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 	cl_git_pass(
@@ -319,8 +302,7 @@ void test_checkout_tree__can_checkout_with_pattern(void)
 	g_opts.paths.strings = entries;
 	g_opts.paths.count = 1;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "refs/heads/master"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "refs/heads/master"));
 
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 
@@ -333,16 +315,13 @@ void test_checkout_tree__can_checkout_with_pattern(void)
 void test_checkout_tree__can_disable_pattern_match(void)
 {
 	char *entries[] = { "b*.txt" };
-	git_oid oid;
 
 	/* reset to beginning of history (i.e. just a README file) */
 
 	g_opts.checkout_strategy =
 		GIT_CHECKOUT_FORCE | GIT_CHECKOUT_REMOVE_UNTRACKED;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo,
-		"8496071c1b46c854b31185ea97743be6a8774479"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "8496071c1b46c854b31185ea97743be6a8774479"));
 
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 	cl_git_pass(
@@ -360,8 +339,7 @@ void test_checkout_tree__can_disable_pattern_match(void)
 	g_opts.paths.strings = entries;
 	g_opts.paths.count = 1;
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "refs/heads/master"));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, "refs/heads/master"));
 
 	cl_git_pass(git_checkout_tree(g_repo, g_object, &g_opts));
 
@@ -386,13 +364,11 @@ void assert_conflict(
 	git_object *hack_tree;
 	git_reference *branch, *head;
 	git_buf file_path = GIT_BUF_INIT; 
-	git_oid oid;
 
 	cl_git_pass(git_repository_index(&index, g_repo));
 
 	/* Create a branch pointing at the parent */
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, parent_sha));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, parent_sha));
 	cl_git_pass(git_branch_create(&branch, g_repo,
 		"potential_conflict", (git_commit *)g_object, 0));
 
@@ -421,8 +397,7 @@ void assert_conflict(
 	git_buf_free(&file_path);
 
 	/* Trying to checkout the original commit */
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, commit_sha));
-	cl_git_pass(git_object_lookup(&g_object, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&g_object, g_repo, commit_sha));
 
 	g_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
 	cl_assert_equal_i(
@@ -509,7 +484,6 @@ void test_checkout_tree__issue_1397(void)
 	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
 	const char *partial_oid = "8a7ef04";
 	git_object *tree = NULL;
-	git_oid oid;
 
 	test_checkout_tree__cleanup(); /* cleanup default checkout */
 
@@ -517,8 +491,7 @@ void test_checkout_tree__issue_1397(void)
 
 	cl_repo_set_bool(g_repo, "core.autocrlf", true);
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, partial_oid));
-	cl_git_pass(git_object_lookup(&tree, g_repo, &oid, GIT_OBJ_ANY));
+	cl_git_pass(git_revparse_single(&tree, g_repo, partial_oid));
 
 	opts.checkout_strategy = GIT_CHECKOUT_FORCE;
 
diff --git a/tests-clar/checkout/typechange.c b/tests-clar/checkout/typechange.c
index 7452131..b92cc23 100644
--- a/tests-clar/checkout/typechange.c
+++ b/tests-clar/checkout/typechange.c
@@ -107,12 +107,10 @@ void test_checkout_typechange__checkout_typechanges_safe(void)
 {
 	int i;
 	git_object *obj;
-	git_oid oid;
 	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
 
 	for (i = 0; g_typechange_oids[i] != NULL; ++i) {
-		cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, g_typechange_oids[i]));
-		cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
+		cl_git_pass(git_revparse_single(&obj, g_repo, g_typechange_oids[i]));
 
 		opts.checkout_strategy = GIT_CHECKOUT_FORCE;
 
@@ -196,7 +194,6 @@ void test_checkout_typechange__checkout_with_conflicts(void)
 {
 	int i;
 	git_object *obj;
-	git_oid oid;
 	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
 	notify_counts cts = {0};
 
@@ -206,8 +203,7 @@ void test_checkout_typechange__checkout_with_conflicts(void)
 	opts.notify_payload = &cts;
 
 	for (i = 0; g_typechange_oids[i] != NULL; ++i) {
-		cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, g_typechange_oids[i]));
-		cl_git_pass(git_object_lookup(&obj, g_repo, &oid, GIT_OBJ_ANY));
+		cl_git_pass(git_revparse_single(&obj, g_repo, g_typechange_oids[i]));
 
 		force_create_file("typechanges/a/blocker");
 		force_create_file("typechanges/b");
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c
index d86c1f4..c4b4822 100644
--- a/tests-clar/clone/nonetwork.c
+++ b/tests-clar/clone/nonetwork.c
@@ -214,22 +214,23 @@ void test_clone_nonetwork__can_checkout_given_branch(void)
 
 void test_clone_nonetwork__can_detached_head(void)
 {
-	git_oid oid;
+	git_object *obj;
 	git_repository *cloned;
 	git_reference *cloned_head;
 
 	cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, g_repo, "master~1"));
-	cl_git_pass(git_repository_set_head_detached(g_repo, &oid));
+	cl_git_pass(git_revparse_single(&obj, g_repo, "master~1"));
+	cl_git_pass(git_repository_set_head_detached(g_repo, git_object_id(obj)));
 
 	cl_git_pass(git_clone(&cloned, "./foo", "./foo1", &g_options));
 
 	cl_assert(git_repository_head_detached(cloned));
 
 	cl_git_pass(git_repository_head(&cloned_head, cloned));
-	cl_assert(!git_oid_cmp(&oid, git_reference_target(cloned_head)));
+	cl_assert(!git_oid_cmp(git_object_id(obj), git_reference_target(cloned_head)));
 
+	git_object_free(obj);
 	git_reference_free(cloned_head);
 	git_repository_free(cloned);
 
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c
index 39e77c8..8c3e5e4 100644
--- a/tests-clar/refs/revparse.c
+++ b/tests-clar/refs/revparse.c
@@ -6,22 +6,25 @@
 #include "path.h"
 
 static git_repository *g_repo;
+static git_object *g_obj;
 
 /* Helpers */
 static void test_object_inrepo(const char *spec, const char *expected_oid, git_repository *repo)
 {
 	char objstr[64] = {0};
-	git_oid oid;
+	git_object *obj = NULL;
 	int error;
 
-	error = git_revparse(&oid, NULL, NULL, repo, spec);
+	error = git_revparse_single(&obj, repo, spec);
 
 	if (expected_oid != NULL) {
 		cl_assert_equal_i(0, error);
-		git_oid_fmt(objstr, &oid);
+		git_oid_fmt(objstr, git_object_id(obj));
 		cl_assert_equal_s(objstr, expected_oid);
 	} else
 		cl_assert_equal_i(GIT_ENOTFOUND, error);
+
+	git_object_free(obj);
 }
 
 static void test_id_inrepo(
@@ -110,18 +113,17 @@ void test_refs_revparse__nonexistant_object(void)
 	test_object("this-does-not-exist~2", NULL);
 }
 
-static void assert_invalid_spec(const char *invalid_spec)
+static void assert_invalid_single_spec(const char *invalid_spec)
 {
-	git_oid oid;
 	cl_assert_equal_i(
-		GIT_EINVALIDSPEC, git_revparse(&oid, NULL, NULL, g_repo, invalid_spec));
+		GIT_EINVALIDSPEC, git_revparse_single(&g_obj, g_repo, invalid_spec));
 }
 
 void test_refs_revparse__invalid_reference_name(void)
 {
-	assert_invalid_spec("this doesn't make sense");
-	assert_invalid_spec("Inv@{id");
-	assert_invalid_spec("");
+	assert_invalid_single_spec("this doesn't make sense");
+	assert_invalid_single_spec("Inv@{id");
+	assert_invalid_single_spec("");
 }
 
 void test_refs_revparse__shas(void)
@@ -160,11 +162,11 @@ void test_refs_revparse__describe_output(void)
 
 void test_refs_revparse__nth_parent(void)
 {
-	assert_invalid_spec("be3563a^-1");
-	assert_invalid_spec("^");
-	assert_invalid_spec("be3563a^{tree}^");
-	assert_invalid_spec("point_to_blob^{blob}^");
-	assert_invalid_spec("this doesn't make sense^1");
+	assert_invalid_single_spec("be3563a^-1");
+	assert_invalid_single_spec("^");
+	assert_invalid_single_spec("be3563a^{tree}^");
+	assert_invalid_single_spec("point_to_blob^{blob}^");
+	assert_invalid_single_spec("this doesn't make sense^1");
 
 	test_object("be3563a^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
 	test_object("be3563a^", "9fd738e8f7967c078dceed8190330fc8648ee56a");
@@ -191,12 +193,10 @@ void test_refs_revparse__not_tag(void)
 
 void test_refs_revparse__to_type(void)
 {
-	git_oid oid;
-
-	assert_invalid_spec("wrapped_tag^{trip}");
+	assert_invalid_single_spec("wrapped_tag^{trip}");
 	test_object("point_to_blob^{commit}", NULL);
 	cl_assert_equal_i(
-		GIT_EAMBIGUOUS, git_revparse(&oid, NULL, NULL, g_repo, "wrapped_tag^{blob}"));
+		GIT_EAMBIGUOUS, git_revparse_single(&g_obj, g_repo, "wrapped_tag^{blob}"));
 
 	test_object("wrapped_tag^{commit}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
 	test_object("wrapped_tag^{tree}", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
@@ -206,15 +206,15 @@ void test_refs_revparse__to_type(void)
 
 void test_refs_revparse__linear_history(void)
 {
-	assert_invalid_spec("~");
+	assert_invalid_single_spec("~");
 	test_object("foo~bar", NULL);
 
-	assert_invalid_spec("master~bar");
-	assert_invalid_spec("master~-1");
-	assert_invalid_spec("master~0bar");
-	assert_invalid_spec("this doesn't make sense~2");
-	assert_invalid_spec("be3563a^{tree}~");
-	assert_invalid_spec("point_to_blob^{blob}~");
+	assert_invalid_single_spec("master~bar");
+	assert_invalid_single_spec("master~-1");
+	assert_invalid_single_spec("master~0bar");
+	assert_invalid_single_spec("this doesn't make sense~2");
+	assert_invalid_single_spec("be3563a^{tree}~");
+	assert_invalid_single_spec("point_to_blob^{blob}~");
 
 	test_object("master~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
 	test_object("master~1", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
@@ -225,10 +225,10 @@ void test_refs_revparse__linear_history(void)
 
 void test_refs_revparse__chaining(void)
 {
-	assert_invalid_spec("master@{0}@{0}");
-	assert_invalid_spec("@{u}@{-1}");
-	assert_invalid_spec("@{-1}@{-1}");
-	assert_invalid_spec("@{-3}@{0}");
+	assert_invalid_single_spec("master@{0}@{0}");
+	assert_invalid_single_spec("@{u}@{-1}");
+	assert_invalid_single_spec("@{-1}@{-1}");
+	assert_invalid_single_spec("@{-3}@{0}");
 
 	test_object("master@{0}~1^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
 	test_object("@{u}@{0}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
@@ -244,8 +244,8 @@ void test_refs_revparse__chaining(void)
 
 void test_refs_revparse__upstream(void)
 {
-	assert_invalid_spec("e90810b@{u}");
-	assert_invalid_spec("refs/tags/e90810b@{u}");
+	assert_invalid_single_spec("e90810b@{u}");
+	assert_invalid_single_spec("refs/tags/e90810b@{u}");
 	test_object("refs/heads/e90810b@{u}", NULL);
 
 	test_object("master@{upstream}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
@@ -257,11 +257,10 @@ void test_refs_revparse__upstream(void)
 
 void test_refs_revparse__ordinal(void)
 {
-	assert_invalid_spec("master@{-2}");
+	assert_invalid_single_spec("master@{-2}");
 	
 	/* TODO: make the test below actually fail
-	 * git_oid oid;
-	 * cl_git_fail(git_revparse(&oid, NULL, NULL, g_repo, "master@{1a}"));
+	 * cl_git_fail(git_revparse_single(&g_obj, g_repo, "master@{1a}"));
 	 */
 
 	test_object("nope@{0}", NULL);
@@ -280,9 +279,9 @@ void test_refs_revparse__ordinal(void)
 
 void test_refs_revparse__previous_head(void)
 {
-	assert_invalid_spec("@{-xyz}");
-	assert_invalid_spec("@{-0}");
-	assert_invalid_spec("@{-1b}");
+	assert_invalid_single_spec("@{-xyz}");
+	assert_invalid_single_spec("@{-0}");
+	assert_invalid_single_spec("@{-1b}");
 
 	test_object("@{-42}", NULL);
 
@@ -342,7 +341,7 @@ void test_refs_revparse__revwalk(void)
 {
 	test_object("master^{/not found in any commit}", NULL);
 	test_object("master^{/merge}", NULL);
-	assert_invalid_spec("master^{/((}");
+	assert_invalid_single_spec("master^{/((}");
 
 	test_object("master^{/anoth}", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
 	test_object("master^{/Merge}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
@@ -423,11 +422,9 @@ void test_refs_revparse__date(void)
 
 void test_refs_revparse__colon(void)
 {
-	git_oid oid;
-
-	assert_invalid_spec(":/");
-	assert_invalid_spec("point_to_blob:readme.txt");
-	cl_git_fail(git_revparse(&oid, NULL, NULL, g_repo, ":2:README")); /* Not implemented  */
+	assert_invalid_single_spec(":/");
+	assert_invalid_single_spec("point_to_blob:readme.txt");
+	cl_git_fail(git_revparse_single(&g_obj, g_repo, ":2:README")); /* Not implemented  */
 
 	test_object(":/not found in any commit", NULL);
 	test_object("subtrees:ab/42.txt", NULL);
@@ -517,9 +514,8 @@ void test_refs_revparse__disambiguation(void)
 
 void test_refs_revparse__a_too_short_objectid_returns_EAMBIGUOUS(void)
 {
-	git_oid oid;
 	cl_assert_equal_i(
-		GIT_EAMBIGUOUS, git_revparse(&oid, NULL, NULL, g_repo, "e90"));
+		GIT_EAMBIGUOUS, git_revparse_single(&g_obj, g_repo, "e90"));
 }
 
 void test_refs_revparse__issue_994(void)
@@ -527,15 +523,14 @@ void test_refs_revparse__issue_994(void)
 	git_repository *repo;
 	git_reference *head, *with_at;
 	git_object *target;
-	git_oid oid;
 	
 	repo = cl_git_sandbox_init("testrepo.git");
 
 	cl_assert_equal_i(GIT_ENOTFOUND,
-		git_revparse(&oid, NULL, NULL, repo, "origin/bim_with_3d@11296"));
+		git_revparse_single(&target, repo, "origin/bim_with_3d@11296"));
 
 	cl_assert_equal_i(GIT_ENOTFOUND,
-		git_revparse(&oid, NULL, NULL, repo, "refs/remotes/origin/bim_with_3d@11296"));
+		git_revparse_single(&target, repo, "refs/remotes/origin/bim_with_3d@11296"));
 
 
 	cl_git_pass(git_repository_head(&head, repo));
@@ -546,12 +541,10 @@ void test_refs_revparse__issue_994(void)
 		git_reference_target(head),
 		0));
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, repo, "origin/bim_with_3d@11296"));
-	cl_git_pass(git_object_lookup(&target, repo, &oid, GIT_OBJ_COMMIT));
+	cl_git_pass(git_revparse_single(&target, repo, "origin/bim_with_3d@11296"));
 	git_object_free(target);
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, repo, "refs/remotes/origin/bim_with_3d@11296"));
-	cl_git_pass(git_object_lookup(&target, repo, &oid, GIT_OBJ_COMMIT));
+	cl_git_pass(git_revparse_single(&target, repo, "refs/remotes/origin/bim_with_3d@11296"));
 	git_object_free(target);
 
 	git_reference_free(with_at);
@@ -577,14 +570,12 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
 	git_reference *branch;
 	git_object *target;
 	char sha[GIT_OID_HEXSZ + 1];
-	git_oid oid;
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
 	test_object_inrepo("blah-7-gc47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo);
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, repo, "HEAD~3"));
-	cl_git_pass(git_object_lookup(&target, repo, &oid, GIT_OBJ_COMMIT));
+	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
 	cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0));
 
 	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
@@ -617,14 +608,12 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void)
 	git_reference *branch;
 	git_object *target;
 	char sha[GIT_OID_HEXSZ + 1];
-	git_oid oid;
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
 	test_object_inrepo("a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo);
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, repo, "HEAD~3"));
-	cl_git_pass(git_object_lookup(&target, repo, &oid, GIT_OBJ_COMMIT));
+	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
 	cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0));
 
 	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
@@ -655,14 +644,12 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
 	git_reference *branch;
 	git_object *target;
 	char sha[GIT_OID_HEXSZ + 1];
-	git_oid oid;
 
 	repo = cl_git_sandbox_init("testrepo.git");
 
 	test_object_inrepo("c47800", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo);
 
-	cl_git_pass(git_revparse(&oid, NULL, NULL, repo, "HEAD~3"));
-	cl_git_pass(git_object_lookup(&target, repo, &oid, GIT_OBJ_COMMIT));
+	cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
 	cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0));
 
 	git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
@@ -677,6 +664,8 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void)
 
 void test_refs_revparse__range(void)
 {
+	assert_invalid_single_spec("be3563a^1..be3563a");
+
 	test_rangelike("be3563a^1..be3563a",
 	               "9fd738e8f7967c078dceed8190330fc8648ee56a",
 	               "be3563ae3f795b2b4353bcce3a527ad0a4f7f644",