{"thread":{"id":"12482","subject":"[PATCH v2 2/3] Teach fetch-pack/upload-pack about --auto-include-tag","startedAt":"2008-03-04T03:27:33Z","lastAt":"2008-03-04T03:27:33Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"70884","messageId":"20080304032733.GB16462@spearce.org","threadId":"12482","inReplyTo":null,"subject":"[PATCH v2 2/3] Teach fetch-pack/upload-pack about --auto-include-tag","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-03-04T03:27:33Z","receivedAt":"2008-03-04T03:27:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"The new protocol extension \"auto-include-tag\" allows the client side\nof the connection (fetch-pack) to request that the server side of the\nnative git protocol (upload-pack / pack-objects) use --auto-include-tag\nas it prepares the packfile, thus ensuring that an annotated tag object\nwill be included in the resulting packfile if the object it refers to\nwas also included into the packfile.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n Documentation/git-fetch-pack.txt |    8 +++++++-\n builtin-fetch-pack.c             |    9 +++++++--\n fetch-pack.h                     |    3 ++-\n upload-pack.c                    |   10 ++++++++--\n 4 files changed, 24 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt\nindex 2b8ffe5..4f85898 100644\n--- a/Documentation/git-fetch-pack.txt\n+++ b/Documentation/git-fetch-pack.txt\n@@ -8,7 +8,7 @@ git-fetch-pack - Receive missing objects from another repository\n \n SYNOPSIS\n --------\n-'git-fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]\n+'git-fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--auto-include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]\n \n DESCRIPTION\n -----------\n@@ -45,6 +45,12 @@ OPTIONS\n \tSpend extra cycles to minimize the number of objects to be sent.\n \tUse it on slower connection.\n \n+\\--auto-include-tag::\n+\tIf the remote side supports it, annotated tags objects will\n+\tbe downloaded on the same connection as the other objects if\n+\tthe object the tag references is downloaded.  The caller must\n+\totherwise determine the tags this option made available.\n+\n \\--upload-pack=<git-upload-pack>::\n \tUse this to specify the path to 'git-upload-pack' on the\n \tremote side, if is not found on your $PATH.\ndiff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c\nindex b23e886..3701ee0 100644\n--- a/builtin-fetch-pack.c\n+++ b/builtin-fetch-pack.c\n@@ -18,7 +18,7 @@ static struct fetch_pack_args args = {\n };\n \n static const char fetch_pack_usage[] =\n-\"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]\";\n+\"git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--auto-include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]\";\n \n #define COMPLETE\t(1U << 0)\n #define COMMON\t\t(1U << 1)\n@@ -174,13 +174,14 @@ static int find_common(int fd[2], unsigned char *result_sha1,\n \t\t}\n \n \t\tif (!fetching)\n-\t\t\tpacket_write(fd[1], \"want %s%s%s%s%s%s%s\\n\",\n+\t\t\tpacket_write(fd[1], \"want %s%s%s%s%s%s%s%s\\n\",\n \t\t\t\t     sha1_to_hex(remote),\n \t\t\t\t     (multi_ack ? \" multi_ack\" : \"\"),\n \t\t\t\t     (use_sideband == 2 ? \" side-band-64k\" : \"\"),\n \t\t\t\t     (use_sideband == 1 ? \" side-band\" : \"\"),\n \t\t\t\t     (args.use_thin_pack ? \" thin-pack\" : \"\"),\n \t\t\t\t     (args.no_progress ? \" no-progress\" : \"\"),\n+\t\t\t\t     (args.auto_include_tag ? \" auto-include-tag\" : \"\"),\n \t\t\t\t     \" ofs-delta\");\n \t\telse\n \t\t\tpacket_write(fd[1], \"want %s\\n\", sha1_to_hex(remote));\n@@ -680,6 +681,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)\n \t\t\t\targs.use_thin_pack = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tif (!strcmp(\"--auto-include-tag\", arg)) {\n+\t\t\t\targs.auto_include_tag = 1;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tif (!strcmp(\"--all\", arg)) {\n \t\t\t\targs.fetch_all = 1;\n \t\t\t\tcontinue;\ndiff --git a/fetch-pack.h b/fetch-pack.h\nindex 8d35ef6..98d6a39 100644\n--- a/fetch-pack.h\n+++ b/fetch-pack.h\n@@ -12,7 +12,8 @@ struct fetch_pack_args\n \t\tuse_thin_pack:1,\n \t\tfetch_all:1,\n \t\tverbose:1,\n-\t\tno_progress:1;\n+\t\tno_progress:1,\n+\t\tauto_include_tag:1;\n };\n \n struct ref *fetch_pack(struct fetch_pack_args *args,\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 660134a..f9ffe09 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -27,7 +27,8 @@ static const char upload_pack_usage[] = \"git-upload-pack [--strict] [--timeout=n\n static unsigned long oldest_have;\n \n static int multi_ack, nr_our_refs;\n-static int use_thin_pack, use_ofs_delta, no_progress;\n+static int use_thin_pack, use_ofs_delta, use_auto_include_tag;\n+static int no_progress;\n static struct object_array have_obj;\n static struct object_array want_obj;\n static unsigned int timeout;\n@@ -162,6 +163,8 @@ static void create_pack_file(void)\n \t\targv[arg++] = \"--progress\";\n \tif (use_ofs_delta)\n \t\targv[arg++] = \"--delta-base-offset\";\n+\tif (use_auto_include_tag)\n+\t\targv[arg++] = \"--auto-include-tag\";\n \targv[arg++] = NULL;\n \n \tmemset(&pack_objects, 0, sizeof(pack_objects));\n@@ -494,6 +497,8 @@ static void receive_needs(void)\n \t\t\tuse_sideband = DEFAULT_PACKET_MAX;\n \t\tif (strstr(line+45, \"no-progress\"))\n \t\t\tno_progress = 1;\n+\t\tif (strstr(line+45, \"auto-include-tag\"))\n+\t\t\tuse_auto_include_tag = 1;\n \n \t\t/* We have sent all our refs already, and the other end\n \t\t * should have chosen out of them; otherwise they are\n@@ -565,7 +570,8 @@ static void receive_needs(void)\n static int send_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)\n {\n \tstatic const char *capabilities = \"multi_ack thin-pack side-band\"\n-\t\t\" side-band-64k ofs-delta shallow no-progress\";\n+\t\t\" side-band-64k ofs-delta shallow no-progress\"\n+\t\t\" auto-include-tag\";\n \tstruct object *o = parse_object(sha1);\n \n \tif (!o)\n-- \n1.5.4.3.529.gb25fb\n\n"}]}