{"thread":{"id":"44782","subject":"[PATCH] contrib: remove git-convert-objects","startedAt":"2016-12-28T18:02:15Z","lastAt":"2017-01-19T22:04:38Z","messageCount":4,"participants":["Stefan Beller","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"308457","messageId":"20161228180205.29213-1-sbeller@google.com","threadId":"44782","inReplyTo":null,"subject":"[PATCH] contrib: remove git-convert-objects","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-12-28T18:02:05Z","receivedAt":"2016-12-28T18:02:15Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"git-convert-objects, originally named git-convert-cache was used in\nearly 2005 to convert to a new repository format, e.g. adding an author\ndate.\n\nBy now the need for conversion of the very early repositories is less\nrelevant, we no longer need to keep it in contrib; remove it.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n contrib/convert-objects/convert-objects.c       | 329 ------------------------\n contrib/convert-objects/git-convert-objects.txt |  29 ---\n 2 files changed, 358 deletions(-)\n delete mode 100644 contrib/convert-objects/convert-objects.c\n delete mode 100644 contrib/convert-objects/git-convert-objects.txt\n\ndiff --git a/contrib/convert-objects/convert-objects.c b/contrib/convert-objects/convert-objects.c\ndeleted file mode 100644\nindex f3b57bf1d2..0000000000\n--- a/contrib/convert-objects/convert-objects.c\n+++ /dev/null\n@@ -1,329 +0,0 @@\n-#include \"cache.h\"\n-#include \"blob.h\"\n-#include \"commit.h\"\n-#include \"tree.h\"\n-\n-struct entry {\n-\tunsigned char old_sha1[20];\n-\tunsigned char new_sha1[20];\n-\tint converted;\n-};\n-\n-#define MAXOBJECTS (1000000)\n-\n-static struct entry *convert[MAXOBJECTS];\n-static int nr_convert;\n-\n-static struct entry * convert_entry(unsigned char *sha1);\n-\n-static struct entry *insert_new(unsigned char *sha1, int pos)\n-{\n-\tstruct entry *new = xcalloc(1, sizeof(struct entry));\n-\thashcpy(new->old_sha1, sha1);\n-\tmemmove(convert + pos + 1, convert + pos, (nr_convert - pos) * sizeof(struct entry *));\n-\tconvert[pos] = new;\n-\tnr_convert++;\n-\tif (nr_convert == MAXOBJECTS)\n-\t\tdie(\"you're kidding me - hit maximum object limit\");\n-\treturn new;\n-}\n-\n-static struct entry *lookup_entry(unsigned char *sha1)\n-{\n-\tint low = 0, high = nr_convert;\n-\n-\twhile (low < high) {\n-\t\tint next = (low + high) / 2;\n-\t\tstruct entry *n = convert[next];\n-\t\tint cmp = hashcmp(sha1, n->old_sha1);\n-\t\tif (!cmp)\n-\t\t\treturn n;\n-\t\tif (cmp < 0) {\n-\t\t\thigh = next;\n-\t\t\tcontinue;\n-\t\t}\n-\t\tlow = next+1;\n-\t}\n-\treturn insert_new(sha1, low);\n-}\n-\n-static void convert_binary_sha1(void *buffer)\n-{\n-\tstruct entry *entry = convert_entry(buffer);\n-\thashcpy(buffer, entry->new_sha1);\n-}\n-\n-static void convert_ascii_sha1(void *buffer)\n-{\n-\tunsigned char sha1[20];\n-\tstruct entry *entry;\n-\n-\tif (get_sha1_hex(buffer, sha1))\n-\t\tdie(\"expected sha1, got '%s'\", (char *) buffer);\n-\tentry = convert_entry(sha1);\n-\tmemcpy(buffer, sha1_to_hex(entry->new_sha1), 40);\n-}\n-\n-static unsigned int convert_mode(unsigned int mode)\n-{\n-\tunsigned int newmode;\n-\n-\tnewmode = mode & S_IFMT;\n-\tif (S_ISREG(mode))\n-\t\tnewmode |= (mode & 0100) ? 0755 : 0644;\n-\treturn newmode;\n-}\n-\n-static int write_subdirectory(void *buffer, unsigned long size, const char *base, int baselen, unsigned char *result_sha1)\n-{\n-\tchar *new = xmalloc(size);\n-\tunsigned long newlen = 0;\n-\tunsigned long used;\n-\n-\tused = 0;\n-\twhile (size) {\n-\t\tint len = 21 + strlen(buffer);\n-\t\tchar *path = strchr(buffer, ' ');\n-\t\tunsigned char *sha1;\n-\t\tunsigned int mode;\n-\t\tchar *slash, *origpath;\n-\n-\t\tif (!path || strtoul_ui(buffer, 8, &mode))\n-\t\t\tdie(\"bad tree conversion\");\n-\t\tmode = convert_mode(mode);\n-\t\tpath++;\n-\t\tif (memcmp(path, base, baselen))\n-\t\t\tbreak;\n-\t\torigpath = path;\n-\t\tpath += baselen;\n-\t\tslash = strchr(path, '/');\n-\t\tif (!slash) {\n-\t\t\tnewlen += sprintf(new + newlen, \"%o %s\", mode, path);\n-\t\t\tnew[newlen++] = '\\0';\n-\t\t\thashcpy((unsigned char *)new + newlen, (unsigned char *) buffer + len - 20);\n-\t\t\tnewlen += 20;\n-\n-\t\t\tused += len;\n-\t\t\tsize -= len;\n-\t\t\tbuffer = (char *) buffer + len;\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\tnewlen += sprintf(new + newlen, \"%o %.*s\", S_IFDIR, (int)(slash - path), path);\n-\t\tnew[newlen++] = 0;\n-\t\tsha1 = (unsigned char *)(new + newlen);\n-\t\tnewlen += 20;\n-\n-\t\tlen = write_subdirectory(buffer, size, origpath, slash-origpath+1, sha1);\n-\n-\t\tused += len;\n-\t\tsize -= len;\n-\t\tbuffer = (char *) buffer + len;\n-\t}\n-\n-\twrite_sha1_file(new, newlen, tree_type, result_sha1);\n-\tfree(new);\n-\treturn used;\n-}\n-\n-static void convert_tree(void *buffer, unsigned long size, unsigned char *result_sha1)\n-{\n-\tvoid *orig_buffer = buffer;\n-\tunsigned long orig_size = size;\n-\n-\twhile (size) {\n-\t\tsize_t len = 1+strlen(buffer);\n-\n-\t\tconvert_binary_sha1((char *) buffer + len);\n-\n-\t\tlen += 20;\n-\t\tif (len > size)\n-\t\t\tdie(\"corrupt tree object\");\n-\t\tsize -= len;\n-\t\tbuffer = (char *) buffer + len;\n-\t}\n-\n-\twrite_subdirectory(orig_buffer, orig_size, \"\", 0, result_sha1);\n-}\n-\n-static unsigned long parse_oldstyle_date(const char *buf)\n-{\n-\tchar c, *p;\n-\tchar buffer[100];\n-\tstruct tm tm;\n-\tconst char *formats[] = {\n-\t\t\"%c\",\n-\t\t\"%a %b %d %T\",\n-\t\t\"%Z\",\n-\t\t\"%Y\",\n-\t\t\" %Y\",\n-\t\tNULL\n-\t};\n-\t/* We only ever did two timezones in the bad old format .. */\n-\tconst char *timezones[] = {\n-\t\t\"PDT\", \"PST\", \"CEST\", NULL\n-\t};\n-\tconst char **fmt = formats;\n-\n-\tp = buffer;\n-\twhile (isspace(c = *buf))\n-\t\tbuf++;\n-\twhile ((c = *buf++) != '\\n')\n-\t\t*p++ = c;\n-\t*p++ = 0;\n-\tbuf = buffer;\n-\tmemset(&tm, 0, sizeof(tm));\n-\tdo {\n-\t\tconst char *next = strptime(buf, *fmt, &tm);\n-\t\tif (next) {\n-\t\t\tif (!*next)\n-\t\t\t\treturn mktime(&tm);\n-\t\t\tbuf = next;\n-\t\t} else {\n-\t\t\tconst char **p = timezones;\n-\t\t\twhile (isspace(*buf))\n-\t\t\t\tbuf++;\n-\t\t\twhile (*p) {\n-\t\t\t\tif (!memcmp(buf, *p, strlen(*p))) {\n-\t\t\t\t\tbuf += strlen(*p);\n-\t\t\t\t\tbreak;\n-\t\t\t\t}\n-\t\t\t\tp++;\n-\t\t\t}\n-\t\t}\n-\t\tfmt++;\n-\t} while (*buf && *fmt);\n-\tprintf(\"left: %s\\n\", buf);\n-\treturn mktime(&tm);\n-}\n-\n-static int convert_date_line(char *dst, void **buf, unsigned long *sp)\n-{\n-\tunsigned long size = *sp;\n-\tchar *line = *buf;\n-\tchar *next = strchr(line, '\\n');\n-\tchar *date = strchr(line, '>');\n-\tint len;\n-\n-\tif (!next || !date)\n-\t\tdie(\"missing or bad author/committer line %s\", line);\n-\tnext++; date += 2;\n-\n-\t*buf = next;\n-\t*sp = size - (next - line);\n-\n-\tlen = date - line;\n-\tmemcpy(dst, line, len);\n-\tdst += len;\n-\n-\t/* Is it already in new format? */\n-\tif (isdigit(*date)) {\n-\t\tint datelen = next - date;\n-\t\tmemcpy(dst, date, datelen);\n-\t\treturn len + datelen;\n-\t}\n-\n-\t/*\n-\t * Hacky hacky: one of the sparse old-style commits does not have\n-\t * any date at all, but we can fake it by using the committer date.\n-\t */\n-\tif (*date == '\\n' && strchr(next, '>'))\n-\t\tdate = strchr(next, '>')+2;\n-\n-\treturn len + sprintf(dst, \"%lu -0700\\n\", parse_oldstyle_date(date));\n-}\n-\n-static void convert_date(void *buffer, unsigned long size, unsigned char *result_sha1)\n-{\n-\tchar *new = xmalloc(size + 100);\n-\tunsigned long newlen = 0;\n-\n-\t/* \"tree <sha1>\\n\" */\n-\tmemcpy(new + newlen, buffer, 46);\n-\tnewlen += 46;\n-\tbuffer = (char *) buffer + 46;\n-\tsize -= 46;\n-\n-\t/* \"parent <sha1>\\n\" */\n-\twhile (!memcmp(buffer, \"parent \", 7)) {\n-\t\tmemcpy(new + newlen, buffer, 48);\n-\t\tnewlen += 48;\n-\t\tbuffer = (char *) buffer + 48;\n-\t\tsize -= 48;\n-\t}\n-\n-\t/* \"author xyz <xyz> date\" */\n-\tnewlen += convert_date_line(new + newlen, &buffer, &size);\n-\t/* \"committer xyz <xyz> date\" */\n-\tnewlen += convert_date_line(new + newlen, &buffer, &size);\n-\n-\t/* Rest */\n-\tmemcpy(new + newlen, buffer, size);\n-\tnewlen += size;\n-\n-\twrite_sha1_file(new, newlen, commit_type, result_sha1);\n-\tfree(new);\n-}\n-\n-static void convert_commit(void *buffer, unsigned long size, unsigned char *result_sha1)\n-{\n-\tvoid *orig_buffer = buffer;\n-\tunsigned long orig_size = size;\n-\n-\tif (memcmp(buffer, \"tree \", 5))\n-\t\tdie(\"Bad commit '%s'\", (char *) buffer);\n-\tconvert_ascii_sha1((char *) buffer + 5);\n-\tbuffer = (char *) buffer + 46;    /* \"tree \" + \"hex sha1\" + \"\\n\" */\n-\twhile (!memcmp(buffer, \"parent \", 7)) {\n-\t\tconvert_ascii_sha1((char *) buffer + 7);\n-\t\tbuffer = (char *) buffer + 48;\n-\t}\n-\tconvert_date(orig_buffer, orig_size, result_sha1);\n-}\n-\n-static struct entry * convert_entry(unsigned char *sha1)\n-{\n-\tstruct entry *entry = lookup_entry(sha1);\n-\tenum object_type type;\n-\tvoid *buffer, *data;\n-\tunsigned long size;\n-\n-\tif (entry->converted)\n-\t\treturn entry;\n-\tdata = read_sha1_file(sha1, &type, &size);\n-\tif (!data)\n-\t\tdie(\"unable to read object %s\", sha1_to_hex(sha1));\n-\n-\tbuffer = xmalloc(size);\n-\tmemcpy(buffer, data, size);\n-\n-\tif (type == OBJ_BLOB) {\n-\t\twrite_sha1_file(buffer, size, blob_type, entry->new_sha1);\n-\t} else if (type == OBJ_TREE)\n-\t\tconvert_tree(buffer, size, entry->new_sha1);\n-\telse if (type == OBJ_COMMIT)\n-\t\tconvert_commit(buffer, size, entry->new_sha1);\n-\telse\n-\t\tdie(\"unknown object type %d in %s\", type, sha1_to_hex(sha1));\n-\tentry->converted = 1;\n-\tfree(buffer);\n-\tfree(data);\n-\treturn entry;\n-}\n-\n-int main(int argc, char **argv)\n-{\n-\tunsigned char sha1[20];\n-\tstruct entry *entry;\n-\n-\tsetup_git_directory();\n-\n-\tif (argc != 2)\n-\t\tusage(\"git-convert-objects <sha1>\");\n-\tif (get_sha1(argv[1], sha1))\n-\t\tdie(\"Not a valid object name %s\", argv[1]);\n-\n-\tentry = convert_entry(sha1);\n-\tprintf(\"new sha1: %s\\n\", sha1_to_hex(entry->new_sha1));\n-\treturn 0;\n-}\ndiff --git a/contrib/convert-objects/git-convert-objects.txt b/contrib/convert-objects/git-convert-objects.txt\ndeleted file mode 100644\nindex f871880cfb..0000000000\n--- a/contrib/convert-objects/git-convert-objects.txt\n+++ /dev/null\n@@ -1,29 +0,0 @@\n-git-convert-objects(1)\n-======================\n-\n-NAME\n-----\n-git-convert-objects - Converts old-style git repository\n-\n-\n-SYNOPSIS\n---------\n-[verse]\n-'git-convert-objects'\n-\n-DESCRIPTION\n------------\n-Converts old-style git repository to the latest format\n-\n-\n-Author\n-------\n-Written by Linus Torvalds <torvalds@osdl.org>\n-\n-Documentation\n---------------\n-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.\n-\n-GIT\n----\n-Part of the linkgit:git[7] suite\n-- \n2.11.0.259.ga95e92af08\n\n"},{"id":"309770","messageId":"20170119202941.6575-1-sbeller@google.com","threadId":"44782","inReplyTo":"20161228180205.29213-1-sbeller@google.com","subject":"[RESEND PATCHv2] contrib: remove git-convert-objects","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-01-19T20:29:41Z","receivedAt":"2017-01-19T20:32:07Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"git-convert-objects, originally named git-convert-cache was used in\nearly 2005 to convert to a new repository format, e.g. adding an author\ndate.\n\nBy now the need for conversion of the very early repositories is less\nrelevant, we no longer need to keep it in contrib; remove it.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n\nv2:\n  no changes since v1, but as there were no replies nor do I find this\n  patch cooking, I decided to resend.\n  \nThanks,\nStefan\n\n contrib/convert-objects/convert-objects.c       | 329 ------------------------\n contrib/convert-objects/git-convert-objects.txt |  29 ---\n 2 files changed, 358 deletions(-)\n delete mode 100644 contrib/convert-objects/convert-objects.c\n delete mode 100644 contrib/convert-objects/git-convert-objects.txt\n\ndiff --git a/contrib/convert-objects/convert-objects.c b/contrib/convert-objects/convert-objects.c\ndeleted file mode 100644\nindex f3b57bf1d2..0000000000\n--- a/contrib/convert-objects/convert-objects.c\n+++ /dev/null\n@@ -1,329 +0,0 @@\n-#include \"cache.h\"\n-#include \"blob.h\"\n-#include \"commit.h\"\n-#include \"tree.h\"\n-\n-struct entry {\n-\tunsigned char old_sha1[20];\n-\tunsigned char new_sha1[20];\n-\tint converted;\n-};\n-\n-#define MAXOBJECTS (1000000)\n-\n-static struct entry *convert[MAXOBJECTS];\n-static int nr_convert;\n-\n-static struct entry * convert_entry(unsigned char *sha1);\n-\n-static struct entry *insert_new(unsigned char *sha1, int pos)\n-{\n-\tstruct entry *new = xcalloc(1, sizeof(struct entry));\n-\thashcpy(new->old_sha1, sha1);\n-\tmemmove(convert + pos + 1, convert + pos, (nr_convert - pos) * sizeof(struct entry *));\n-\tconvert[pos] = new;\n-\tnr_convert++;\n-\tif (nr_convert == MAXOBJECTS)\n-\t\tdie(\"you're kidding me - hit maximum object limit\");\n-\treturn new;\n-}\n-\n-static struct entry *lookup_entry(unsigned char *sha1)\n-{\n-\tint low = 0, high = nr_convert;\n-\n-\twhile (low < high) {\n-\t\tint next = (low + high) / 2;\n-\t\tstruct entry *n = convert[next];\n-\t\tint cmp = hashcmp(sha1, n->old_sha1);\n-\t\tif (!cmp)\n-\t\t\treturn n;\n-\t\tif (cmp < 0) {\n-\t\t\thigh = next;\n-\t\t\tcontinue;\n-\t\t}\n-\t\tlow = next+1;\n-\t}\n-\treturn insert_new(sha1, low);\n-}\n-\n-static void convert_binary_sha1(void *buffer)\n-{\n-\tstruct entry *entry = convert_entry(buffer);\n-\thashcpy(buffer, entry->new_sha1);\n-}\n-\n-static void convert_ascii_sha1(void *buffer)\n-{\n-\tunsigned char sha1[20];\n-\tstruct entry *entry;\n-\n-\tif (get_sha1_hex(buffer, sha1))\n-\t\tdie(\"expected sha1, got '%s'\", (char *) buffer);\n-\tentry = convert_entry(sha1);\n-\tmemcpy(buffer, sha1_to_hex(entry->new_sha1), 40);\n-}\n-\n-static unsigned int convert_mode(unsigned int mode)\n-{\n-\tunsigned int newmode;\n-\n-\tnewmode = mode & S_IFMT;\n-\tif (S_ISREG(mode))\n-\t\tnewmode |= (mode & 0100) ? 0755 : 0644;\n-\treturn newmode;\n-}\n-\n-static int write_subdirectory(void *buffer, unsigned long size, const char *base, int baselen, unsigned char *result_sha1)\n-{\n-\tchar *new = xmalloc(size);\n-\tunsigned long newlen = 0;\n-\tunsigned long used;\n-\n-\tused = 0;\n-\twhile (size) {\n-\t\tint len = 21 + strlen(buffer);\n-\t\tchar *path = strchr(buffer, ' ');\n-\t\tunsigned char *sha1;\n-\t\tunsigned int mode;\n-\t\tchar *slash, *origpath;\n-\n-\t\tif (!path || strtoul_ui(buffer, 8, &mode))\n-\t\t\tdie(\"bad tree conversion\");\n-\t\tmode = convert_mode(mode);\n-\t\tpath++;\n-\t\tif (memcmp(path, base, baselen))\n-\t\t\tbreak;\n-\t\torigpath = path;\n-\t\tpath += baselen;\n-\t\tslash = strchr(path, '/');\n-\t\tif (!slash) {\n-\t\t\tnewlen += sprintf(new + newlen, \"%o %s\", mode, path);\n-\t\t\tnew[newlen++] = '\\0';\n-\t\t\thashcpy((unsigned char *)new + newlen, (unsigned char *) buffer + len - 20);\n-\t\t\tnewlen += 20;\n-\n-\t\t\tused += len;\n-\t\t\tsize -= len;\n-\t\t\tbuffer = (char *) buffer + len;\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\tnewlen += sprintf(new + newlen, \"%o %.*s\", S_IFDIR, (int)(slash - path), path);\n-\t\tnew[newlen++] = 0;\n-\t\tsha1 = (unsigned char *)(new + newlen);\n-\t\tnewlen += 20;\n-\n-\t\tlen = write_subdirectory(buffer, size, origpath, slash-origpath+1, sha1);\n-\n-\t\tused += len;\n-\t\tsize -= len;\n-\t\tbuffer = (char *) buffer + len;\n-\t}\n-\n-\twrite_sha1_file(new, newlen, tree_type, result_sha1);\n-\tfree(new);\n-\treturn used;\n-}\n-\n-static void convert_tree(void *buffer, unsigned long size, unsigned char *result_sha1)\n-{\n-\tvoid *orig_buffer = buffer;\n-\tunsigned long orig_size = size;\n-\n-\twhile (size) {\n-\t\tsize_t len = 1+strlen(buffer);\n-\n-\t\tconvert_binary_sha1((char *) buffer + len);\n-\n-\t\tlen += 20;\n-\t\tif (len > size)\n-\t\t\tdie(\"corrupt tree object\");\n-\t\tsize -= len;\n-\t\tbuffer = (char *) buffer + len;\n-\t}\n-\n-\twrite_subdirectory(orig_buffer, orig_size, \"\", 0, result_sha1);\n-}\n-\n-static unsigned long parse_oldstyle_date(const char *buf)\n-{\n-\tchar c, *p;\n-\tchar buffer[100];\n-\tstruct tm tm;\n-\tconst char *formats[] = {\n-\t\t\"%c\",\n-\t\t\"%a %b %d %T\",\n-\t\t\"%Z\",\n-\t\t\"%Y\",\n-\t\t\" %Y\",\n-\t\tNULL\n-\t};\n-\t/* We only ever did two timezones in the bad old format .. */\n-\tconst char *timezones[] = {\n-\t\t\"PDT\", \"PST\", \"CEST\", NULL\n-\t};\n-\tconst char **fmt = formats;\n-\n-\tp = buffer;\n-\twhile (isspace(c = *buf))\n-\t\tbuf++;\n-\twhile ((c = *buf++) != '\\n')\n-\t\t*p++ = c;\n-\t*p++ = 0;\n-\tbuf = buffer;\n-\tmemset(&tm, 0, sizeof(tm));\n-\tdo {\n-\t\tconst char *next = strptime(buf, *fmt, &tm);\n-\t\tif (next) {\n-\t\t\tif (!*next)\n-\t\t\t\treturn mktime(&tm);\n-\t\t\tbuf = next;\n-\t\t} else {\n-\t\t\tconst char **p = timezones;\n-\t\t\twhile (isspace(*buf))\n-\t\t\t\tbuf++;\n-\t\t\twhile (*p) {\n-\t\t\t\tif (!memcmp(buf, *p, strlen(*p))) {\n-\t\t\t\t\tbuf += strlen(*p);\n-\t\t\t\t\tbreak;\n-\t\t\t\t}\n-\t\t\t\tp++;\n-\t\t\t}\n-\t\t}\n-\t\tfmt++;\n-\t} while (*buf && *fmt);\n-\tprintf(\"left: %s\\n\", buf);\n-\treturn mktime(&tm);\n-}\n-\n-static int convert_date_line(char *dst, void **buf, unsigned long *sp)\n-{\n-\tunsigned long size = *sp;\n-\tchar *line = *buf;\n-\tchar *next = strchr(line, '\\n');\n-\tchar *date = strchr(line, '>');\n-\tint len;\n-\n-\tif (!next || !date)\n-\t\tdie(\"missing or bad author/committer line %s\", line);\n-\tnext++; date += 2;\n-\n-\t*buf = next;\n-\t*sp = size - (next - line);\n-\n-\tlen = date - line;\n-\tmemcpy(dst, line, len);\n-\tdst += len;\n-\n-\t/* Is it already in new format? */\n-\tif (isdigit(*date)) {\n-\t\tint datelen = next - date;\n-\t\tmemcpy(dst, date, datelen);\n-\t\treturn len + datelen;\n-\t}\n-\n-\t/*\n-\t * Hacky hacky: one of the sparse old-style commits does not have\n-\t * any date at all, but we can fake it by using the committer date.\n-\t */\n-\tif (*date == '\\n' && strchr(next, '>'))\n-\t\tdate = strchr(next, '>')+2;\n-\n-\treturn len + sprintf(dst, \"%lu -0700\\n\", parse_oldstyle_date(date));\n-}\n-\n-static void convert_date(void *buffer, unsigned long size, unsigned char *result_sha1)\n-{\n-\tchar *new = xmalloc(size + 100);\n-\tunsigned long newlen = 0;\n-\n-\t/* \"tree <sha1>\\n\" */\n-\tmemcpy(new + newlen, buffer, 46);\n-\tnewlen += 46;\n-\tbuffer = (char *) buffer + 46;\n-\tsize -= 46;\n-\n-\t/* \"parent <sha1>\\n\" */\n-\twhile (!memcmp(buffer, \"parent \", 7)) {\n-\t\tmemcpy(new + newlen, buffer, 48);\n-\t\tnewlen += 48;\n-\t\tbuffer = (char *) buffer + 48;\n-\t\tsize -= 48;\n-\t}\n-\n-\t/* \"author xyz <xyz> date\" */\n-\tnewlen += convert_date_line(new + newlen, &buffer, &size);\n-\t/* \"committer xyz <xyz> date\" */\n-\tnewlen += convert_date_line(new + newlen, &buffer, &size);\n-\n-\t/* Rest */\n-\tmemcpy(new + newlen, buffer, size);\n-\tnewlen += size;\n-\n-\twrite_sha1_file(new, newlen, commit_type, result_sha1);\n-\tfree(new);\n-}\n-\n-static void convert_commit(void *buffer, unsigned long size, unsigned char *result_sha1)\n-{\n-\tvoid *orig_buffer = buffer;\n-\tunsigned long orig_size = size;\n-\n-\tif (memcmp(buffer, \"tree \", 5))\n-\t\tdie(\"Bad commit '%s'\", (char *) buffer);\n-\tconvert_ascii_sha1((char *) buffer + 5);\n-\tbuffer = (char *) buffer + 46;    /* \"tree \" + \"hex sha1\" + \"\\n\" */\n-\twhile (!memcmp(buffer, \"parent \", 7)) {\n-\t\tconvert_ascii_sha1((char *) buffer + 7);\n-\t\tbuffer = (char *) buffer + 48;\n-\t}\n-\tconvert_date(orig_buffer, orig_size, result_sha1);\n-}\n-\n-static struct entry * convert_entry(unsigned char *sha1)\n-{\n-\tstruct entry *entry = lookup_entry(sha1);\n-\tenum object_type type;\n-\tvoid *buffer, *data;\n-\tunsigned long size;\n-\n-\tif (entry->converted)\n-\t\treturn entry;\n-\tdata = read_sha1_file(sha1, &type, &size);\n-\tif (!data)\n-\t\tdie(\"unable to read object %s\", sha1_to_hex(sha1));\n-\n-\tbuffer = xmalloc(size);\n-\tmemcpy(buffer, data, size);\n-\n-\tif (type == OBJ_BLOB) {\n-\t\twrite_sha1_file(buffer, size, blob_type, entry->new_sha1);\n-\t} else if (type == OBJ_TREE)\n-\t\tconvert_tree(buffer, size, entry->new_sha1);\n-\telse if (type == OBJ_COMMIT)\n-\t\tconvert_commit(buffer, size, entry->new_sha1);\n-\telse\n-\t\tdie(\"unknown object type %d in %s\", type, sha1_to_hex(sha1));\n-\tentry->converted = 1;\n-\tfree(buffer);\n-\tfree(data);\n-\treturn entry;\n-}\n-\n-int main(int argc, char **argv)\n-{\n-\tunsigned char sha1[20];\n-\tstruct entry *entry;\n-\n-\tsetup_git_directory();\n-\n-\tif (argc != 2)\n-\t\tusage(\"git-convert-objects <sha1>\");\n-\tif (get_sha1(argv[1], sha1))\n-\t\tdie(\"Not a valid object name %s\", argv[1]);\n-\n-\tentry = convert_entry(sha1);\n-\tprintf(\"new sha1: %s\\n\", sha1_to_hex(entry->new_sha1));\n-\treturn 0;\n-}\ndiff --git a/contrib/convert-objects/git-convert-objects.txt b/contrib/convert-objects/git-convert-objects.txt\ndeleted file mode 100644\nindex f871880cfb..0000000000\n--- a/contrib/convert-objects/git-convert-objects.txt\n+++ /dev/null\n@@ -1,29 +0,0 @@\n-git-convert-objects(1)\n-======================\n-\n-NAME\n-----\n-git-convert-objects - Converts old-style git repository\n-\n-\n-SYNOPSIS\n---------\n-[verse]\n-'git-convert-objects'\n-\n-DESCRIPTION\n------------\n-Converts old-style git repository to the latest format\n-\n-\n-Author\n-------\n-Written by Linus Torvalds <torvalds@osdl.org>\n-\n-Documentation\n---------------\n-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.\n-\n-GIT\n----\n-Part of the linkgit:git[7] suite\n-- \n2.11.0.299.g762782ba8a\n\n"},{"id":"309778","messageId":"xmqqo9z2zs2o.fsf@gitster.mtv.corp.google.com","threadId":"44782","inReplyTo":"20170119202941.6575-1-sbeller@google.com","subject":"Re: [RESEND PATCHv2] contrib: remove git-convert-objects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-19T20:57:03Z","receivedAt":"2017-01-19T20:57:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> git-convert-objects, originally named git-convert-cache was used in\n> early 2005 to convert to a new repository format, e.g. adding an author\n> date.\n\nI think this description is not wrong per-se but misses the much\nmore important point.  In the very early days of Git, the objects\nwere named after SHA-1 of deflated loose object representation,\nwhich meant that tweak in zlib or change of compression level would\ngive the same object different names X-<.  This program was to\nconvert an ancient history with these objects and rewrite them to\nmatch the new object naming scheme where the name comes from a hash\nof the inflated representation.\n\n> By now the need for conversion of the very early repositories is less\n> relevant, we no longer need to keep it in contrib; remove it.\n\nI am not sure if removal of it matters, and I suspect that we saw no\nreaction from anybody because nobody thought it deserves the\nbrain-cycle to decide whether to remove it.  I dunno.\n\n"},{"id":"309799","messageId":"CAGZ79kam9ACf+xa3nvHT2KYqPR6qPM4ohKt7gtEv21-rmBdEuw@mail.gmail.com","threadId":"44782","inReplyTo":"xmqqo9z2zs2o.fsf@gitster.mtv.corp.google.com","subject":"Re: [RESEND PATCHv2] contrib: remove git-convert-objects","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-01-19T21:55:51Z","receivedAt":"2017-01-19T22:04:38Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Jan 19, 2017 at 12:57 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stefan Beller <sbeller@google.com> writes:\n>\n>> git-convert-objects, originally named git-convert-cache was used in\n>> early 2005 to convert to a new repository format, e.g. adding an author\n>> date.\n>\n> I think this description is not wrong per-se but misses the much\n> more important point.  In the very early days of Git, the objects\n> were named after SHA-1 of deflated loose object representation,\n> which meant that tweak in zlib or change of compression level would\n> give the same object different names X-<.  This program was to\n> convert an ancient history with these objects and rewrite them to\n> match the new object naming scheme where the name comes from a hash\n> of the inflated representation.\n\nok, in case I reroll again, I'll fixup the message.\n\n>\n>> By now the need for conversion of the very early repositories is less\n>> relevant, we no longer need to keep it in contrib; remove it.\n>\n> I am not sure if removal of it matters, and I suspect that we saw no\n> reaction from anybody because nobody thought it deserves the\n> brain-cycle to decide whether to remove it.  I dunno.\n\nI do think removing this would improve contrib/, not just because\nit would better align with contribs mission statement in its README, but\nalso for other reasons. Why would a user look into contrib/ at all?\n* to find interesting contemporary bits and pieces\n* if they want to find old stuff for educational purposes, they ought to\n  be looking into contrib/examples instead.\n\nSo maybe instead of this patch, just move it to the examples section?\n(That way we archive the same goal: a cleaner, fresher contrib/\nthat doesn't look as stale)\n\nThanks,\nStefan\n"}]}