{"thread":{"id":"30706","subject":"[PATCH] tweak \"bundle verify\" of a complete history","startedAt":"2012-06-04T18:51:13Z","lastAt":"2012-06-04T18:51:13Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"192834","messageId":"7v1uluud0e.fsf@alter.siamese.dyndns.org","threadId":"30706","inReplyTo":null,"subject":"[PATCH] tweak \"bundle verify\" of a complete history","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-04T18:51:13Z","receivedAt":"2012-06-04T18:51:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"A bundle that records a complete history without prerequiste is a\nuseful way to sneakernet the sources of your configuration files\nunder your home directory, etc.  E.g.\n\n    $ GIT_DIR=/srv/git/homesrc.git git bundle create x.bndl HEAD master\n\nRunning \"git bundle verify\" on such a \"complete\" bundle, however,\ngives somewhat a funny output.\n\n    $ git bundle verify x.bndl\n    The bundle contains 2 refs\n    b2611f37ebc7ed6435a72d77fbc5f8b48a7d7146 HEAD\n    b2611f37ebc7ed6435a72d77fbc5f8b48a7d7146 refs/heads/master\n    The bundle requires these 0 refs\n    x.bndl is okay\n\nReword \"requires these 0 refs\" to say \"The bundle records a complete\nhistory\" instead.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * verify_bundle() is to check if you can fetch from the bundle into\n   the current repository by verifying that you have the necessary\n   commits and history behind them.  However, the command line UI\n   \"git bundle verify x.bndl\" may look to the end users that it may\n   also check the integrity of what is recorded in the bundle.  We\n   may want to add fsck-like check to this function to make sure\n   there is no corruption in the pack data.\n\n   That is not the problem this patch tries to solve.  Hint, hint...\n\n bundle.c | 16 ++++++++++------\n 1 file changed, 10 insertions(+), 6 deletions(-)\n\ndiff --git a/bundle.c b/bundle.c\nindex 8d31b98..8d12816 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -188,12 +188,16 @@ int verify_bundle(struct bundle_header *header, int verbose)\n \t\t\t     r->nr),\n \t\t\t  r->nr);\n \t\tlist_refs(r, 0, NULL);\n-\t\tr = &header->prerequisites;\n-\t\tprintf_ln(Q_(\"The bundle requires this ref\",\n-\t\t\t     \"The bundle requires these %d refs\",\n-\t\t\t     r->nr),\n-\t\t\t  r->nr);\n-\t\tlist_refs(r, 0, NULL);\n+\t\tif (!r->nr) {\n+\t\t\tprintf_ln(_(\"The bundle records a complete history.\"));\n+\t\t} else {\n+\t\t\tr = &header->prerequisites;\n+\t\t\tprintf_ln(Q_(\"The bundle requires this ref\",\n+\t\t\t\t     \"The bundle requires these %d refs\",\n+\t\t\t\t     r->nr),\n+\t\t\t\t  r->nr);\n+\t\t\tlist_refs(r, 0, NULL);\n+\t\t}\n \t}\n \treturn ret;\n }\n\t\n"}]}