tweak "bundle verify" of a complete history
A bundle that records a complete history without prerequiste is a useful way to sneakernet the sources of your configuration files under your home directory, etc. E.g. $ GIT_DIR=/srv/git/homesrc.git git bundle create x.bndl HEAD master Running "git bundle verify" on such a "complete" bundle, however, gives somewhat a funny output. $ git bundle verify x.bndl The bundle contains 2 refs b2611f37ebc7ed6435a72d77fbc5f8b48a7d7146 HEAD b2611f37ebc7ed6435a72d77fbc5f8b48a7d7146 refs/heads/master The bundle requires these 0 refs x.bndl is okay Reword "requires these 0 refs" to say "The bundle records a complete history" instead. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 4, 2012 at 11:51 UTC
8c3710fd3011d75b9768749bfaf5ac2f31b96085
1 file changed
+10
-6
bundle.c
+10
-6
@@ -188,12 +188,16 @@ int verify_bundle(struct bundle_header *header, int verbose)
188
r->nr),
189
r->nr);
190
list_refs(r, 0, NULL);
191
- r = &header->prerequisites;
192
- printf_ln(Q_("The bundle requires this ref",
193
- "The bundle requires these %d refs",
194
- r->nr),
195
- r->nr);
196
- list_refs(r, 0, NULL);
191
+ if (!r->nr) {
192
+ printf_ln(_("The bundle records a complete history."));
193
+ } else {
194
+ r = &header->prerequisites;
195
+ printf_ln(Q_("The bundle requires this ref",
196
+ "The bundle requires these %d refs",
197
+ r->nr),
198
+ r->nr);
199
+ list_refs(r, 0, NULL);
200
+ }
201
}
202
return ret;
203
}