{"thread":{"id":"33138","subject":"[PATCH 19/19] Fix some trailing whitespace","startedAt":"2013-03-09T19:31:29Z","lastAt":"2013-03-09T19:31:29Z","messageCount":1,"participants":["Paul Campbell"],"isPatch":true,"patchVersion":1,"patchTotal":19},"messages":[{"id":"210927","messageId":"CALeLG_=4uJKn44i+iiinosQ28pAqj6GJQS4NAuMveW4bVRLofA@mail.gmail.com","threadId":"33138","inReplyTo":null,"subject":"[PATCH 19/19] Fix some trailing whitespace","fromName":"Paul Campbell","fromEmail":"pcampbell@kemitix.net","sentAt":"2013-03-09T19:31:29Z","receivedAt":"2013-03-09T19:31:29Z","isPatch":true,"sender":{"key":"pcampbell@kemitix.net","avatar":"https://gravatar.com/avatar/57584e05501b694929004e43fcd7308f4ad64df2eb0474cd8c7e5f93662bb0f1?d=mp&s=160"},"body":">From 54d376c3d731ce9e528fe9095ea6c16d382b5ce3 Mon Sep 17 00:00:00 2001\nFrom: Paul Campbell <pcampbell@kemitix.net>\nDate: Sat, 9 Mar 2013 18:36:22 +0000\nSubject: [PATCH 19/19] Fix some trailing whitespace\n\nConflicts:\n\tcontrib/subtree/.gitignore\n\tcontrib/subtree/git-subtree.sh\n\tcontrib/subtree/test.sh\n\nOriginal-Author: Herman van Rink <rink@initfour.nl>\n\nOPTS_SPEC for push and pull updated (should have been picked up in an\nearlier commit)\n\nFixed order of cases in setting the --default parameter\n\nConflicts-resolved-by: Paul Campbell <pcampbell@kemitix.net>\n---\n contrib/subtree/git-subtree.sh | 223 +++++++++++++++++++++--------------------\n 1 file changed, 114 insertions(+), 109 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 3582a55..df1413d 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -11,10 +11,10 @@ OPTS_SPEC=\"\\\n git subtree add   --prefix=<prefix> <commit>\n git subtree add   --prefix=<prefix> <repository> <commit>\n git subtree merge --prefix=<prefix> <commit>\n-git subtree pull  --prefix=<prefix> <repository> <refspec...>\n+git subtree pull  --prefix=<prefix> [<repository> [<refspec>...]]\n git subtree pull-all\n git subtree push-all\n-git subtree push  --prefix=<prefix> <repository> <refspec...>\n+git subtree push  --prefix=<prefix> [<repository> [<refspec>...]]\n git subtree list\n git subtree split --prefix=<prefix> <commit...>\n git subtree diff  --prefix=<prefix> [<repository> [<refspec>...]]\n@@ -92,7 +92,7 @@ while [ $# -gt 0 ]; do\n \t\t-b) branch=\"$1\"; shift ;;\n \t\t-P) prefix=\"$1\"; shift ;;\n \t\t-m) message=\"$1\"; shift ;;\n-        -f|--force) force=1 ;;\n+\t\t-f|--force) force=1 ;;\n \t\t--no-prefix) prefix= ;;\n \t\t--onto) onto=\"$1\"; shift ;;\n \t\t--no-onto) onto= ;;\n@@ -113,9 +113,9 @@ prefix=\"${prefix%/}\";\n command=\"$1\"\n shift\n case \"$command\" in\n-    add|merge|pull|from-submodule|pull-all|push-all|prune) default= ;;\n+\tadd|merge|pull|pull-all|push-all|from-submodule|prune) default= ;;\n+\tsplit|push|diff|list) default=\"--default HEAD\" ;;\n \t*) die \"Unknown command '$command'\" ;;\n-    split|push|diff|list) default=\"--default HEAD\" ;;\n esac\n\n if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a \"$command\" !=\n\"push-all\" -a \"$command\" != \"list\" -a \"$command\" != \"prune\" ]; then\n@@ -123,8 +123,10 @@ if [ -z \"$prefix\" -a \"$command\" != \"pull-all\" -a\n\"$command\" != \"push-all\" -a \"$c\n fi\n\n case \"$command\" in\n-    pull-all);;\n-    push-all);;\n+\tpull-all);;\n+\tpush-all);;\n+\tlist);;\n+\tprune);;\n \tadd) [ -e \"$prefix\" ] &&\n \t\tdie \"prefix '$prefix' already exists.\" ;;\n \t*)   [ -e \"$prefix\" ] ||\n@@ -133,7 +135,7 @@ esac\n\n dir=\"$(dirname \"$prefix/.\")\"\n\n-if [ \"$command\" != \"pull\" -a \"$command\" != \"add\" -a \"$command\" !=\n\"push\" -a \"$command\" != \"pull-all\" ]; then\n+if [ \"$command\" != \"pull\" -a \"$command\" != \"add\" -a \"$command\" !=\n\"push\" -a \"$command\" != \"pull-all\" -a \"$command\" != \"diff\" ]; then\n \trevs=$(git rev-parse $default --revs-only \"$@\") || exit $?\n \tdirs=\"$(git rev-parse --no-revs --no-flags \"$@\")\" || exit $?\n \tif [ -n \"$dirs\" ]; then\n@@ -541,14 +543,14 @@ cmd_add_repository()\n \trevs=FETCH_HEAD\n \tset -- $revs\n \tcmd_add_commit \"$@\"\n-\n-  # now add it to our list of repos\n-  git config -f .gittrees --unset subtree.$dir.url\n-  git config -f .gittrees --add subtree.$dir.url $repository\n-  git config -f .gittrees --unset subtree.$dir.path\n-  git config -f .gittrees --add subtree.$dir.path $dir\n-  git config -f .gittrees --unset subtree.$dir.branch\n-  git config -f .gittrees --add subtree.$dir.branch $refspec\n+\n+\t# now add it to our list of repos\n+\tgit config -f .gittrees --unset subtree.$dir.url\n+\tgit config -f .gittrees --add subtree.$dir.url $repository\n+\tgit config -f .gittrees --unset subtree.$dir.path\n+\tgit config -f .gittrees --add subtree.$dir.path $dir\n+\tgit config -f .gittrees --unset subtree.$dir.branch\n+\tgit config -f .gittrees --add subtree.$dir.branch $refspec\n }\n\n cmd_add_commit()\n@@ -721,89 +723,91 @@ cmd_merge()\n\n cmd_pull()\n {\n-  if [ $# -gt 2 ]; then\n-\t    die \"You should provide either <refspec> or <repository> <refspec>\"\n+\tif [ $# -gt 2 ]; then\n+\t\tdie \"You should provide either <refspec> or <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-\t    ensure_clean\n-      if [ $# -eq 1 ]; then\n-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-\t      refspec=$1\n-      elif [ $# -eq 2 ]; then\n-        repository=$1\n-        refspec=$2\n-      else\n-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-        refspec=$(git config -f .gittrees subtree.$prefix.branch)\n-      fi\n-\t    git fetch $repository $refspec || exit $?\n-\t    echo \"git fetch using: \" $repository $refspec\n-\t    revs=FETCH_HEAD\n-\t    set -- $revs\n-\t    cmd_merge \"$@\"\n+\t\tensure_clean\n+\t\tif [ $# -eq 1 ]; then\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$1\n+\t\telif [ $# -eq 2 ]; then\n+\t\t\trepository=$1\n+\t\t\trefspec=$2\n+\t\telse\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$(git config -f .gittrees subtree.$prefix.branch)\n+\t\tfi\n+\t\tgit fetch $repository $refspec || exit $?\n+\t\techo \"git fetch using: \" $repository $refspec\n+\t\trevs=FETCH_HEAD\n+\t\tset -- $revs\n+\t\tcmd_merge \"$@\"\n \telse\n-\t    die \"'$dir' must already exist. Try 'git subtree add'.\"\n+\t\tdie \"'$dir' must already exist. Try 'git subtree add'.\"\n \tfi\n }\n\n-cmd_diff()\n-{\n-    if [ -e \"$dir\" ]; then\n-        if [ $# -eq 1 ]; then\n-            repository=$(git config -f .gittrees subtree.$prefix.url)\n-            refspec=$1\n-        elif [ $# -eq 2 ]; then\n-            repository=$1\n-            refspec=$2\n-        else\n-            repository=$(git config -f .gittrees subtree.$prefix.url)\n-            refspec=$(git config -f .gittrees subtree.$prefix.branch)\n-        fi\n-        # this is ugly, but I don't know of a better way to do it. My\ngit-fu is weak.\n-        # git diff-tree expects a treeish, but I have only a\nrepository and branch name.\n-        # I don't know how to turn that into a treeish without\ncreating a remote.\n-        # Please change this if you know a better way!\n-        tmp_remote=__diff-tmp\n-        git remote rm $tmp_remote > /dev/null 2>&1\n-        git remote add -t $refspec $tmp_remote $repository > /dev/null\n-        # we fetch as a separate step so we can pass -q (quiet),\nwhich isn't an option for \"git remote\"\n-        # could this instead be \"git fetch -q $repository $refspec\"\nand leave aside creating the remote?\n-        # Still need a treeish for the diff-tree command...\n-        git fetch -q $tmp_remote\n-        git diff-tree -p refs/remotes/$tmp_remote/$refspec\n-        git remote rm $tmp_remote > /dev/null 2>&1\n-    else\n-        die \"Cannot resolve directory '$dir'. Please point to an\nexisting subtree directory to diff. Try 'git subtree add' to add a\nsubtree.\"\n-    fi\n+cmd_diff()\n+{\n+\tif [ -e \"$dir\" ]; then\n+\t\tif [ $# -eq 1 ]; then\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$1\n+\t\telif [ $# -eq 2 ]; then\n+\t\t\trepository=$1\n+\t\t\trefspec=$2\n+\t\telse\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$(git config -f .gittrees subtree.$prefix.branch)\n+\t\tfi\n+\t\t# this is ugly, but I don't know of a better way to do it. My git-fu is weak.\n+\t\t# git diff-tree expects a treeish, but I have only a repository and\nbranch name.\n+\t\t# I don't know how to turn that into a treeish without creating a remote.\n+\t\t# Please change this if you know a better way!\n+\t\ttmp_remote=__diff-tmp\n+\t\tgit remote rm $tmp_remote > /dev/null 2>&1\n+\t\tgit remote add -t $refspec $tmp_remote $repository > /dev/null\n+\t\t# we fetch as a separate step so we can pass -q (quiet), which\nisn't an option for \"git remote\"\n+\t\t# could this instead be \"git fetch -q $repository $refspec\" and\nleave aside creating the remote?\n+\t\t# Still need a treeish for the diff-tree command...\n+\t\tgit fetch -q $tmp_remote\n+\t\tgit diff-tree -p refs/remotes/$tmp_remote/$refspec\n+\t\tgit remote rm $tmp_remote > /dev/null 2>&1\n+\telse\n+\t\tdie \"Cannot resolve directory '$dir'. Please point to an existing\nsubtree directory to diff. Try 'git subtree add' to add a subtree.\"\n+\tfi\n }\n\n cmd_push()\n {\n \tif [ $# -gt 2 ]; then\n-\t    die \"You shold provide either <refspec> or <repository> <refspec>\"\n+\t\tdie \"You shold provide either <refspec> or <repository> <refspec>\"\n \tfi\n \tif [ -e \"$dir\" ]; then\n-      if [ $# -eq 1 ]; then\n-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-        refspec=$1\n-      elif [ $# -eq 2 ]; then\n-        repository=$1\n-        refspec=$2\n-      else\n-\t      repository=$(git config -f .gittrees subtree.$prefix.url)\n-        refspec=$(git config -f .gittrees subtree.$prefix.branch)\n-      fi\n-        push_opts=\n-        if [ \"$force\" == \"1\" ]; then\n-            push_opts=\"$push_opts --force\"\n-        fi\n-\t    echo \"git push using: \" $repository $refspec\n-\t    rev=$(git subtree split --prefix=$prefix)\n-\t    if [ -n \"$rev\" ]; then\n-\t        git push $push_opts $repository $rev:refs/heads/$refspec\n-\t    else\n-\t        die \"Couldn't push, 'git subtree split' failed.\"\n-\t    fi\n+\t\tif [ $# -eq 1 ]; then\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$1\n+\t\telif [ $# -eq 2 ]; then\n+\t\t\trepository=$1\n+\t\t\trefspec=$2\n+\t\telse\n+\t\t\trepository=$(git config -f .gittrees subtree.$prefix.url)\n+\t\t\trefspec=$(git config -f .gittrees subtree.$prefix.branch)\n+\t\tfi\n+\n+\t\tpush_opts=\n+\t\tif [ \"$force\" == \"1\" ]; then\n+\t\t  push_opts=\"$push_opts --force\"\n+\t\tfi\n+\n+\t\techo \"git push using: \" $repository $refspec\n+\t\trev=$(git subtree split --prefix=$prefix)\n+\t\tif [ -n \"$rev\" ]; then\n+\t\t\tgit push $push_opts $repository $rev:refs/heads/$refspec\n+\t\telse\n+\t\t\tdie \"Couldn't push, 'git subtree split' failed.\"\n+\t\tfi\n \telse\n \t    die \"'$dir' must already exist. Try 'git subtree add'.\"\n \tfi\n@@ -831,6 +835,7 @@ cmd_from-submodule()\n \tgit commit -m \"Remove '$prefix/' submodule\"\n\n \t# subtree add from submodule repo.\n+\t# TODO: Could be determin HEAD to be a specific branch\n \tcmd_add_repository $tmp_repo HEAD\n\n \t# Update .gittrees with the original repo url\n@@ -841,46 +846,46 @@ cmd_from-submodule()\n \trm -rf $tmp_repo\n }\n\n-subtree_list()\n+subtree_list()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n-    while read path; do\n-        repository=$(git config -f .gittrees subtree.$path.url)\n-        refspec=$(git config -f .gittrees subtree.$path.branch)\n-        echo \"    $path        (merged from $repository branch $refspec) \"\n-    done\n+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\trepository=$(git config -f .gittrees subtree.$path.url)\n+\t\trefspec=$(git config -f .gittrees subtree.$path.branch)\n+\t\techo \"\t$path\t\t(merged from $repository branch $refspec) \"\n+\tdone\n }\n\n cmd_list()\n {\n-  subtree_list\n+  subtree_list\n }\n\n cmd_prune()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n-    while read path; do\n-        if [ ! -e \"$path\" ]; then\n-            echo \"pruning $path\"\n-            git config -f .gittrees --remove-section subtree.$path\n-        fi\n-    done\n+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\tif [ ! -e \"$path\" ]; then\n+\t\t\techo \"pruning $path\"\n+\t\t\tgit config -f .gittrees --remove-section subtree.$path\n+\t\tfi\n+\tdone\n }\n\n cmd_pull-all()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n-        while read path; do\n-            git subtree pull -P $path master || exit $?\n-        done\n+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\tgit subtree pull -P $path $(git config -f .gittrees\nsubtree.$path.url) $(git config -f .gittrees subtree.$path.branch) ||\nexit $?\n+\tdone\n }\n\n cmd_push-all()\n {\n-    git config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n-        while read path; do\n-            git subtree push -P $path master || exit $?\n-        done\n+\tgit config -f .gittrees -l | grep subtree | grep path | grep -o\n'=.*' | grep -o '[^=].*' |\n+\twhile read path; do\n+\t\tgit subtree push -P $path $(git config -f .gittrees\nsubtree.$path.url) $(git config -f .gittrees subtree.$path.branch) ||\nexit $?\n+\tdone\n }\n\n \"cmd_$command\" \"$@\"\n-- \n1.8.2.rc1\n\n\n-- \nPaul [W] Campbell\n"}]}