{"thread":{"id":"29941","subject":"[PATCH 1/4] contrib/diffall: change comment to reflect actual reason for 'cdup'","startedAt":"2012-03-13T17:45:30Z","lastAt":"2012-03-13T17:49:35Z","messageCount":5,"participants":["Tim Henigan"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"186876","messageId":"1331660734-10538-1-git-send-email-tim.henigan@gmail.com","threadId":"29941","inReplyTo":null,"subject":"[PATCH 1/4] contrib/diffall: change comment to reflect actual reason for 'cdup'","fromName":"Tim Henigan","fromEmail":"tim.henigan@gmail.com","sentAt":"2012-03-13T17:45:30Z","receivedAt":"2012-03-13T17:45:30Z","isPatch":true,"sender":{"key":"tim.henigan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42022?v=4"},"body":"The comment from an earlier commit did not reflect the actual reason this\noperation is needed.\n\nSigned-off-by: Tim Henigan <tim.henigan@gmail.com>\n---\n contrib/diffall/git-diffall |    4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall\nindex 9bbd27f..d706a6d 100755\n--- a/contrib/diffall/git-diffall\n+++ b/contrib/diffall/git-diffall\n@@ -36,7 +36,9 @@ fi\n \n start_dir=$(pwd)\n \n-# needed to access tar utility\n+# All the file paths returned by the diff command are relative to the root\n+# of the working copy. So if the script is called from a subdirectory, it\n+# must switch to the root of working copy before trying to use those paths.\n cdup=$(git rev-parse --show-cdup) &&\n cd \"$cdup\" || {\n \techo >&2 \"Cannot chdir to $cdup, the toplevel of the working tree\"\n-- \n1.7.10.rc0\n"},{"id":"186877","messageId":"1331660734-10538-2-git-send-email-tim.henigan@gmail.com","threadId":"29941","inReplyTo":"1331660734-10538-1-git-send-email-tim.henigan@gmail.com","subject":"[PATCH 2/4] contrib/diffall: teach diffall to create tmp dirs without using mktemp","fromName":"Tim Henigan","fromEmail":"tim.henigan@gmail.com","sentAt":"2012-03-13T17:45:31Z","receivedAt":"2012-03-13T17:45:31Z","isPatch":true,"sender":{"key":"tim.henigan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42022?v=4"},"body":"mktemp is not available on all platforms.  Instead of littering the code\nwith a work-around, this commit replaces mktemp with a one-line Perl\nscript.\n\nSigned-off-by: Tim Henigan <tim.henigan@gmail.com>\n---\n contrib/diffall/git-diffall |   11 ++++-------\n 1 file changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall\nindex d706a6d..443f646 100755\n--- a/contrib/diffall/git-diffall\n+++ b/contrib/diffall/git-diffall\n@@ -45,13 +45,10 @@ cd \"$cdup\" || {\n \texit 1\n }\n \n-# mktemp is not available on all platforms (missing from msysgit)\n-# Use a hard-coded tmp dir if it is not available\n-tmp=\"$(mktemp -d -t tmp.XXXXXX 2>/dev/null)\" || {\n-\ttmp=/tmp/git-diffall-tmp.$$\n-\tmkdir \"$tmp\" || exit 1\n-}\n-\n+# set up temp dir\n+tmp=$(perl -e 'use File::Temp qw(tempdir);\n+\t$t=tempdir(\"/tmp/git-diffall.XXXXX\") or exit(1);\n+\tprint $t') || exit 1\n trap 'rm -rf \"$tmp\" 2>/dev/null' EXIT\n \n left=\n-- \n1.7.10.rc0\n"},{"id":"186883","messageId":"1331660734-10538-3-git-send-email-tim.henigan@gmail.com","threadId":"29941","inReplyTo":"1331660734-10538-1-git-send-email-tim.henigan@gmail.com","subject":"[PATCH 3/4] contrib/diffall: teach diffall to handle working copy changes without tar","fromName":"Tim Henigan","fromEmail":"tim.henigan@gmail.com","sentAt":"2012-03-13T17:45:32Z","receivedAt":"2012-03-13T17:45:32Z","isPatch":true,"sender":{"key":"tim.henigan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42022?v=4"},"body":"The 'tar' utility is not available on all platforms (some only support\n'gnutar').  An earlier commit created a work-around for this problem,\nbut a better solution is to eliminate the use of 'tar' completely.\n\nSigned-off-by: Tim Henigan <tim.henigan@gmail.com>\n---\n contrib/diffall/git-diffall |   12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall\nindex 443f646..8d243c7 100755\n--- a/contrib/diffall/git-diffall\n+++ b/contrib/diffall/git-diffall\n@@ -202,10 +202,14 @@ then\n \t\tfi\n \tdone < \"$tmp/filelist\"\n else\n-\t# Mac users have gnutar rather than tar\n-\t(tar --ignore-failed-read -c -T \"$tmp/filelist\" | (cd \"$tmp/$right_dir\" && tar -x)) || {\n-\t\tgnutar --ignore-failed-read -c -T \"$tmp/filelist\" | (cd \"$tmp/$right_dir\" && gnutar -x)\n-\t}\n+\twhile read name\n+\tdo\n+\t\tif test -e \"$name\"\n+\t\tthen\n+\t\t\tmkdir -p \"$tmp/$right_dir/$(dirname \"$name\")\"\n+\t\t\tcp \"$name\" \"$tmp/$right_dir\"\n+\t\tfi\n+\tdone < \"$tmp/filelist\"\n fi\n \n # Populate the tmp/left_dir directory with the files to be compared\n-- \n1.7.10.rc0\n"},{"id":"186879","messageId":"1331660734-10538-4-git-send-email-tim.henigan@gmail.com","threadId":"29941","inReplyTo":"1331660734-10538-1-git-send-email-tim.henigan@gmail.com","subject":"[PATCH 4/4] contrib/diffall: eliminate duplicate while loops","fromName":"Tim Henigan","fromEmail":"tim.henigan@gmail.com","sentAt":"2012-03-13T17:45:33Z","receivedAt":"2012-03-13T17:45:33Z","isPatch":true,"sender":{"key":"tim.henigan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42022?v=4"},"body":"There were 3 instances of a 'while read; do' that used identical logic\nto populate '/tmp/right_dir'. This commit groups them into a single loop.\n\nSigned-off-by: Tim Henigan <tim.henigan@gmail.com>\n---\n contrib/diffall/git-diffall |   24 +++++++++---------------\n 1 file changed, 9 insertions(+), 15 deletions(-)\n\ndiff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall\nindex 8d243c7..b1afefe 100755\n--- a/contrib/diffall/git-diffall\n+++ b/contrib/diffall/git-diffall\n@@ -179,38 +179,32 @@ fi\n mkdir -p \"$tmp/$left_dir\" \"$tmp/$right_dir\"\n \n # Populate the tmp/right_dir directory with the files to be compared\n-if test -n \"$right\"\n-then\n-\twhile read name\n-\tdo\n+while read name\n+do\n+\tif test -n \"$right\"\n+\tthen\n \t\tls_list=$(git ls-tree $right \"$name\")\n \t\tif test -n \"$ls_list\"\n \t\tthen\n \t\t\tmkdir -p \"$tmp/$right_dir/$(dirname \"$name\")\"\n \t\t\tgit show \"$right\":\"$name\" >\"$tmp/$right_dir/$name\" || true\n \t\tfi\n-\tdone < \"$tmp/filelist\"\n-elif test -n \"$compare_staged\"\n-then\n-\twhile read name\n-\tdo\n+\telif test -n \"$compare_staged\"\n+\tthen\n \t\tls_list=$(git ls-files -- \"$name\")\n \t\tif test -n \"$ls_list\"\n \t\tthen\n \t\t\tmkdir -p \"$tmp/$right_dir/$(dirname \"$name\")\"\n \t\t\tgit show :\"$name\" >\"$tmp/$right_dir/$name\"\n \t\tfi\n-\tdone < \"$tmp/filelist\"\n-else\n-\twhile read name\n-\tdo\n+\telse\n \t\tif test -e \"$name\"\n \t\tthen\n \t\t\tmkdir -p \"$tmp/$right_dir/$(dirname \"$name\")\"\n \t\t\tcp \"$name\" \"$tmp/$right_dir\"\n \t\tfi\n-\tdone < \"$tmp/filelist\"\n-fi\n+\tfi\n+done < \"$tmp/filelist\"\n \n # Populate the tmp/left_dir directory with the files to be compared\n while read name\n-- \n1.7.10.rc0\n"},{"id":"186880","messageId":"CAFouetiuTdg7htiJL_oHX=Z+yDsq+hmRWtCNWtYAS-pLm91ZaQ@mail.gmail.com","threadId":"29941","inReplyTo":"1331660734-10538-1-git-send-email-tim.henigan@gmail.com","subject":"Re: [PATCH 1/4] contrib/diffall: change comment to reflect actual reason for 'cdup'","fromName":"Tim Henigan","fromEmail":"tim.henigan@gmail.com","sentAt":"2012-03-13T17:49:35Z","receivedAt":"2012-03-13T17:49:35Z","isPatch":true,"sender":{"key":"tim.henigan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42022?v=4"},"body":"On Tue, Mar 13, 2012 at 1:45 PM, Tim Henigan <tim.henigan@gmail.com> wrote:\n> The comment from an earlier commit did not reflect the actual reason this\n> operation is needed.\n>\n> Signed-off-by: Tim Henigan <tim.henigan@gmail.com>\n> ---\n>  contrib/diffall/git-diffall |    4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n\nJunio - I had a typo in your email address when I sent this patch\nseries.  Sorry for the confusion.\n\nBest regards,\nTim\n"}]}