{"thread":{"id":"4600","subject":"[PATCH 3/4] Retire git-clone-pack","startedAt":"2006-06-21T08:14:07Z","lastAt":"2006-06-21T08:14:07Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"22177","messageId":"7vhd2f3oz4.fsf@assigned-by-dhcp.cox.net","threadId":"4600","inReplyTo":null,"subject":"[PATCH 3/4] Retire git-clone-pack","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-21T08:14:07Z","receivedAt":"2006-06-21T08:14:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The program is not used by git-clone since git-fetch-pack was extended\nto allow its caller do what git-clone-pack alone did, and git-clone was\nupdated to use it.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n * Logically this does not belong to the series, but retiring\n   clone-pack lets me get away without having to update the\n   callers of the function I'll be updating in the next one.\n\n .gitignore                         |    1 \n Documentation/git-clone-pack.txt   |   64 ------------\n Documentation/git-clone.txt        |    4 -\n Documentation/git-receive-pack.txt |    3 -\n Documentation/git-upload-pack.txt  |    2 \n Documentation/git.txt              |    6 -\n INSTALL                            |    2 \n Makefile                           |    2 \n clone-pack.c                       |  186 ------------------------------------\n 9 files changed, 7 insertions(+), 263 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex afd0876..65aa939 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -17,7 +17,6 @@ git-cherry\n git-cherry-pick\n git-clean\n git-clone\n-git-clone-pack\n git-commit\n git-commit-tree\n git-convert-objects\ndiff --git a/Documentation/git-clone-pack.txt b/Documentation/git-clone-pack.txt\ndeleted file mode 100644\nindex 09f43ee..0000000\n--- a/Documentation/git-clone-pack.txt\n+++ /dev/null\n@@ -1,64 +0,0 @@\n-git-clone-pack(1)\n-=================\n-\n-NAME\n-----\n-git-clone-pack - Clones a repository by receiving packed objects\n-\n-\n-SYNOPSIS\n---------\n-'git-clone-pack' [--exec=<git-upload-pack>] [<host>:]<directory> [<head>...]\n-\n-DESCRIPTION\n------------\n-Clones a repository into the current repository by invoking\n-'git-upload-pack', possibly on the remote host via ssh, in\n-the named repository, and stores the sent pack in the local\n-repository.\n-\n-OPTIONS\n--------\n---exec=<git-upload-pack>::\n-\tUse this to specify the path to 'git-upload-pack' on the\n-\tremote side, if it is not found on your $PATH.\n-\tInstallations of sshd ignore the user's environment\n-\tsetup scripts for login shells (e.g. .bash_profile) and\n-\tyour privately installed git may not be found on the system\n-\tdefault $PATH.  Another workaround suggested is to set\n-\tup your $PATH in \".bashrc\", but this flag is for people\n-\twho do not want to pay the overhead for non-interactive\n-\tshells by having a lean .bashrc file (they set most of\n-\tthe things up in .bash_profile).\n-\n-<host>::\n-\tA remote host that houses the repository.  When this\n-\tpart is specified, 'git-upload-pack' is invoked via\n-\tssh.\n-\n-<directory>::\n-\tThe repository to sync from.\n-\n-<head>...::\n-\tThe heads to update.  This is relative to $GIT_DIR\n-\t(e.g. \"HEAD\", \"refs/heads/master\").  When unspecified,\n-\tall heads are updated to match the remote repository.\n-+\n-Usually all the refs from existing repository are stored\n-under the same name in the new repository.  Giving explicit\n-<head> arguments instead writes the object names and refs to\n-the standard output, just like get-fetch-pack does.\n-\n-Author\n-------\n-Written by Linus Torvalds <torvalds@osdl.org>\n-\n-Documentation\n---------------\n-Documentation by Junio C Hamano.\n-\n-\n-GIT\n----\n-Part of the gitlink:git[7] suite\n-\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex a90521e..f973c64 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -62,7 +62,7 @@ OPTIONS\n --quiet::\n -q::\n \tOperate quietly.  This flag is passed to \"rsync\" and\n-\t\"git-clone-pack\" commands when given.\n+\t\"git-fetch-pack\" commands when given.\n \n -n::\n \tNo checkout of HEAD is performed after the clone is complete.\n@@ -85,7 +85,7 @@ OPTIONS\n --upload-pack <upload-pack>::\n -u <upload-pack>::\n \tWhen given, and the repository to clone from is handled\n-\tby 'git-clone-pack', '--exec=<upload-pack>' is passed to\n+\tby 'git-fetch-pack', '--exec=<upload-pack>' is passed to\n \tthe command to specify non-default path for the command\n \trun on the other end.\n \ndiff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt\nindex 60debca..f9457d4 100644\n--- a/Documentation/git-receive-pack.txt\n+++ b/Documentation/git-receive-pack.txt\n@@ -18,8 +18,7 @@ information fed from the remote end.\n This command is usually not invoked directly by the end user.\n The UI for the protocol is on the 'git-send-pack' side, and the\n program pair is meant to be used to push updates to remote\n-repository.  For pull operations, see 'git-fetch-pack' and\n-'git-clone-pack'.\n+repository.  For pull operations, see 'git-fetch-pack'.\n \n The command allows for creation and fast forwarding of sha1 refs\n (heads/tags) on the remote end (strictly speaking, it is the\ndiff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt\nindex 4795e98..b2c9307 100644\n--- a/Documentation/git-upload-pack.txt\n+++ b/Documentation/git-upload-pack.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n \n DESCRIPTION\n -----------\n-Invoked by 'git-clone-pack' and/or 'git-fetch-pack', learns what\n+Invoked by 'git-fetch-pack', learns what\n objects the other side is missing, and sends them after packing.\n \n This command is usually not invoked directly by the end user.\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex d4472b5..51f20c6 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -192,10 +192,6 @@ the working tree.\n Synching repositories\n ~~~~~~~~~~~~~~~~~~~~~\n \n-gitlink:git-clone-pack[1]::\n-\tClones a repository into the current repository (engine\n-\tfor ssh and local transport).\n-\n gitlink:git-fetch-pack[1]::\n \tUpdates from a remote repository (engine for ssh and\n \tlocal transport).\n@@ -237,7 +233,7 @@ gitlink:git-update-server-info[1]::\n \tclients discover references and packs on it.\n \n gitlink:git-upload-pack[1]::\n-\tInvoked by 'git-clone-pack' and 'git-fetch-pack' to push\n+\tInvoked by 'git-fetch-pack' to push\n \twhat are asked for.\n \n gitlink:git-upload-tar[1]::\ndiff --git a/INSTALL b/INSTALL\nindex 63af8ec..f8337e2 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -96,7 +96,7 @@ Issues of note:\n \n \t$ mkdir manual && cd manual\n \t$ git init-db\n-\t$ git clone-pack git://git.kernel.org/pub/scm/git/git.git man html |\n+\t$ git fetch-pack git://git.kernel.org/pub/scm/git/git.git man html |\n \t  while read a b\n \t  do\n \t    echo $a >.git/$b\ndiff --git a/Makefile b/Makefile\nindex 0887945..ae5e8d7 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -149,7 +149,7 @@ SIMPLE_PROGRAMS = \\\n \n # ... and all the rest that could be moved out of bindir to gitexecdir\n PROGRAMS = \\\n-\tgit-checkout-index$X git-clone-pack$X \\\n+\tgit-checkout-index$X \\\n \tgit-convert-objects$X git-fetch-pack$X git-fsck-objects$X \\\n \tgit-hash-object$X git-index-pack$X git-local-fetch$X \\\n \tgit-mailinfo$X git-merge-base$X \\\ndiff --git a/clone-pack.c b/clone-pack.c\ndeleted file mode 100644\nindex a4370f5..0000000\n--- a/clone-pack.c\n+++ /dev/null\n@@ -1,186 +0,0 @@\n-#include \"cache.h\"\n-#include \"refs.h\"\n-#include \"pkt-line.h\"\n-\n-static const char clone_pack_usage[] =\n-\"git-clone-pack [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*\";\n-static const char *exec = \"git-upload-pack\";\n-\n-static int quiet = 0;\n-\n-static void clone_handshake(int fd[2], struct ref *ref)\n-{\n-\tunsigned char sha1[20];\n-\n-\twhile (ref) {\n-\t\tpacket_write(fd[1], \"want %s\\n\", sha1_to_hex(ref->old_sha1));\n-\t\tref = ref->next;\n-\t}\n-\tpacket_flush(fd[1]);\n-\n-\t/* We don't have nuttin' */\n-\tpacket_write(fd[1], \"done\\n\");\n-\tif (get_ack(fd[0], sha1))\n-\t\terror(\"Huh! git-clone-pack got positive ack for %s\", sha1_to_hex(sha1));\n-}\n-\n-static int is_master(struct ref *ref)\n-{\n-\treturn !strcmp(ref->name, \"refs/heads/master\");\n-}\n-\n-static void write_one_ref(struct ref *ref)\n-{\n-\tchar *path = git_path(\"%s\", ref->name);\n-\tint fd;\n-\tchar *hex;\n-\n-\tif (!strncmp(ref->name, \"refs/\", 5) &&\n-\t    check_ref_format(ref->name + 5)) {\n-\t\terror(\"refusing to create funny ref '%s' locally\", ref->name);\n-\t\treturn;\n-\t}\n-\n-\tif (safe_create_leading_directories(path))\n-\t\tdie(\"unable to create leading directory for %s\", ref->name);\n-\tfd = open(path, O_CREAT | O_EXCL | O_WRONLY, 0666);\n-\tif (fd < 0)\n-\t\tdie(\"unable to create ref %s\", ref->name);\n-\thex = sha1_to_hex(ref->old_sha1);\n-\thex[40] = '\\n';\n-\tif (write(fd, hex, 41) != 41)\n-\t\tdie(\"unable to write ref %s\", ref->name);\n-\tclose(fd);\n-}\n-\n-static void write_refs(struct ref *ref)\n-{\n-\tstruct ref *head = NULL, *head_ptr, *master_ref;\n-\tchar *head_path;\n-\n-\t/* Upload-pack must report HEAD first */\n-\tif (!strcmp(ref->name, \"HEAD\")) {\n-\t\thead = ref;\n-\t\tref = ref->next;\n-\t}\n-\thead_ptr = NULL;\n-\tmaster_ref = NULL;\n-\twhile (ref) {\n-\t\tif (is_master(ref))\n-\t\t\tmaster_ref = ref;\n-\t\tif (head &&\n-\t\t    !memcmp(ref->old_sha1, head->old_sha1, 20) &&\n-\t\t    !strncmp(ref->name, \"refs/heads/\",11) &&\n-\t\t    (!head_ptr || ref == master_ref))\n-\t\t\thead_ptr = ref;\n-\n-\t\twrite_one_ref(ref);\n-\t\tref = ref->next;\n-\t}\n-\tif (!head) {\n-\t\tfprintf(stderr, \"No HEAD in remote.\\n\");\n-\t\treturn;\n-\t}\n-\n-\thead_path = strdup(git_path(\"HEAD\"));\n-\tif (!head_ptr) {\n-\t\t/*\n-\t\t * If we had a master ref, and it wasn't HEAD, we need to undo the\n-\t\t * symlink, and write a standalone HEAD. Give a warning, because that's\n-\t\t * really really wrong.\n-\t\t */\n-\t\tif (master_ref) {\n-\t\t\terror(\"HEAD doesn't point to any refs! Making standalone HEAD\");\n-\t\t\tunlink(head_path);\n-\t\t}\n-\t\twrite_one_ref(head);\n-\t\tfree(head_path);\n-\t\treturn;\n-\t}\n-\n-\t/* We reset to the master branch if it's available */\n-\tif (master_ref)\n-\t\treturn;\n-\n-\tfprintf(stderr, \"Setting HEAD to %s\\n\", head_ptr->name);\n-\n-\t/*\n-\t * Uhhuh. Other end didn't have master. We start HEAD off with\n-\t * the first branch with the same value.\n-\t */\n-\tif (create_symref(head_path, head_ptr->name) < 0)\n-\t\tdie(\"unable to link HEAD to %s\", head_ptr->name);\n-\tfree(head_path);\n-}\n-\n-static int clone_pack(int fd[2], int nr_match, char **match)\n-{\n-\tstruct ref *refs;\n-\tint status;\n-\n-\tget_remote_heads(fd[0], &refs, nr_match, match, 1);\n-\tif (!refs) {\n-\t\tpacket_flush(fd[1]);\n-\t\tdie(\"no matching remote head\");\n-\t}\n-\tclone_handshake(fd, refs);\n-\n-\tstatus = receive_keep_pack(fd, \"git-clone-pack\", quiet);\n-\tif (!quiet)\n-\t\tfprintf(stderr, \"\\n\");\n-\n-\tif (!status) {\n-\t\tif (nr_match == 0)\n-\t\t\twrite_refs(refs);\n-\t\telse\n-\t\t\twhile (refs) {\n-\t\t\t\tprintf(\"%s %s\\n\",\n-\t\t\t\t       sha1_to_hex(refs->old_sha1),\n-\t\t\t\t       refs->name);\n-\t\t\t\trefs = refs->next;\n-\t\t\t}\n-\t}\n-\treturn status;\n-}\n-\n-int main(int argc, char **argv)\n-{\n-\tint i, ret, nr_heads;\n-\tchar *dest = NULL, **heads;\n-\tint fd[2];\n-\tpid_t pid;\n-\n-\tsetup_git_directory();\n-\n-\tnr_heads = 0;\n-\theads = NULL;\n-\tfor (i = 1; i < argc; i++) {\n-\t\tchar *arg = argv[i];\n-\n-\t\tif (*arg == '-') {\n-\t\t\tif (!strcmp(\"-q\", arg)) {\n-\t\t\t\tquiet = 1;\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\tif (!strncmp(\"--exec=\", arg, 7)) {\n-\t\t\t\texec = arg + 7;\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\tusage(clone_pack_usage);\n-\t\t}\n-\t\tdest = arg;\n-\t\theads = argv + i + 1;\n-\t\tnr_heads = argc - i - 1;\n-\t\tbreak;\n-\t}\n-\tif (!dest)\n-\t\tusage(clone_pack_usage);\n-\tpid = git_connect(fd, dest, exec);\n-\tif (pid < 0)\n-\t\treturn 1;\n-\tret = clone_pack(fd, nr_heads, heads);\n-\tclose(fd[0]);\n-\tclose(fd[1]);\n-\tfinish_connect(pid);\n-\treturn ret;\n-}\n-- \n1.4.0.gbb3f\n"}]}