{"thread":{"id":"25338","subject":"[TopGit PATCH] tg.sh: simplify cat_file","startedAt":"2010-10-04T18:43:12Z","lastAt":"2010-10-04T18:47:01Z","messageCount":2,"participants":["Bert Wesarg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"152566","messageId":"85c8c215f362c4b57e7646d536ef1ca77ade1591.1286217707.git.bert.wesarg@googlemail.com","threadId":"25338","inReplyTo":null,"subject":"[TopGit PATCH] tg.sh: simplify cat_file","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T18:43:12Z","receivedAt":"2010-10-04T18:43:12Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Use shell parameter expansion to strip the leading (w): and (i)\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n tg.sh |    8 +++-----\n 1 files changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/tg.sh b/tg.sh\nindex 9d08d63..d320956 100644 tg.sh\n--- a/tg.sh\n+++ b/tg.sh\n@@ -25,17 +25,15 @@ cat_file()\n \targ=\"$1\"\n \tcase \"$arg\" in\n \t'(w):'*)\n-\t\targ=$(echo \"$arg\" | tail --bytes=+5)\n-\t\tcat \"$arg\"\n-\t\treturn\n+\t\tcat \"${arg#????}\"\n \t\t;;\n \t'(i):'*)\n \t\t# ':file' means cat from index\n-\t\targ=$(echo \"$arg\" | tail --bytes=+5)\n-\t\tgit cat-file blob \":$arg\"\n+\t\tgit cat-file blob \"${arg#???}\"\n \t\t;;\n \t*)\n \t\tgit cat-file blob \"$arg\"\n+\t\t;;\n \tesac\n }\n \n-- \n1.7.1.1067.g5aeb7\n"},{"id":"152567","messageId":"064ca64cad83076e419ef2cb8bfa5d80e72915bb.1286217942.git.bert.wesarg@googlemail.com","threadId":"25338","inReplyTo":"85c8c215f362c4b57e7646d536ef1ca77ade1591.1286217707.git.bert.wesarg@googlemail.com","subject":"[TopGit PATCH v2] tg.sh: simplify cat_file","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T18:47:01Z","receivedAt":"2010-10-04T18:47:01Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Use shell parameter expansion to strip the leading (w): and (i)\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n\nNo need to use wildcards, we know exactly what we want to strip.\n\n tg.sh |    8 +++-----\n 1 files changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/tg.sh b/tg.sh\nindex 9d08d63..0e72865 100644 tg.sh\n--- a/tg.sh\n+++ b/tg.sh\n@@ -25,17 +25,15 @@ cat_file()\n \targ=\"$1\"\n \tcase \"$arg\" in\n \t'(w):'*)\n-\t\targ=$(echo \"$arg\" | tail --bytes=+5)\n-\t\tcat \"$arg\"\n-\t\treturn\n+\t\tcat \"${arg#(w):}\"\n \t\t;;\n \t'(i):'*)\n \t\t# ':file' means cat from index\n-\t\targ=$(echo \"$arg\" | tail --bytes=+5)\n-\t\tgit cat-file blob \":$arg\"\n+\t\tgit cat-file blob \"${arg#(i)}\"\n \t\t;;\n \t*)\n \t\tgit cat-file blob \"$arg\"\n+\t\t;;\n \tesac\n }\n \n-- \n1.7.1.1067.g5aeb7\n"}]}