{"thread":{"id":"38205","subject":"[PATCH v2 2/5] update_unicode.sh: set UNICODE_DIR only once","startedAt":"2014-12-19T16:24:20Z","lastAt":"2014-12-23T00:32:43Z","messageCount":7,"participants":["dev+git@drbeat.li","Junio C Hamano","Beat Bolli"],"isPatch":true,"patchVersion":2,"patchTotal":5},"messages":[{"id":"253856","messageId":"1419006264-24741-1-git-send-email-dev+git@drbeat.li","threadId":"38205","inReplyTo":null,"subject":"[PATCH v2 1/5] update_unicode.sh: simplify output capture","fromName":"","fromEmail":"dev+git@drbeat.li","sentAt":"2014-12-19T16:24:20Z","receivedAt":"2014-12-19T16:24:20Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"From: Beat Bolli <dev+git@drbeat.li>\n\nInstead of capturing the output of each echo and uniset invocation, wrap\nthe whole section in a group command and redirect its output all at\nonce.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n update_unicode.sh | 17 +++++++++--------\n 1 file changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/update_unicode.sh b/update_unicode.sh\nindex 000b937..c1c876c 100755\n--- a/update_unicode.sh\n+++ b/update_unicode.sh\n@@ -26,12 +26,13 @@ fi &&\n \t\t\t./configure --enable-warnings=-Werror CFLAGS='-O0 -ggdb'\n \t\tfi &&\n \t\tmake\n-\t) &&\n-\techo \"static const struct interval zero_width[] = {\" >$UNICODEWIDTH_H &&\n-\tUNICODE_DIR=. ./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n-\tgrep -v plane >>$UNICODEWIDTH_H &&\n-\techo \"};\" >>$UNICODEWIDTH_H &&\n-\techo \"static const struct interval double_width[] = {\" >>$UNICODEWIDTH_H &&\n-\tUNICODE_DIR=. ./uniset/uniset --32 eaw:F,W >>$UNICODEWIDTH_H &&\n-\techo \"};\" >>$UNICODEWIDTH_H\n+\t) && {\n+\t\techo \"static const struct interval zero_width[] = {\" &&\n+\t\tUNICODE_DIR=. ./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n+\t\tgrep -v plane &&\n+\t\techo \"};\" &&\n+\t\techo \"static const struct interval double_width[] = {\" &&\n+\t\tUNICODE_DIR=. ./uniset/uniset --32 eaw:F,W &&\n+\t\techo \"};\"\n+\t} >$UNICODEWIDTH_H\n )\n-- \n2.1.3\n"},{"id":"253852","messageId":"1419006264-24741-2-git-send-email-dev+git@drbeat.li","threadId":"38205","inReplyTo":"1419006264-24741-1-git-send-email-dev+git@drbeat.li","subject":"[PATCH v2 2/5] update_unicode.sh: set UNICODE_DIR only once","fromName":"","fromEmail":"dev+git@drbeat.li","sentAt":"2014-12-19T16:24:21Z","receivedAt":"2014-12-19T16:24:21Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"From: Beat Bolli <dev+git@drbeat.li>\n\nThe value is the same on both uniset invocations, so \"Don't Repeat\nYourself\" applies.\n\nSince we're in a subshell already, there's no need to unset UNICODE_DIR\nat the end.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n update_unicode.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/update_unicode.sh b/update_unicode.sh\nindex c1c876c..bed8916 100755\n--- a/update_unicode.sh\n+++ b/update_unicode.sh\n@@ -27,12 +27,13 @@ fi &&\n \t\tfi &&\n \t\tmake\n \t) && {\n+\t\tUNICODE_DIR=. && export UNICODE_DIR &&\n \t\techo \"static const struct interval zero_width[] = {\" &&\n-\t\tUNICODE_DIR=. ./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n+\t\t./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n \t\tgrep -v plane &&\n \t\techo \"};\" &&\n \t\techo \"static const struct interval double_width[] = {\" &&\n-\t\tUNICODE_DIR=. ./uniset/uniset --32 eaw:F,W &&\n+\t\t./uniset/uniset --32 eaw:F,W &&\n \t\techo \"};\"\n \t} >$UNICODEWIDTH_H\n )\n-- \n2.1.3\n"},{"id":"253855","messageId":"1419006264-24741-3-git-send-email-dev+git@drbeat.li","threadId":"38205","inReplyTo":"1419006264-24741-1-git-send-email-dev+git@drbeat.li","subject":"[PATCH v2 3/5] update_unicode.sh: shorten uniset invocation path","fromName":"","fromEmail":"dev+git@drbeat.li","sentAt":"2014-12-19T16:24:22Z","receivedAt":"2014-12-19T16:24:22Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"From: Beat Bolli <dev+git@drbeat.li>\n\n\"uniset/uniset\" is a relative path; there's no need to prefix it with \"./\".\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n update_unicode.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/update_unicode.sh b/update_unicode.sh\nindex bed8916..f5cc14b 100755\n--- a/update_unicode.sh\n+++ b/update_unicode.sh\n@@ -29,11 +29,11 @@ fi &&\n \t) && {\n \t\tUNICODE_DIR=. && export UNICODE_DIR &&\n \t\techo \"static const struct interval zero_width[] = {\" &&\n-\t\t./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n+\t\tuniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n \t\tgrep -v plane &&\n \t\techo \"};\" &&\n \t\techo \"static const struct interval double_width[] = {\" &&\n-\t\t./uniset/uniset --32 eaw:F,W &&\n+\t\tuniset/uniset --32 eaw:F,W &&\n \t\techo \"};\"\n \t} >$UNICODEWIDTH_H\n )\n-- \n2.1.3\n"},{"id":"253854","messageId":"1419006264-24741-4-git-send-email-dev+git@drbeat.li","threadId":"38205","inReplyTo":"1419006264-24741-1-git-send-email-dev+git@drbeat.li","subject":"[PATCH v2 4/5] update_unicode.sh: Make the output structure visible","fromName":"","fromEmail":"dev+git@drbeat.li","sentAt":"2014-12-19T16:24:23Z","receivedAt":"2014-12-19T16:24:23Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"From: Beat Bolli <dev+git@drbeat.li>\n\nBy using a here document instead of the echo/uniset sequence, the final\nstructure of the generated file becomes obvious.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n update_unicode.sh | 16 +++++++++-------\n 1 file changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/update_unicode.sh b/update_unicode.sh\nindex f5cc14b..d7343b9 100755\n--- a/update_unicode.sh\n+++ b/update_unicode.sh\n@@ -28,12 +28,14 @@ fi &&\n \t\tmake\n \t) && {\n \t\tUNICODE_DIR=. && export UNICODE_DIR &&\n-\t\techo \"static const struct interval zero_width[] = {\" &&\n-\t\tuniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n-\t\tgrep -v plane &&\n-\t\techo \"};\" &&\n-\t\techo \"static const struct interval double_width[] = {\" &&\n-\t\tuniset/uniset --32 eaw:F,W &&\n-\t\techo \"};\"\n+\t\tcat <<-EOF\n+\t\tstatic const struct interval zero_width[] = {\n+\t\t\t$(uniset/uniset --32 cat:Me,Mn,Cf \\\n+\t\t\t  + U+1160..U+11FF - U+00AD | grep -v plane)\n+\t\t};\n+\t\tstatic const struct interval double_width[] = {\n+\t\t\t$(uniset/uniset --32 eaw:F,W)\n+\t\t};\n+\t\tEOF\n \t} >$UNICODEWIDTH_H\n )\n-- \n2.1.3\n"},{"id":"253853","messageId":"1419006264-24741-5-git-send-email-dev+git@drbeat.li","threadId":"38205","inReplyTo":"1419006264-24741-1-git-send-email-dev+git@drbeat.li","subject":"[PATCH v2 5/5] update_unicode.sh: Delete the command group","fromName":"","fromEmail":"dev+git@drbeat.li","sentAt":"2014-12-19T16:24:24Z","receivedAt":"2014-12-19T16:24:24Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"From: Beat Bolli <dev+git@drbeat.li>\n\nNow that the whole file is generated by one single command, the command\ngroup is no longer needed.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n update_unicode.sh | 23 +++++++++++------------\n 1 file changed, 11 insertions(+), 12 deletions(-)\n\ndiff --git a/update_unicode.sh b/update_unicode.sh\nindex d7343b9..27af77c 100755\n--- a/update_unicode.sh\n+++ b/update_unicode.sh\n@@ -26,16 +26,15 @@ fi &&\n \t\t\t./configure --enable-warnings=-Werror CFLAGS='-O0 -ggdb'\n \t\tfi &&\n \t\tmake\n-\t) && {\n-\t\tUNICODE_DIR=. && export UNICODE_DIR &&\n-\t\tcat <<-EOF\n-\t\tstatic const struct interval zero_width[] = {\n-\t\t\t$(uniset/uniset --32 cat:Me,Mn,Cf \\\n-\t\t\t  + U+1160..U+11FF - U+00AD | grep -v plane)\n-\t\t};\n-\t\tstatic const struct interval double_width[] = {\n-\t\t\t$(uniset/uniset --32 eaw:F,W)\n-\t\t};\n-\t\tEOF\n-\t} >$UNICODEWIDTH_H\n+\t) &&\n+\tUNICODE_DIR=. && export UNICODE_DIR &&\n+\tcat >$UNICODEWIDTH_H <<-EOF\n+\tstatic const struct interval zero_width[] = {\n+\t\t$(uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n+\t\t  grep -v plane)\n+\t};\n+\tstatic const struct interval double_width[] = {\n+\t\t$(uniset/uniset --32 eaw:F,W)\n+\t};\n+\tEOF\n )\n-- \n2.1.3\n"},{"id":"253935","messageId":"xmqqk31ja7h3.fsf@gitster.dls.corp.google.com","threadId":"38205","inReplyTo":"1419006264-24741-2-git-send-email-dev+git@drbeat.li","subject":"Re: [PATCH v2 2/5] update_unicode.sh: set UNICODE_DIR only once","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-22T18:02:16Z","receivedAt":"2014-12-22T18:02:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"dev+git@drbeat.li writes:\n\n> From: Beat Bolli <dev+git@drbeat.li>\n>\n> The value is the same on both uniset invocations, so \"Don't Repeat\n> Yourself\" applies.\n>\n> Since we're in a subshell already, there's no need to unset UNICODE_DIR\n> at the end.\n\nStrictly speaking, you are not introducing your own subshell to\nprevent the environment from leaking (i.e. you used \"{...}\" not\n\"(...)\" in the previous step).  The reason you can do this is\nbecause the generation of UNICODEWIDTH_H file is the last thing in\nthe subshell.\n\nI'll reword it to \"Since this is done as the last command, ...\"\n\nThanks.\n\n>\n> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> ---\n>  update_unicode.sh | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/update_unicode.sh b/update_unicode.sh\n> index c1c876c..bed8916 100755\n> --- a/update_unicode.sh\n> +++ b/update_unicode.sh\n> @@ -27,12 +27,13 @@ fi &&\n>  \t\tfi &&\n>  \t\tmake\n>  \t) && {\n> +\t\tUNICODE_DIR=. && export UNICODE_DIR &&\n>  \t\techo \"static const struct interval zero_width[] = {\" &&\n> -\t\tUNICODE_DIR=. ./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n> +\t\t./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n>  \t\tgrep -v plane &&\n>  \t\techo \"};\" &&\n>  \t\techo \"static const struct interval double_width[] = {\" &&\n> -\t\tUNICODE_DIR=. ./uniset/uniset --32 eaw:F,W &&\n> +\t\t./uniset/uniset --32 eaw:F,W &&\n>  \t\techo \"};\"\n>  \t} >$UNICODEWIDTH_H\n>  )\n"},{"id":"253979","messageId":"5498B82B.9090505@drbeat.li","threadId":"38205","inReplyTo":"xmqqk31ja7h3.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2 2/5] update_unicode.sh: set UNICODE_DIR only once","fromName":"Beat Bolli","fromEmail":"dev@drbeat.li","sentAt":"2014-12-23T00:32:43Z","receivedAt":"2014-12-23T00:32:43Z","isPatch":true,"sender":{"key":"dev@drbeat.li","avatar":null},"body":"On 22.12.14 19:02, Junio C Hamano wrote:\n> dev+git@drbeat.li writes:\n> \n>> From: Beat Bolli <dev+git@drbeat.li>\n>>\n>> The value is the same on both uniset invocations, so \"Don't Repeat\n>> Yourself\" applies.\n>>\n>> Since we're in a subshell already, there's no need to unset UNICODE_DIR\n>> at the end.\n> \n> Strictly speaking, you are not introducing your own subshell to\n> prevent the environment from leaking (i.e. you used \"{...}\" not\n> \"(...)\" in the previous step).  The reason you can do this is\n> because the generation of UNICODEWIDTH_H file is the last thing in\n> the subshell.\n\nI don't introduce a new one, but we're still in the outer subshell that\nstarts on line 12 \"( cd unicode &&\".\n\n> \n> I'll reword it to \"Since this is done as the last command, ...\"\n> \n> Thanks.\n> \n>>\n>> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n>> ---\n>>  update_unicode.sh | 5 +++--\n>>  1 file changed, 3 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/update_unicode.sh b/update_unicode.sh\n>> index c1c876c..bed8916 100755\n>> --- a/update_unicode.sh\n>> +++ b/update_unicode.sh\n>> @@ -27,12 +27,13 @@ fi &&\n>>  \t\tfi &&\n>>  \t\tmake\n>>  \t) && {\n>> +\t\tUNICODE_DIR=. && export UNICODE_DIR &&\n>>  \t\techo \"static const struct interval zero_width[] = {\" &&\n>> -\t\tUNICODE_DIR=. ./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n>> +\t\t./uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |\n>>  \t\tgrep -v plane &&\n>>  \t\techo \"};\" &&\n>>  \t\techo \"static const struct interval double_width[] = {\" &&\n>> -\t\tUNICODE_DIR=. ./uniset/uniset --32 eaw:F,W &&\n>> +\t\t./uniset/uniset --32 eaw:F,W &&\n>>  \t\techo \"};\"\n>>  \t} >$UNICODEWIDTH_H\n>>  )\n"}]}