Commit ebbd48f00e87eab699862f03a457571ead3c53b1

Carlos Martín Nieto 2013-10-23T14:22:44

examples: show used local objects in fetch Show how many local objects were used to fix the thin pack in our fetch example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/examples/network/fetch.c b/examples/network/fetch.c
index ce016ce..50ec003 100644
--- a/examples/network/fetch.c
+++ b/examples/network/fetch.c
@@ -125,8 +125,13 @@ int fetch(git_repository *repo, int argc, char **argv)
 	pthread_join(worker, NULL);
 #endif
 
-	printf("\rReceived %d/%d objects in %zu bytes\n",
+	if (stats->local_objects > 0) {
+		printf("\rReceived %d/%d objects in %zu bytes (used %d local objects)\n",
+		       stats->indexed_objects, stats->total_objects, stats->received_bytes, stats->local_objects);
+	} else{
+		printf("\rReceived %d/%d objects in %zu bytes\n",
 			stats->indexed_objects, stats->total_objects, stats->received_bytes);
+	}
 
 	// Disconnect the underlying connection to prevent from idling.
 	git_remote_disconnect(remote);