{"thread":{"id":"2770","subject":"[PATCH] cg-object-id: cleanup id verifying","startedAt":"2005-12-07T21:39:29Z","lastAt":"2005-12-07T21:39:29Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13333","messageId":"20051207213929.GB25890@diku.dk","threadId":"2770","inReplyTo":null,"subject":"[PATCH] cg-object-id: cleanup id verifying","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-12-07T21:39:29Z","receivedAt":"2005-12-07T21:39:29Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Signed-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n---\ncommit 36c0d9fae209ab7fa889333e8eebef22e7f0f55c\ntree 364122ed83e2b920b0f0f5fe18c608a22aea6d07\nparent 964e5ec2dd0ff3b073fbb9f3ad6f11c640a96a04\nauthor Jonas Fonseca <fonseca@diku.dk> Wed, 07 Dec 2005 08:11:43 +0100\ncommitter Jonas Fonseca <fonseca@antimatter.localdomain> Wed, 07 Dec 2005 08:11:43 +0100\n\n cg-object-id |   10 +++++-----\n 1 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/cg-object-id b/cg-object-id\nindex c7efa8a..56d9f91 100755\n--- a/cg-object-id\n+++ b/cg-object-id\n@@ -50,6 +50,7 @@ normalize_id()\n \trevid=\"$(git-rev-parse --verify \"$id^0\" 2>/dev/null)\"\n \tif [ \"$revid\" ]; then\n \t\tid=\"$revid\"\n+\t\tvalid=1\n \n \t# Short id's must be lower case and at least 4 digits.\n \telif [[ \"$id\" == [0-9a-f][0-9a-f][0-9a-f][0-9a-f]* ]]; then\n@@ -60,8 +61,8 @@ normalize_id()\n \t\tidmatch=($_git_objects/$idpref/$idpost*)\n \n \t\tif [ ${#idmatch[*]} -eq 1 ] && [ -r \"$idmatch\" ]; then\n-\t\t\texid=$idpref${idmatch#$_git_objects/$idpref/}\n-\t\t\t[ ${#exid} -eq 40 ] && [ \"$(git-rev-parse --revs-only \"$exid\")\" ] && id=\"$exid\"\n+\t\t\tid=$idpref${idmatch#$_git_objects/$idpref/}\n+\t\t\t[ ${#id} -eq 40 ] && [ \"$(git-rev-parse --revs-only \"$id\")\" ] && valid=1\n \t\telif [ ${#idmatch[*]} -gt 1 ]; then\n \t\t\techo \"Ambiguous id: $id\" >&2\n \t\t\techo \"${idmatch[@]}\" >&2\n@@ -69,13 +70,12 @@ normalize_id()\n \t\tfi\n \tfi\n \n-\tvalid=; [ ${#id} -eq 40 ] && [ \"$(git-rev-parse --revs-only \"$id\")\" ] && valid=1\n-\tif ([ \"$id\" ] && [ \"$id\" != \" \" ]) && [ ! \"$valid\" ]; then\n+\tif [ \"$id\" != \" \" ] && [ ! \"$valid\" ]; then\n \t\treqsecs=$(date --date=\"$id\" +'%s' 2>/dev/null)\n \n \t\tif [ \"$reqsecs\" ]; then\n \t\t\tid=$(git-rev-list --min-age=$reqsecs --max-count=1 HEAD)\n-\t\t\tvalid=; [ ${#id} -eq 40 ] && [ \"$(git-rev-parse --revs-only \"$id\")\" ] && valid=1\n+\t\t\t[ ${#id} -eq 40 ] && [ \"$(git-rev-parse --revs-only \"$id\")\" ] && valid=1\n \t\tfi\n \tfi\n \n\n-- \nJonas Fonseca\n"}]}