git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] tweak "bundle verify" of a complete history

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 4, 2012, 18:51 UTC
Message-ID
<7v1uluud0e.fsf@alter.siamese.dyndns.org>

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>
---
 * verify_bundle() is to check if you can fetch from the bundle into
   the current repository by verifying that you have the necessary
   commits and history behind them.  However, the command line UI
   "git bundle verify x.bndl" may look to the end users that it may
   also check the integrity of what is recorded in the bundle.  We
   may want to add fsck-like check to this function to make sure
   there is no corruption in the pack data.
   That is not the problem this patch tries to solve.  Hint, hint...
 bundle.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/bundle.c b/bundle.c
index 8d31b98..8d12816 100644
--- a/bundle.c
+++ b/bundle.c
@@ -188,12 +188,16 @@ int verify_bundle(struct bundle_header *header, int verbose)
 			     r->nr),
 			  r->nr);
 		list_refs(r, 0, NULL);
-		r = &header->prerequisites;
-		printf_ln(Q_("The bundle requires this ref",
-			     "The bundle requires these %d refs",
-			     r->nr),
-			  r->nr);
-		list_refs(r, 0, NULL);
+		if (!r->nr) {
+			printf_ln(_("The bundle records a complete history."));
+		} else {
+			r = &header->prerequisites;
+			printf_ln(Q_("The bundle requires this ref",
+				     "The bundle requires these %d refs",
+				     r->nr),
+				  r->nr);
+			list_refs(r, 0, NULL);
+		}
 	}
 	return ret;
 }
	
Message 1 of 1 in “tweak "bundle verify" of a complete history”
  1. tweak "bundle verify" of a complete historyJunio C Hamano, Jun 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.