Commit ac5e507cec8e075a2095abcf4c8c82a01b82a5f9

Vicent Martí 2013-11-01T09:31:52

Merge pull request #1918 from libgit2/cmn/indexer-naming indexer: remove the stream infix

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
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
diff --git a/examples/network/index-pack.c b/examples/network/index-pack.c
index 08b45c5..59fff41 100644
--- a/examples/network/index-pack.c
+++ b/examples/network/index-pack.c
@@ -31,7 +31,7 @@ static int index_cb(const git_transfer_progress *stats, void *data)
 
 int index_pack(git_repository *repo, int argc, char **argv)
 {
-	git_indexer_stream *idx;
+	git_indexer *idx;
 	git_transfer_progress stats = {0, 0};
 	int error;
 	char hash[GIT_OID_HEXSZ + 1] = {0};
@@ -46,7 +46,7 @@ int index_pack(git_repository *repo, int argc, char **argv)
 		return EXIT_FAILURE;
 	}
 
-	if (git_indexer_stream_new(&idx, ".", NULL, NULL, NULL) < 0) {
+	if (git_indexer_new(&idx, ".", NULL, NULL, NULL) < 0) {
 		puts("bad idx");
 		return -1;
 	}
@@ -61,7 +61,7 @@ int index_pack(git_repository *repo, int argc, char **argv)
 		if (read_bytes < 0)
 			break;
 
-		if ((error = git_indexer_stream_add(idx, buf, read_bytes, &stats)) < 0)
+		if ((error = git_indexer_append(idx, buf, read_bytes, &stats)) < 0)
 			goto cleanup;
 
 		index_cb(&stats, NULL);
@@ -73,16 +73,16 @@ int index_pack(git_repository *repo, int argc, char **argv)
 		goto cleanup;
 	}
 
-	if ((error = git_indexer_stream_finalize(idx, &stats)) < 0)
+	if ((error = git_indexer_commit(idx, &stats)) < 0)
 		goto cleanup;
 
 	printf("\rIndexing %d of %d\n", stats.indexed_objects, stats.total_objects);
 
-	git_oid_fmt(hash, git_indexer_stream_hash(idx));
+	git_oid_fmt(hash, git_indexer_hash(idx));
 	puts(hash);
 
  cleanup:
 	close(fd);
-	git_indexer_stream_free(idx);
+	git_indexer_free(idx);
 	return error;
 }
diff --git a/include/git2/indexer.h b/include/git2/indexer.h
index 0858b6e..fb55672 100644
--- a/include/git2/indexer.h
+++ b/include/git2/indexer.h
@@ -13,10 +13,10 @@
 
 GIT_BEGIN_DECL
 
-typedef struct git_indexer_stream git_indexer_stream;
+typedef struct git_indexer git_indexer;
 
 /**
- * Create a new streaming indexer instance
+ * Create a new indexer instance
  *
  * @param out where to store the indexer instance
  * @param path to the directory where the packfile should be stored
@@ -26,8 +26,8 @@ typedef struct git_indexer_stream git_indexer_stream;
  * @param progress_cb function to call with progress information
  * @param progress_cb_payload payload for the progress callback
  */
-GIT_EXTERN(int) git_indexer_stream_new(
-		git_indexer_stream **out,
+GIT_EXTERN(int) git_indexer_new(
+		git_indexer **out,
 		const char *path,
 		git_odb *odb,
 		git_transfer_progress_callback progress_cb,
@@ -41,7 +41,7 @@ GIT_EXTERN(int) git_indexer_stream_new(
  * @param size the size of the data in bytes
  * @param stats stat storage
  */
-GIT_EXTERN(int) git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t size, git_transfer_progress *stats);
+GIT_EXTERN(int) git_indexer_append(git_indexer *idx, const void *data, size_t size, git_transfer_progress *stats);
 
 /**
  * Finalize the pack and index
@@ -50,7 +50,7 @@ GIT_EXTERN(int) git_indexer_stream_add(git_indexer_stream *idx, const void *data
  *
  * @param idx the indexer
  */
-GIT_EXTERN(int) git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *stats);
+GIT_EXTERN(int) git_indexer_commit(git_indexer *idx, git_transfer_progress *stats);
 
 /**
  * Get the packfile's hash
@@ -60,14 +60,14 @@ GIT_EXTERN(int) git_indexer_stream_finalize(git_indexer_stream *idx, git_transfe
  *
  * @param idx the indexer instance
  */
-GIT_EXTERN(const git_oid *) git_indexer_stream_hash(const git_indexer_stream *idx);
+GIT_EXTERN(const git_oid *) git_indexer_hash(const git_indexer *idx);
 
 /**
  * Free the indexer and its resources
  *
  * @param idx the indexer to free
  */
-GIT_EXTERN(void) git_indexer_stream_free(git_indexer_stream *idx);
+GIT_EXTERN(void) git_indexer_free(git_indexer *idx);
 
 GIT_END_DECL
 
diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h
index a6cb285..1b3e2fd 100644
--- a/include/git2/odb_backend.h
+++ b/include/git2/odb_backend.h
@@ -116,7 +116,7 @@ struct git_odb_stream {
 struct git_odb_writepack {
 	git_odb_backend *backend;
 
-	int (*add)(git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats);
+	int (*append)(git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats);
 	int (*commit)(git_odb_writepack *writepack, git_transfer_progress *stats);
 	void (*free)(git_odb_writepack *writepack);
 };
diff --git a/src/indexer.c b/src/indexer.c
index 9f55c8b..07d0073 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -29,7 +29,7 @@ struct entry {
 	uint64_t offset_long;
 };
 
-struct git_indexer_stream {
+struct git_indexer {
 	unsigned int parsed_header :1,
 		opened_pack :1,
 		have_stream :1,
@@ -63,7 +63,7 @@ struct delta_info {
 	git_off_t delta_off;
 };
 
-const git_oid *git_indexer_stream_hash(const git_indexer_stream *idx)
+const git_oid *git_indexer_hash(const git_indexer *idx)
 {
 	return &idx->hash;
 }
@@ -116,19 +116,19 @@ static int objects_cmp(const void *a, const void *b)
 	return git_oid__cmp(&entrya->oid, &entryb->oid);
 }
 
-int git_indexer_stream_new(
-		git_indexer_stream **out,
+int git_indexer_new(
+		git_indexer **out,
 		const char *prefix,
 		git_odb *odb,
 		git_transfer_progress_callback progress_cb,
 		void *progress_payload)
 {
-	git_indexer_stream *idx;
+	git_indexer *idx;
 	git_buf path = GIT_BUF_INIT;
 	static const char suff[] = "/pack";
 	int error;
 
-	idx = git__calloc(1, sizeof(git_indexer_stream));
+	idx = git__calloc(1, sizeof(git_indexer));
 	GITERR_CHECK_ALLOC(idx);
 	idx->odb = odb;
 	idx->progress_cb = progress_cb;
@@ -156,7 +156,7 @@ cleanup:
 }
 
 /* Try to store the delta so we can try to resolve it later */
-static int store_delta(git_indexer_stream *idx)
+static int store_delta(git_indexer *idx)
 {
 	struct delta_info *delta;
 
@@ -179,7 +179,7 @@ static void hash_header(git_hash_ctx *ctx, git_off_t len, git_otype type)
 	git_hash_update(ctx, buffer, hdrlen);
 }
 
-static int hash_object_stream(git_indexer_stream *idx, git_packfile_stream *stream)
+static int hash_object_stream(git_indexer*idx, git_packfile_stream *stream)
 {
 	ssize_t read;
 
@@ -199,7 +199,7 @@ static int hash_object_stream(git_indexer_stream *idx, git_packfile_stream *stre
 }
 
 /* In order to create the packfile stream, we need to skip over the delta base description */
-static int advance_delta_offset(git_indexer_stream *idx, git_otype type)
+static int advance_delta_offset(git_indexer *idx, git_otype type)
 {
 	git_mwindow *w = NULL;
 
@@ -218,7 +218,7 @@ static int advance_delta_offset(git_indexer_stream *idx, git_otype type)
 }
 
 /* Read from the stream and discard any output */
-static int read_object_stream(git_indexer_stream *idx, git_packfile_stream *stream)
+static int read_object_stream(git_indexer *idx, git_packfile_stream *stream)
 {
 	ssize_t read;
 
@@ -258,7 +258,7 @@ static int crc_object(uint32_t *crc_out, git_mwindow_file *mwf, git_off_t start,
 	return 0;
 }
 
-static int store_object(git_indexer_stream *idx)
+static int store_object(git_indexer *idx)
 {
 	int i, error;
 	khiter_t k;
@@ -316,7 +316,7 @@ on_error:
 	return -1;
 }
 
-static int save_entry(git_indexer_stream *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start)
+static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start)
 {
 	int i, error;
 	khiter_t k;
@@ -346,7 +346,7 @@ static int save_entry(git_indexer_stream *idx, struct entry *entry, struct git_p
 	return 0;
 }
 
-static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t entry_start)
+static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_start)
 {
 	git_oid oid;
 	size_t entry_size;
@@ -380,14 +380,14 @@ on_error:
 	return -1;
 }
 
-static int do_progress_callback(git_indexer_stream *idx, git_transfer_progress *stats)
+static int do_progress_callback(git_indexer *idx, git_transfer_progress *stats)
 {
 	if (!idx->progress_cb) return 0;
 	return idx->progress_cb(stats, idx->progress_payload);
 }
 
 /* Hash everything but the last 20B of input */
-static void hash_partially(git_indexer_stream *idx, const uint8_t *data, size_t size)
+static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size)
 {
 	size_t to_expell, to_keep;
 
@@ -423,7 +423,7 @@ static void hash_partially(git_indexer_stream *idx, const uint8_t *data, size_t 
 	idx->inbuf_len += size - to_expell;
 }
 
-int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t size, git_transfer_progress *stats)
+int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_transfer_progress *stats)
 {
 	int error = -1;
 	size_t processed;
@@ -583,7 +583,7 @@ on_error:
 	return error;
 }
 
-static int index_path_stream(git_buf *path, git_indexer_stream *idx, const char *suffix)
+static int index_path(git_buf *path, git_indexer *idx, const char *suffix)
 {
 	const char prefix[] = "pack-";
 	size_t slash = (size_t)path->size;
@@ -609,7 +609,7 @@ static int index_path_stream(git_buf *path, git_indexer_stream *idx, const char 
  * Rewind the packfile by the trailer, as we might need to fix the
  * packfile by injecting objects at the tail and must overwrite it.
  */
-static git_off_t seek_back_trailer(git_indexer_stream *idx)
+static git_off_t seek_back_trailer(git_indexer *idx)
 {
 	git_off_t off;
 
@@ -622,7 +622,7 @@ static git_off_t seek_back_trailer(git_indexer_stream *idx)
 	return off;
 }
 
-static int inject_object(git_indexer_stream *idx, git_oid *id)
+static int inject_object(git_indexer *idx, git_oid *id)
 {
 	git_odb_object *obj;
 	struct entry *entry;
@@ -684,7 +684,7 @@ cleanup:
 	return error;
 }
 
-static int fix_thin_pack(git_indexer_stream *idx, git_transfer_progress *stats)
+static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
 {
 	int error, found_ref_delta = 0;
 	unsigned int i;
@@ -741,7 +741,7 @@ static int fix_thin_pack(git_indexer_stream *idx, git_transfer_progress *stats)
 	return 0;
 }
 
-static int resolve_deltas(git_indexer_stream *idx, git_transfer_progress *stats)
+static int resolve_deltas(git_indexer *idx, git_transfer_progress *stats)
 {
 	unsigned int i;
 	struct delta_info *delta;
@@ -784,7 +784,7 @@ static int resolve_deltas(git_indexer_stream *idx, git_transfer_progress *stats)
 	return 0;
 }
 
-static int update_header_and_rehash(git_indexer_stream *idx, git_transfer_progress *stats)
+static int update_header_and_rehash(git_indexer *idx, git_transfer_progress *stats)
 {
 	void *ptr;
 	size_t chunk = 1024*1024;
@@ -833,7 +833,7 @@ static int update_header_and_rehash(git_indexer_stream *idx, git_transfer_progre
 	return 0;
 }
 
-int git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *stats)
+int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
 {
 	git_mwindow *w = NULL;
 	unsigned int i, long_offsets = 0, left;
@@ -965,7 +965,7 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *
 	git_filebuf_write(&index_file, &trailer_hash, sizeof(git_oid));
 
 	/* Figure out what the final name should be */
-	if (index_path_stream(&filename, idx, ".idx") < 0)
+	if (index_path(&filename, idx, ".idx") < 0)
 		goto on_error;
 
 	/* Commit file */
@@ -977,7 +977,7 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *
 	p_close(idx->pack->mwf.fd);
 	idx->pack->mwf.fd = -1;
 
-	if (index_path_stream(&filename, idx, ".pack") < 0)
+	if (index_path(&filename, idx, ".pack") < 0)
 		goto on_error;
 	/* And don't forget to rename the packfile to its new place. */
 	if (git_filebuf_commit_at(&idx->pack_file, filename.ptr, GIT_PACK_FILE_MODE) < 0)
@@ -994,7 +994,7 @@ on_error:
 	return -1;
 }
 
-void git_indexer_stream_free(git_indexer_stream *idx)
+void git_indexer_free(git_indexer *idx)
 {
 	khiter_t k;
 	unsigned int i;
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 4c7c822..12f4591 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -29,7 +29,7 @@ struct pack_backend {
 
 struct pack_writepack {
 	struct git_odb_writepack parent;
-	git_indexer_stream *indexer_stream;
+	git_indexer *indexer;
 };
 
 /**
@@ -511,13 +511,13 @@ static int pack_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb c
 	return 0;
 }
 
-static int pack_backend__writepack_add(struct git_odb_writepack *_writepack, const void *data, size_t size, git_transfer_progress *stats)
+static int pack_backend__writepack_append(struct git_odb_writepack *_writepack, const void *data, size_t size, git_transfer_progress *stats)
 {
 	struct pack_writepack *writepack = (struct pack_writepack *)_writepack;
 
 	assert(writepack);
 
-	return git_indexer_stream_add(writepack->indexer_stream, data, size, stats);
+	return git_indexer_append(writepack->indexer, data, size, stats);
 }
 
 static int pack_backend__writepack_commit(struct git_odb_writepack *_writepack, git_transfer_progress *stats)
@@ -526,7 +526,7 @@ static int pack_backend__writepack_commit(struct git_odb_writepack *_writepack, 
 
 	assert(writepack);
 
-	return git_indexer_stream_finalize(writepack->indexer_stream, stats);
+	return git_indexer_commit(writepack->indexer, stats);
 }
 
 static void pack_backend__writepack_free(struct git_odb_writepack *_writepack)
@@ -535,7 +535,7 @@ static void pack_backend__writepack_free(struct git_odb_writepack *_writepack)
 
 	assert(writepack);
 
-	git_indexer_stream_free(writepack->indexer_stream);
+	git_indexer_free(writepack->indexer);
 	git__free(writepack);
 }
 
@@ -557,14 +557,14 @@ static int pack_backend__writepack(struct git_odb_writepack **out,
 	writepack = git__calloc(1, sizeof(struct pack_writepack));
 	GITERR_CHECK_ALLOC(writepack);
 
-	if (git_indexer_stream_new(&writepack->indexer_stream,
+	if (git_indexer_new(&writepack->indexer,
 		backend->pack_folder, odb, progress_cb, progress_payload) < 0) {
 		git__free(writepack);
 		return -1;
 	}
 
 	writepack->parent.backend = _backend;
-	writepack->parent.add = pack_backend__writepack_add;
+	writepack->parent.append = pack_backend__writepack_append;
 	writepack->parent.commit = pack_backend__writepack_commit;
 	writepack->parent.free = pack_backend__writepack_free;
 
diff --git a/src/pack-objects.c b/src/pack-objects.c
index d2774ce..2d0f564 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -35,7 +35,7 @@ struct tree_walk_context {
 };
 
 struct pack_write_context {
-	git_indexer_stream *indexer;
+	git_indexer *indexer;
 	git_transfer_progress *stats;
 };
 
@@ -1241,7 +1241,7 @@ int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb)
 static int write_cb(void *buf, size_t len, void *payload)
 {
 	struct pack_write_context *ctx = payload;
-	return git_indexer_stream_add(ctx->indexer, buf, len, ctx->stats);
+	return git_indexer_append(ctx->indexer, buf, len, ctx->stats);
 }
 
 int git_packbuilder_write(
@@ -1250,13 +1250,13 @@ int git_packbuilder_write(
 	git_transfer_progress_callback progress_cb,
 	void *progress_cb_payload)
 {
-	git_indexer_stream *indexer;
+	git_indexer *indexer;
 	git_transfer_progress stats;
 	struct pack_write_context ctx;
 
 	PREPARE_PACK;
 
-	if (git_indexer_stream_new(
+	if (git_indexer_new(
 		&indexer, path, pb->odb, progress_cb, progress_cb_payload) < 0)
 		return -1;
 
@@ -1264,12 +1264,12 @@ int git_packbuilder_write(
 	ctx.stats = &stats;
 
 	if (git_packbuilder_foreach(pb, write_cb, &ctx) < 0 ||
-		git_indexer_stream_finalize(indexer, &stats) < 0) {
-		git_indexer_stream_free(indexer);
+		git_indexer_commit(indexer, &stats) < 0) {
+		git_indexer_free(indexer);
 		return -1;
 	}
 
-	git_indexer_stream_free(indexer);
+	git_indexer_free(indexer);
 	return 0;
 }
 
diff --git a/src/transports/local.c b/src/transports/local.c
index 3c1f988..3163d2e 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -459,7 +459,7 @@ static int foreach_cb(void *buf, size_t len, void *payload)
 	foreach_data *data = (foreach_data*)payload;
 
 	data->stats->received_bytes += len;
-	return data->writepack->add(data->writepack, buf, len, data->stats);
+	return data->writepack->append(data->writepack, buf, len, data->stats);
 }
 
 static int local_download_pack(
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index a129212..651901b 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -429,7 +429,7 @@ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack, 
 			return GIT_EUSER;
 		}
 
-		if (writepack->add(writepack, buf->data, buf->offset, stats) < 0)
+		if (writepack->append(writepack, buf->data, buf->offset, stats) < 0)
 			return -1;
 
 		gitno_consume_n(buf, buf->offset);
@@ -544,7 +544,7 @@ int git_smart__download_pack(
 			git__free(pkt);
 		} else if (pkt->type == GIT_PKT_DATA) {
 			git_pkt_data *p = (git_pkt_data *) pkt;
-			error = writepack->add(writepack, p->data, p->len, stats);
+			error = writepack->append(writepack, p->data, p->len, stats);
 
 			git__free(pkt);
 			if (error < 0)
diff --git a/tests-clar/pack/indexer.c b/tests-clar/pack/indexer.c
index 17ec7b3..e26b3ec 100644
--- a/tests-clar/pack/indexer.c
+++ b/tests-clar/pack/indexer.c
@@ -45,23 +45,23 @@ unsigned int base_obj_len = 2;
 
 void test_pack_indexer__out_of_order(void)
 {
-	git_indexer_stream *idx;
+	git_indexer *idx;
 	git_transfer_progress stats;
 
-	cl_git_pass(git_indexer_stream_new(&idx, ".", NULL, NULL, NULL));
-	cl_git_pass(git_indexer_stream_add(idx, out_of_order_pack, out_of_order_pack_len, &stats));
-	cl_git_pass(git_indexer_stream_finalize(idx, &stats));
+	cl_git_pass(git_indexer_new(&idx, ".", NULL, NULL, NULL));
+	cl_git_pass(git_indexer_append(idx, out_of_order_pack, out_of_order_pack_len, &stats));
+	cl_git_pass(git_indexer_commit(idx, &stats));
 
 	cl_assert_equal_i(stats.total_objects, 3);
 	cl_assert_equal_i(stats.received_objects, 3);
 	cl_assert_equal_i(stats.indexed_objects, 3);
 
-	git_indexer_stream_free(idx);
+	git_indexer_free(idx);
 }
 
 void test_pack_indexer__fix_thin(void)
 {
-	git_indexer_stream *idx;
+	git_indexer *idx;
 	git_transfer_progress stats;
 	git_repository *repo;
 	git_odb *odb;
@@ -75,9 +75,9 @@ void test_pack_indexer__fix_thin(void)
 	git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18");
 	cl_assert(!git_oid_cmp(&id, &should_id));
 
-	cl_git_pass(git_indexer_stream_new(&idx, ".", odb, NULL, NULL));
-	cl_git_pass(git_indexer_stream_add(idx, thin_pack, thin_pack_len, &stats));
-	cl_git_pass(git_indexer_stream_finalize(idx, &stats));
+	cl_git_pass(git_indexer_new(&idx, ".", odb, NULL, NULL));
+	cl_git_pass(git_indexer_append(idx, thin_pack, thin_pack_len, &stats));
+	cl_git_pass(git_indexer_commit(idx, &stats));
 
 	cl_assert_equal_i(stats.total_objects, 2);
 	cl_assert_equal_i(stats.received_objects, 2);
@@ -85,9 +85,9 @@ void test_pack_indexer__fix_thin(void)
 	cl_assert_equal_i(stats.local_objects, 1);
 
 	git_oid_fromstr(&should_id, "11f0f69b334728fdd8bc86b80499f22f29d85b15");
-	cl_assert(!git_oid_cmp(git_indexer_stream_hash(idx), &should_id));
+	cl_assert(!git_oid_cmp(git_indexer_hash(idx), &should_id));
 
-	git_indexer_stream_free(idx);
+	git_indexer_free(idx);
 	git_odb_free(odb);
 	git_repository_free(repo);
 
@@ -110,19 +110,19 @@ void test_pack_indexer__fix_thin(void)
 		cl_git_pass(p_stat(name, &st));
 		left = st.st_size;
 
-		cl_git_pass(git_indexer_stream_new(&idx, ".", NULL, NULL, NULL));
+		cl_git_pass(git_indexer_new(&idx, ".", NULL, NULL, NULL));
 		read = p_read(fd, buffer, sizeof(buffer));
 		cl_assert(read != -1);
 		p_close(fd);
 
-		cl_git_pass(git_indexer_stream_add(idx, buffer, read, &stats));
-		cl_git_pass(git_indexer_stream_finalize(idx, &stats));
+		cl_git_pass(git_indexer_append(idx, buffer, read, &stats));
+		cl_git_pass(git_indexer_commit(idx, &stats));
 
 		cl_assert_equal_i(stats.total_objects, 3);
 		cl_assert_equal_i(stats.received_objects, 3);
 		cl_assert_equal_i(stats.indexed_objects, 3);
 		cl_assert_equal_i(stats.local_objects, 0);
 
-		git_indexer_stream_free(idx);
+		git_indexer_free(idx);
 	}
 }
diff --git a/tests-clar/pack/packbuilder.c b/tests-clar/pack/packbuilder.c
index 6929256..ac6f731 100644
--- a/tests-clar/pack/packbuilder.c
+++ b/tests-clar/pack/packbuilder.c
@@ -8,7 +8,7 @@
 static git_repository *_repo;
 static git_revwalk *_revwalker;
 static git_packbuilder *_packbuilder;
-static git_indexer_stream *_indexer;
+static git_indexer *_indexer;
 static git_vector _commits;
 static int _commits_is_initialized;
 
@@ -40,7 +40,7 @@ void test_pack_packbuilder__cleanup(void)
 	git_revwalk_free(_revwalker);
 	_revwalker = NULL;
 
-	git_indexer_stream_free(_indexer);
+	git_indexer_free(_indexer);
 	_indexer = NULL;
 
 	cl_git_sandbox_cleanup();
@@ -79,7 +79,7 @@ static int feed_indexer(void *ptr, size_t len, void *payload)
 {
 	git_transfer_progress *stats = (git_transfer_progress *)payload;
 
-	return git_indexer_stream_add(_indexer, ptr, len, stats);
+	return git_indexer_append(_indexer, ptr, len, stats);
 }
 
 void test_pack_packbuilder__create_pack(void)
@@ -92,11 +92,11 @@ void test_pack_packbuilder__create_pack(void)
 
 	seed_packbuilder();
 
-	cl_git_pass(git_indexer_stream_new(&_indexer, ".", NULL, NULL, NULL));
+	cl_git_pass(git_indexer_new(&_indexer, ".", NULL, NULL, NULL));
 	cl_git_pass(git_packbuilder_foreach(_packbuilder, feed_indexer, &stats));
-	cl_git_pass(git_indexer_stream_finalize(_indexer, &stats));
+	cl_git_pass(git_indexer_commit(_indexer, &stats));
 
-	git_oid_fmt(hex, git_indexer_stream_hash(_indexer));
+	git_oid_fmt(hex, git_indexer_hash(_indexer));
 	git_buf_printf(&path, "pack-%s.pack", hex);
 
 	/*
@@ -131,18 +131,18 @@ void test_pack_packbuilder__create_pack(void)
 static git_transfer_progress stats;
 static int foreach_cb(void *buf, size_t len, void *payload)
 {
-	git_indexer_stream *idx = (git_indexer_stream *) payload;
-	cl_git_pass(git_indexer_stream_add(idx, buf, len, &stats));
+	git_indexer *idx = (git_indexer *) payload;
+	cl_git_pass(git_indexer_append(idx, buf, len, &stats));
 	return 0;
 }
 
 void test_pack_packbuilder__foreach(void)
 {
-	git_indexer_stream *idx;
+	git_indexer *idx;
 
 	seed_packbuilder();
-	cl_git_pass(git_indexer_stream_new(&idx, ".", NULL, NULL, NULL));
+	cl_git_pass(git_indexer_new(&idx, ".", NULL, NULL, NULL));
 	cl_git_pass(git_packbuilder_foreach(_packbuilder, foreach_cb, idx));
-	cl_git_pass(git_indexer_stream_finalize(idx, &stats));
-	git_indexer_stream_free(idx);
+	cl_git_pass(git_indexer_commit(idx, &stats));
+	git_indexer_free(idx);
 }