{"thread":{"id":"43698","subject":"Re: [PATCH 1/3] Allow short pack names to git-pack-objects --unpacked=.","startedAt":"2006-10-29T09:37:11Z","lastAt":"2006-10-29T09:44:04Z","messageCount":2,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"298435","messageId":"20061029093711.GC3847@spearce.org","threadId":"43698","inReplyTo":null,"subject":"[PATCH 1/3] Allow short pack names to git-pack-objects --unpacked=.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-10-29T09:37:11Z","receivedAt":"2006-10-29T09:37:11Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Allow short pack names to git-pack-objects --unpacked=.\n\nThis allows us to pass just the file name of a pack rather than\nthe complete path when we want pack-objects to consider its\ncontents as though they were loose objects.  This can be helpful\nif $GIT_OBJECT_DIRECTORY contains shell metacharacters which make\nit cumbersome to pass complete paths safely in a shell script.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n sha1_file.c |   20 +++++++++++++++++++-\n 1 files changed, 19 insertions(+), 1 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex e89d24c..5e6c8b8 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1203,6 +1203,24 @@ unsigned long find_pack_entry_one(const\n \treturn 0;\n }\n \n+static int matches_pack_name(struct packed_git *p, const char *ig)\n+{\n+\tconst char *last_c, *c;\n+\n+\tif (!strcmp(p->pack_name, ig))\n+\t\treturn 0;\n+\n+\tfor (c = p->pack_name, last_c = c; *c;)\n+\t\tif (*c == '/')\n+\t\t\tlast_c = ++c;\n+\t\telse\n+\t\t\t++c;\n+\tif (!strcmp(last_c, ig))\n+\t\treturn 0;\n+\n+\treturn 1;\n+}\n+\n static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, const char **ignore_packed)\n {\n \tstruct packed_git *p;\n@@ -1214,7 +1232,7 @@ static int find_pack_entry(const unsigne\n \t\tif (ignore_packed) {\n \t\t\tconst char **ig;\n \t\t\tfor (ig = ignore_packed; *ig; ig++)\n-\t\t\t\tif (!strcmp(p->pack_name, *ig))\n+\t\t\t\tif (!matches_pack_name(p, *ig))\n \t\t\t\t\tbreak;\n \t\t\tif (*ig)\n \t\t\t\tcontinue;\n-- \n1.4.3.3.g7d63\n"},{"id":"296892","messageId":"20061029094404.GF3847@spearce.org","threadId":"43698","inReplyTo":"20061029093711.GC3847@spearce.org","subject":"Re: [PATCH 1/3] Allow short pack names to git-pack-objects --unpacked=.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-10-29T09:44:04Z","receivedAt":"2006-10-29T09:44:04Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Ok, I'm a freaking idiot:\n\n> Subject: [PATCH 1/3] Allow short pack names to git-pack-objects --unpacked=.\n> \n> Allow short pack names to git-pack-objects --unpacked=.\n\nI meant to delete the first two lines of the body of the message\nbefore sending so that git-am didn't stutter the first line of the\ncommit message when applied, yet I managed to not do that.  *sigh*\n\n-- \n"}]}