{"thread":{"id":"8599","subject":"[PATCH guilt] make guilt use standard POSIX shell","startedAt":"2007-06-14T12:50:55Z","lastAt":"2007-06-15T22:31:12Z","messageCount":22,"participants":["Pierre Habouzit","Josef Sipek","Derek Fawcus","Benjamin Sergeant"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45062","messageId":"11818254621527-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":null,"subject":"[PATCH guilt] make guilt use standard POSIX shell","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:50:55Z","receivedAt":"2007-06-14T12:50:55Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"This patch series makes guilt be able to work with a standard posix shell.\n\nThis has been tested with bash, zsh, dash and posh acting as /bin/sh.\n\nThis uses awk and sed a bit more than before, but POSIX awk and sed should be\nenough. Though GNU find and GNU /bin/echo from the coreutils needs to be\nthere.\n\nHere is the shortlog:\n\n\tPierre Habouzit (7):\n\t\t  Regression test suite needs bash, that's OK.\n\t\t  guilt(1): Obvious bashisms fixed.\n\t\t  guilt(1): simplifications...\n\t\t  guilt(1): reimplement push_patch, using a subshell to avoid locals.\n\t\t  Easy commands, without bashisms.\n\t\t  guilt-status(1): Remove bashisms.\n\t\t  Remove last bashisms from remaining commands.\n\nand the diffstat:\n\n\t guilt                       |  448 +++++++++++++++++++------------------------\n\t guilt-add                   |    7 +-\n\t guilt-applied               |    4 +-\n\t guilt-delete                |    4 +-\n\t guilt-export                |    6 +-\n\t guilt-files                 |    6 +-\n\t guilt-fold                  |    4 +-\n\t guilt-fork                  |    6 +-\n\t guilt-graph                 |   13 +-\n\t guilt-header                |    4 +-\n\t guilt-help                  |    6 +-\n\t guilt-import                |    6 +-\n\t guilt-import-commit         |    6 +-\n\t guilt-init                  |    4 +-\n\t guilt-new                   |   15 +-\n\t guilt-next                  |    6 +-\n\t guilt-patchbomb             |   10 +-\n\t guilt-pop                   |    4 +-\n\t guilt-prev                  |    4 +-\n\t guilt-push                  |   16 +-\n\t guilt-rebase                |    4 +-\n\t guilt-refresh               |    4 +-\n\t guilt-rm                    |    4 +-\n\t guilt-series                |    6 +-\n\t guilt-status                |   58 +++---\n\t guilt-top                   |    4 +-\n\t guilt-unapplied             |   12 +-\n\t regression/010-init.sh      |    1 +\n\t regression/011-no-repo.sh   |    1 +\n\t regression/020-push.sh      |    1 +\n\t regression/021-pop.sh       |    1 +\n\t regression/022-applied.sh   |    1 +\n\t regression/023-top.sh       |    1 +\n\t regression/024-unapplied.sh |    1 +\n\t regression/025-new.sh       |    1 +\n\t regression/026-delete.sh    |    1 +\n\t regression/027-refresh.sh   |    1 +\n\t regression/050-series.sh    |    1 +\n\t regression/060-files.sh     |    1 +\n\t regression/Makefile         |    2 +-\n\t uninstall                   |    7 +-\n\t 41 files changed, 317 insertions(+), 375 deletions(-)\n"},{"id":"45069","messageId":"11818254622701-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] Regression test suite needs bash, that's OK.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:50:56Z","receivedAt":"2007-06-14T12:50:56Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n regression/010-init.sh      |    1 +\n regression/011-no-repo.sh   |    1 +\n regression/020-push.sh      |    1 +\n regression/021-pop.sh       |    1 +\n regression/022-applied.sh   |    1 +\n regression/023-top.sh       |    1 +\n regression/024-unapplied.sh |    1 +\n regression/025-new.sh       |    1 +\n regression/026-delete.sh    |    1 +\n regression/027-refresh.sh   |    1 +\n regression/050-series.sh    |    1 +\n regression/060-files.sh     |    1 +\n regression/Makefile         |    2 +-\n 13 files changed, 13 insertions(+), 1 deletions(-)\n\ndiff --git a/regression/010-init.sh b/regression/010-init.sh\nindex 17c1c16..1553d0c 100755\n--- a/regression/010-init.sh\n+++ b/regression/010-init.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the init code\n #\ndiff --git a/regression/011-no-repo.sh b/regression/011-no-repo.sh\nindex b37a548..fd4f6a5 100755\n--- a/regression/011-no-repo.sh\n+++ b/regression/011-no-repo.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test that all commands that should fail do indeed fail if the branch was\n # not guilt-init'ed\ndiff --git a/regression/020-push.sh b/regression/020-push.sh\nindex 0d49a7e..6242529 100755\n--- a/regression/020-push.sh\n+++ b/regression/020-push.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the push code\n #\ndiff --git a/regression/021-pop.sh b/regression/021-pop.sh\nindex 418a054..e1af856 100755\n--- a/regression/021-pop.sh\n+++ b/regression/021-pop.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the pop code\n #\ndiff --git a/regression/022-applied.sh b/regression/022-applied.sh\nindex 78d00d9..f259bf4 100755\n--- a/regression/022-applied.sh\n+++ b/regression/022-applied.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the applied code\n #\ndiff --git a/regression/023-top.sh b/regression/023-top.sh\nindex d490f14..c486448 100755\n--- a/regression/023-top.sh\n+++ b/regression/023-top.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the top code\n #\ndiff --git a/regression/024-unapplied.sh b/regression/024-unapplied.sh\nindex 368b3cc..ecb0298 100755\n--- a/regression/024-unapplied.sh\n+++ b/regression/024-unapplied.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the unapplied code\n #\ndiff --git a/regression/025-new.sh b/regression/025-new.sh\nindex f17f20e..680f6da 100755\n--- a/regression/025-new.sh\n+++ b/regression/025-new.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the new code\n #\ndiff --git a/regression/026-delete.sh b/regression/026-delete.sh\nindex 7c16b38..07c969a 100755\n--- a/regression/026-delete.sh\n+++ b/regression/026-delete.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the delete code\n #\ndiff --git a/regression/027-refresh.sh b/regression/027-refresh.sh\nindex 4a3270e..704d0b5 100755\n--- a/regression/027-refresh.sh\n+++ b/regression/027-refresh.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the refresh code\n #\ndiff --git a/regression/050-series.sh b/regression/050-series.sh\nindex 437cd2f..eb23540 100755\n--- a/regression/050-series.sh\n+++ b/regression/050-series.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the series parsing code\n #\ndiff --git a/regression/060-files.sh b/regression/060-files.sh\nindex 875f991..915c73a 100755\n--- a/regression/060-files.sh\n+++ b/regression/060-files.sh\n@@ -1,3 +1,4 @@\n+#!/bin/bash\n #\n # Test the series parsing code\n #\ndiff --git a/regression/Makefile b/regression/Makefile\nindex c538029..3dd9d0e 100644\n--- a/regression/Makefile\n+++ b/regression/Makefile\n@@ -1,3 +1,3 @@\n .PHONY: all\n all:\n-\t(for x in *.sh ; do sh $$x || exit $?; done)\n+\tset -e; $(foreach x,$(wildcard *.sh),./$x;)\n-- \n1.5.2.1\n"},{"id":"45065","messageId":"1181825462590-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] guilt(1): Obvious bashisms fixed.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:50:57Z","receivedAt":"2007-06-14T12:50:57Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  + function foo { } -> foo() { }\n  + add wrapper for echo -e\n  + couple of '[' bashisms\n  + get rid of easy local variables to remove\n  + avoid cd - (using subshells)\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt |  185 ++++++++++++++++++++++++++++++++---------------------------------\n 1 files changed, 91 insertions(+), 94 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 2ae76f8..80f3faf 100755\n--- a/guilt\n+++ b/guilt\n@@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1\n \n . git-sh-setup\n \n-function guilt_commands\n+#\n+# Shell library\n+#\n+\n+# echo -e is a bashism, fallback to /bin/echo if the builtin does not supports it\n+echo()\n+{\n+\t/bin/echo \"$@\"\n+}\n+\n+noerr()\n+{\n+    \"$@\" 2>/dev/null\n+}\n+\n+silent()\n+{\n+    \"$@\" >/dev/null 2>/dev/null\n+}\n+\n+########\n+\n+guilt_commands()\n {\n \tlocal command\n \tfor command in $0-*\n@@ -32,7 +54,7 @@ function guilt_commands\n \tdone\n }\n \n-if [ `basename $0` = \"guilt\" ]; then\n+if [ \"`basename $0`\" = \"guilt\" ]; then\n \t# being run as standalone\n \n \t# by default, we shouldn't fail\n@@ -58,7 +80,7 @@ if [ `basename $0` = \"guilt\" ]; then\n \t\t\t\tesac\n \t\t\tdone\n \t\tfi\n-\t\tif [ $cmd ]; then\n+\t\tif [ -n \"$cmd\" ]; then\n \t\t\tshift\n \t\t\texec \"$dir/guilt-$cmd\" \"$@\"\n \n@@ -96,68 +118,55 @@ fi\n #\n \n # usage: valid_patchname <patchname>\n-function valid_patchname\n+valid_patchname()\n {\n-\t[ `echo \"$1\" | grep -e '^/' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '^\\./' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '^\\.\\./' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '/\\./' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '/\\.\\./' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '/\\.$' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '/\\.\\.$' | wc -l` -gt 0 ] && return 1\n-\t[ `echo \"$1\" | grep -e '/$' | wc -l` -gt 0 ] && return 1\n-\treturn 0\n+\tcase \"$1\" in\n+\t\t/*|./*|../*|*/./*|*/../*|*/.|*/..|*/)\n+\t\t\treturn 1;;\n+\t\t*)\n+\t\t\treturn 0;;\n+\tesac\n }\n \n-function get_branch\n+get_branch()\n {\n \tgit-symbolic-ref HEAD | sed -e 's,^refs/heads/,,'\n }\n \n-function verify_branch\n+verify_branch()\n {\n-\tlocal b=$branch\n-\n \t[ ! -d \"$GIT_DIR/patches\" ] &&\n \t\techo \"Patches directory doesn't exist, try guilt-init\" >&2 &&\n \t\treturn 1\n-\t[ ! -d \"$GIT_DIR/patches/$b\" ] &&\n-\t\techo \"Branch $b is not initialized, try guilt-init\" >&2 &&\n+\t[ ! -d \"$GIT_DIR/patches/$branch\" ] &&\n+\t\techo \"Branch $branch is not initialized, try guilt-init\" >&2 &&\n \t\treturn 1\n-\t[ ! -f \"$GIT_DIR/patches/$b/series\" ] &&\n-\t\techo \"Branch $b does not have a series file\" >&2 &&\n+\t[ ! -f \"$GIT_DIR/patches/$branch/series\" ] &&\n+\t\techo \"Branch $branch does not have a series file\" >&2 &&\n \t\treturn 1\n-\t[ ! -f \"$GIT_DIR/patches/$b/status\" ] &&\n-\t\techo \"Branch $b does not have a status file\" >&2 &&\n+\t[ ! -f \"$GIT_DIR/patches/$branch/status\" ] &&\n+\t\techo \"Branch $branch does not have a status file\" >&2 &&\n \t\treturn 1\n-\t[ -f \"$GIT_DIR/patches/$b/applied\" ] &&\n-\t\techo \"Warning: Branch $b has 'applied' file - guilt is not compatible with stgit\" >&2 &&\n+\t[ -f \"$GIT_DIR/patches/$branch/applied\" ] &&\n+\t\techo \"Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit\" >&2 &&\n \t\treturn 1\n \n \treturn 0\n }\n \n-function get_top\n+get_top()\n {\n \ttail -1 \"$GUILT_DIR/$branch/status\" | cut -d: -f 2-\n }\n \n-function get_prev\n+get_prev()\n {\n-\tlocal n=`wc -l < \"$GUILT_DIR/$branch/status\"`\n-\tlocal n=`expr $n - 1`\n-\n-\tlocal idx=0\n-\tcat \"$GUILT_DIR/$branch/status\" | while read p; do\n-\t\tidx=`expr $idx + 1`\n-\t\t[ $idx -lt $n ] && continue\n-\t\t[ $idx -gt $n ] && break\n-\n-\t\techo \"$p\"\n-\tdone\n+\tif [ `wc -l < \"$GUILT_DIR/$branch/status\"` -gt 1 ]; then\n+\t\ttail -n 2 \"$GUILT_DIR/$branch/status\" | head -n 1\n+\tfi\n }\n \n-function get_series\n+get_series()\n {\n \t# ignore all lines matching:\n \t#\t- empty lines\n@@ -168,7 +177,7 @@ function get_series\n }\n \n # usage: do_make_header <hash>\n-function do_make_header\n+do_make_header()\n {\n \t# which revision do we want to work with?\n \tlocal rev=\"$1\"\n@@ -195,7 +204,7 @@ BEGIN{ok=0}\n }\n \n # usage: do_get_header patchfile\n-function do_get_header\n+do_get_header()\n {\n \t# The complexity arises from the fact that we want to ignore the\n \t# From line and the empty line after it if it exists\n@@ -212,7 +221,7 @@ END{}\n }\n \n # usage: do_get_full_header patchfile\n-function do_get_full_header\n+do_get_full_header()\n {\n \t# 2nd line checks for the begining of a patch\n \t# 3rd line outputs the line if it didn't get pruned by the above rules\n@@ -225,37 +234,31 @@ END{}\n }\n \n # usage: assert_head_check\n-function assert_head_check\n+assert_head_check()\n {\n-\tlocal eh=`tail -1 < \"$applied\" | cut -d: -f 1`\n-\n-\tif ! head_check \"$eh\"; then\n+\tif ! head_check \"`tail -1 < \"$applied\" | cut -d: -f 1`\"; then\n \t\tdie \"aborting...\"\n \tfi\n-\n-\treturn 0\n }\n \n # usage: head_check <expected hash>\n-function head_check\n+head_check()\n {\n \t# make sure we're not doing funky things to commits that don't\n \t# belong to us\n-\tlocal ch=`cat \"$GIT_DIR/refs/heads/$branch\"`\n-\n \t# if the expected hash is empty, just return\n \t[ -z \"$1\" ] && return 0\n \n-\tif [ \"$ch\" != \"$1\" ]; then\n+\tif [ \"`cat \"$GIT_DIR/refs/heads/$branch\"`\" != \"$1\" ]; then\n \t\techo \"Expected HEAD commit $1\" >&2\n-\t\techo \"                 got $ch\" >&2\n+\t\techo \"                 got `cat \"$GIT_DIR/refs/heads/$branch\"`\" >&2\n \t\treturn 1\n \tfi\n \treturn 0\n }\n \n # usage: series_insert_patch <patchname>\n-function series_insert_patch\n+series_insert_patch()\n {\n \tlocal top=`get_top | sed -e 's,/,\\\\\\\\/,g'`\n \tlocal new=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'` \n@@ -271,14 +274,14 @@ function series_insert_patch\n }\n \n # usage: series_remove_patch <patchname>\n-function series_remove_patch\n+series_remove_patch()\n {\n \tgrep -v \"^$1\\$\" < \"$series\" > \"$series.tmp\"\n \tmv \"$series.tmp\" \"$series\"\n }\n \n # usage: series_rename_patch <oldname> <newname>\n-function series_rename_patch\n+series_rename_patch()\n {\n \tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n \tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n@@ -290,7 +293,7 @@ function series_rename_patch\n # file directly\n #\n # usage: applied_rename_patch <oldname> <newname>\n-function applied_rename_patch\n+applied_rename_patch()\n {\n \tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n \tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n@@ -299,33 +302,32 @@ function applied_rename_patch\n }\n \n # usage: pop_many_patches <commitish> <number of patches>\n-function pop_many_patches\n+pop_many_patches()\n {\n \tassert_head_check\n \n+\t(\n \tcd \"$TOP_DIR\"\n \n \tgit-reset --hard \"$1\" > /dev/null\n \thead -n \"-$2\" < \"$applied\" > \"$applied.tmp\"\n \tmv \"$applied.tmp\" \"$applied\"\n-\n-\tcd - 2>&1 >/dev/null\n+\t)\n \n \t# update references to top, bottom, and base\n \tupdate_stack_tags\n }\n \n # usage: pop_all_patches\n-function pop_all_patches\n+pop_all_patches()\n {\n-\tlocal x=`head -1 \"$applied\" | cut -d: -f1`\n-\tlocal n=`wc -l < \"$applied\"`\n-\n-\tpop_many_patches $x^ $n\n+\tpop_many_patches \\\n+\t\t`head -1 \"$applied\" | cut -d: -f1`^ \\\n+\t\t`wc -l < \"$applied\"`\n }\n \n # usage: update_stack_tags\n-function update_stack_tags\n+update_stack_tags()\n {\n \t# bail if autotagging is not enabled\n \tif [ $autotag -eq 0 ]; then\n@@ -336,13 +338,9 @@ function update_stack_tags\n \t\t# there are patches applied, therefore we must get the top,\n \t\t# bottom and base hashes, and update the tags\n \n-\t\tlocal top_hash=`git-rev-parse HEAD`\n-\t\tlocal bottom_hash=`head -1 < $applied | cut -d: -f1`\n-\t\tlocal base_hash=`git-rev-parse $bottom_hash^`\n-\n-\t\techo $top_hash > \"$GIT_DIR/refs/tags/${branch}_top\"\n-\t\techo $bottom_hash > \"$GIT_DIR/refs/tags/${branch}_bottom\"\n-\t\techo $base_hash > \"$GIT_DIR/refs/tags/${branch}_base\"\n+                git-rev-parse HEAD > \"$GIT_DIR/refs/tags/${branch}_top\"\n+                head -1 < $applied | cut -d: -f1 > \"$GIT_DIR/refs/tags/${branch}_bottom\"\n+\t\tgit-rev-parse $(head -1 < $applied | cut -d: -f1)^ > \"$GIT_DIR/refs/tags/${branch}_base\"\n \telse\n \t\t# there are no patches applied, therefore we must remove the\n \t\t# tags to old top, bottom, and base\n@@ -354,7 +352,7 @@ function update_stack_tags\n }\n \n # usage: push_patch patchname [bail_action]\n-function push_patch\n+push_patch()\n {\n \tlocal p=\"$GUILT_DIR/$branch/$1\"\n \tlocal pname=\"$1\"\n@@ -459,54 +457,53 @@ function push_patch\n }\n \n # usage: must_commit_first\n-function must_commit_first\n+must_commit_first()\n {\n \t[ `git-diff-files | wc -l` -eq 0 ]\n \treturn $?\n }\n \n # usage: fold_patch patchname\n-function fold_patch\n+fold_patch()\n {\n-\tlocal top_patch=`get_top`\n+\tset -- \"$1\" \"`get_top`\"\n \n \tassert_head_check\n \n \tpush_patch \"$1\"\n \n-\t__refresh_patch \"$top_patch\" HEAD^^ 2\n+\t__refresh_patch \"$2\" HEAD^^ 2\n \n \tseries_remove_patch \"$1\"\n }\n \n # usage: refresh_patch patchname\n-function refresh_patch\n+refresh_patch()\n {\n \t__refresh_patch \"$1\" HEAD^ 1\n }\n \n # usage: __refresh_patch patchname commitish number_of_commits\n-function __refresh_patch\n+__refresh_patch()\n {\n-\tlocal p=\"$GUILT_DIR/$branch/$1\"\n-\n \tassert_head_check\n \n-\tcd \"$TOP_DIR\"\n-\n-\tgit-diff-files --name-only | (while read n; do git-update-index \"$n\" ; done)\n+\t(\n+\t\tcd \"$TOP_DIR\"\n+\t\t\tp=\"$GUILT_DIR/$branch/$1\"\n \n-\t# get the patch header\n-\tdo_get_full_header \"$p\" > /tmp/guilt.diff.$$\n+\t\tgit-diff-files --name-only | (while read n; do git-update-index \"$n\" ; done)\n \n-\t# get the new patch\n-\tgit-diff \"$2\" >> /tmp/guilt.diff.$$\n+\t\t# get the patch header\n+\t\tdo_get_full_header \"$p\" > /tmp/guilt.diff.$$\n \n-\t# move the new patch in\n-\tmv \"$p\" \"$p~\"\n-\tmv /tmp/guilt.diff.$$ $p\n+\t\t# get the new patch\n+\t\tgit-diff \"$2\" >> /tmp/guilt.diff.$$\n \n-\tcd - 2>&1 >/dev/null\n+\t\t# move the new patch in\n+\t\tmv \"$p\" \"$p~\"\n+\t\tmv /tmp/guilt.diff.$$ $p\n+\t)\n \n \t# drop the currently applied patch, pop_many_patches does it's own\n \t# cd $TOP_DIR\n@@ -525,7 +522,7 @@ function __refresh_patch\n #\t<hash1>..<hash2>\t- from hash to hash (inclusive)\n #\n # The output of this function is suitable to be passed to git-rev-list\n-function munge_hash_range\n+munge_hash_range()\n {\n \t[ -z \"$1\" ] && return 1\n \n-- \n1.5.2.1\n"},{"id":"45063","messageId":"11818254621458-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] guilt(1): simplifications...","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:50:58Z","receivedAt":"2007-06-14T12:50:58Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  + using awk to avoid local variables\n  + more clever with sed\n  + reimplement munge_hash_range with case\n\n  and some whitespace problems.\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt |  132 ++++++++++++++++++++++++++++-------------------------------------\n 1 files changed, 57 insertions(+), 75 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 80f3faf..44273f3 100755\n--- a/guilt\n+++ b/guilt\n@@ -44,14 +44,7 @@ silent()\n \n guilt_commands()\n {\n-\tlocal command\n-\tfor command in $0-*\n-\tdo\n-\t\tif [ -f \"$command\" -a -x \"$command\" ]\n-\t\tthen\n-\t\t\techo ${command##$0-}\n-\t\tfi\n-\tdone\n+\tfind \"`dirname $0`\" -maxdepth 1 -name \"guilt-*\" -type f -perm /111 | sed -e \"s/.*\\\\/`basename $0`-//\"\n }\n \n if [ \"`basename $0`\" = \"guilt\" ]; then\n@@ -97,9 +90,7 @@ if [ \"`basename $0`\" = \"guilt\" ]; then\n \techo \"Guilt v$GUILT_VERSION\"\n \techo \"\"\n \techo \"Pick a command:\"\n-\tfor x in `dirname $0`/guilt-*; do\n-\t\t[ -x $x ] && echo -e ${x##$0-}\n-\tdone | sort | column | column -t | sed -e $'s/^/\\t/'\n+\tguilt_commands | sort | column | column -t | sed -e 's/^/\\t/'\n \n \techo \"\"\n \techo \"Example:\"\n@@ -173,34 +164,29 @@ get_series()\n \t#\t- whitespace only\n \t#\t- optional whitespace followed by '#' followed by more\n \t#\t  optional whitespace\n-\tgrep -ve '^[[:space:]]*\\(#.*\\)*$' < \"$series\"\n+\tgrep -ve '^[[:space:]]*\\(#.*\\)*$' \"$series\"\n }\n \n # usage: do_make_header <hash>\n do_make_header()\n {\n-\t# which revision do we want to work with?\n-\tlocal rev=\"$1\"\n-\n \t# we should try to work with commit objects only\n-\tif [ `git-cat-file -t \"$rev\"` != \"commit\" ]; then\n-\t\techo \"Hash $rev is not a commit object\" >&2\n+\tif [ `git-cat-file -t \"$1\"` != \"commit\" ]; then\n+\t\techo \"Hash $1 is not a commit object\" >&2\n \t\techo \"Aborting...\" >&2\n \t\texit 2\n \tfi\n \n-\t# get the author line from the commit object\n-\tlocal author=`git-cat-file -p \"$rev\" | grep -e '^author ' | head -1`\n-\n-\t# strip the timestamp & '^author ' string\n-\tauthor=`echo \"$author\" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`\n-\n-\tgit-cat-file -p \"$rev\" | awk \"\n-BEGIN{ok=0}\n-(ok==1){print \\$0; print \\\"\\nFrom: $author\\\"; ok=2; next}\n-(ok==2){print \\$0}\n-/^\\$/ && (ok==0){ok=1}\n-\"\n+\tgit-cat-file -p \"$1\" | sed -e \\\n+\t\t'1,/^$/ {\n+\t\t\t/^author/ {\n+\t\t\t\ts/^author /From: /\n+\t\t\t\ts/ [0-9]* [+-]*[0-9][0-9]*$//\n+\t\t\t\tp\n+\t\t\t}\n+\t\t\t/^$/p\n+\t\t\td\n+\t\t}'\n }\n \n # usage: do_get_header patchfile\n@@ -260,17 +246,12 @@ head_check()\n # usage: series_insert_patch <patchname>\n series_insert_patch()\n {\n-\tlocal top=`get_top | sed -e 's,/,\\\\\\\\/,g'`\n-\tlocal new=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'` \n-\n-\tif [ ! -z \"$top\" ]; then\n-\t\tsed -i -e \"s/^$top\\$/$top\\n$new/\" \"$series\"\n-\telse\n-\t\t# don't use $new here as it would only complicate things\n-\t\techo \"$1\" > \"$series.tmp\"\n-\t\tcat \"$series\" >> \"$series.tmp\"\n-\t\tmv \"$series.tmp\" \"$series\"\n-\tfi\n+\tawk -v top=\"`get_top`\" -v new=\"$1\" '{\n+\t\t\tif (top == \"\" && NR == 1) print new;\n+\t\t\tprint $0;\n+\t\t\tif (top != \"\" && top == $0) print new;\n+\t\t}' \"$series\" > \"$series.tmp\"\n+\tmv \"$series.tmp\" \"$series\"\n }\n \n # usage: series_remove_patch <patchname>\n@@ -283,10 +264,11 @@ series_remove_patch()\n # usage: series_rename_patch <oldname> <newname>\n series_rename_patch()\n {\n-\tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n-\tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n+\tawk -v old=\"$1\" -v new=\"$2\" \\\n+\t\t'{ if ($0 == old) print new; else print $0 }' \\\n+\t\t\"$series.tmp\" > \"$series\"\n \n-\tsed -i -e \"s/^$old\\$/$new/\" \"$series\"\n+\tmv \"$series.tmp\" \"$series\"\n }\n \n # Beware! This is one of the few (only?) places where we modify the applied\n@@ -295,10 +277,15 @@ series_rename_patch()\n # usage: applied_rename_patch <oldname> <newname>\n applied_rename_patch()\n {\n-\tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n-\tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n+\tawk -v old=\"$1\" -v new=\"$2\" \\\n+\t\t\t'BEGIN{FS=\":\"}\n+\t\t\t{ if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)\n+\t\t\t\tprint substr($0, 0, 41) new;\n+\t\t\telse\n+\t\t\t\tprint;\n+\t\t\t}' \"$applied\" > \"$applied.new\"\n \n-\tsed -i -e \"s/^\\\\([0-9a-f]\\\\{40\\\\}\\\\):$old\\$/\\\\1:$new/\" \"$applied\"\n+\tmv \"$applied.tmp\" \"$applied\"\n }\n \n # usage: pop_many_patches <commitish> <number of patches>\n@@ -307,11 +294,11 @@ pop_many_patches()\n \tassert_head_check\n \n \t(\n-\tcd \"$TOP_DIR\"\n+\t\tcd \"$TOP_DIR\"\n \n-\tgit-reset --hard \"$1\" > /dev/null\n-\thead -n \"-$2\" < \"$applied\" > \"$applied.tmp\"\n-\tmv \"$applied.tmp\" \"$applied\"\n+\t\tgit-reset --hard \"$1\" > /dev/null\n+\t\thead -n \"-$2\" < \"$applied\" > \"$applied.tmp\"\n+\t\tmv \"$applied.tmp\" \"$applied\"\n \t)\n \n \t# update references to top, bottom, and base\n@@ -490,7 +477,7 @@ __refresh_patch()\n \n \t(\n \t\tcd \"$TOP_DIR\"\n-\t\t\tp=\"$GUILT_DIR/$branch/$1\"\n+\t\tp=\"$GUILT_DIR/$branch/$1\"\n \n \t\tgit-diff-files --name-only | (while read n; do git-update-index \"$n\" ; done)\n \n@@ -524,30 +511,25 @@ __refresh_patch()\n # The output of this function is suitable to be passed to git-rev-list\n munge_hash_range()\n {\n-\t[ -z \"$1\" ] && return 1\n-\n-\tlocal l=`echo \"$1\" | sed -e 's/\\.\\./ /'`\n-\n-\tlocal h1=`echo \"$l\" | cut -s -d' ' -f 1`\n-\tlocal h2=`echo \"$l\" | cut -s -d' ' -f 2`\n-\n-\tif [ -z \"$h1\" -a -z \"$h2\" ]; then\n-\t\t# e.g., \"v0.19\"\n-\t\techo \"$l^..$l\"\n-\telif [ -z \"$h1\" ]; then\n-\t\t# e.g., \"..v0.10\"\n-\t\techo \"$h2\"\n-\telif [ -z \"$h2\" ]; then\n-\t\t# e.g., \"v0.19..\"\n-\t\techo \"$h1..HEAD\"\n-\telif [ ! -z \"$h1\" -a ! -z \"$h2\" ]; then\n-\t\t# e.g., \"v0.19-rc1..v0.19\"\n-\t\techo \"$h1..$h2\"\n-\telse\n-\t\t# unknown hash range format\n-\t\treturn 1\n-\tfi\n-\n+\tcase \"$1\" in\n+\t\t*..*..*|*\\ *)\n+\t\t\t# double .. or space is illegal\n+\t\t\treturn 1;;\n+\t\t..*)\n+\t\t\t# e.g., \"..v0.10\"\n+\t\t\techo ${1#..};;\n+\t\t*..)\n+\t\t\t# e.g., \"v0.19..\"\n+\t\t\techo ${1%..}..HEAD;;\n+\t\t*..*)\n+\t\t\t# e.g., \"v0.19-rc1..v0.19\"\n+\t\t\techo ${1%%..*}..${1#*..};;\n+\t\t?*)\n+\t\t\t# e.g., \"v0.19\"\n+\t\t\techo $1^..$1;;\n+\t\t*)  # empty\n+\t\t\treturn 1;;\n+\tesac\n \treturn 0\n }\n \n-- \n1.5.2.1\n"},{"id":"45066","messageId":"11818254623497-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] guilt(1): reimplement push_patch, using a subshell to avoid locals.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:50:59Z","receivedAt":"2007-06-14T12:50:59Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  this is a bit ugly, but makes the code really shorter, and more readable\nanyway. We still need the old bail variable, named __push_patch_bail to\navoid spurious collisions (we are not recursing into ourselves, so it's\nsafe).\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt |  133 ++++++++++++++++++++++++-----------------------------------------\n 1 files changed, 49 insertions(+), 84 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 44273f3..f77c050 100755\n--- a/guilt\n+++ b/guilt\n@@ -1,4 +1,4 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n@@ -341,106 +341,71 @@ update_stack_tags()\n # usage: push_patch patchname [bail_action]\n push_patch()\n {\n-\tlocal p=\"$GUILT_DIR/$branch/$1\"\n-\tlocal pname=\"$1\"\n-\tlocal bail_action=\"$2\"\n+\t__push_patch_bail=0\n \n-\tlocal bail=0\n-\tlocal reject=\"--reject\"\n-\n-\tassert_head_check\n-\n-\tcd \"$TOP_DIR\"\n+\t(\n+\t\tp=\"$GUILT_DIR/$branch/$1\"\n+\t\tpname=\"$1\"\n+\t\tbail_action=\"$2\"\n+\t\treject=\"--reject\"\n \n-\t# apply the patch if and only if there is something to apply\n-\tif [ `git-apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n-\t\tif [ \"$bail_action\" = abort ]; then\n-\t\t    reject=\"\"\n-\t\tfi\n-\t\tgit-apply -C$guilt_push_diff_context \\\n-\t\t\t$reject \"$p\" > /dev/null 2> /tmp/guilt.log.$$\n-\t\tbail=$?\n+\t\tassert_head_check\n+\t\tcd \"$TOP_DIR\"\n \n-\t\tif [ $bail -ne 0 ]; then\n-\t\t\tcat /tmp/guilt.log.$$ >&2\n+\t\t# apply the patch if and only if there is something to apply\n+\t\tif [ `git-apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n \t\t\tif [ \"$bail_action\" = abort ]; then\n-\t\t\t\treturn $bail\n+\t\t\t\treject=\"\"\n+\t\t\tfi\n+\t\t\tgit-apply -C$guilt_push_diff_context \\\n+\t\t\t\t$reject \"$p\" > /dev/null 2> /tmp/guilt.log.$$\n+\t\t\t__push_patch_bail=$?\n+\n+\t\t\tif [ $__push_patch_bail -ne 0 ]; then\n+\t\t\t\tcat /tmp/guilt.log.$$ >&2\n+\t\t\t\tif [ \"$bail_action\" = \"abort\" ]; then\n+\t\t\t\t\trm -f /tmp/guilt.log.$$ /tmp/guilt.msg.$$\n+\t\t\t\t\treturn $__push_patch_bail\n+\t\t\t\tfi\n \t\t\tfi\n-\t\tfi\n-\n-\t\t# FIXME: Path munging is being done, we need to convince\n-\t\t# git-apply to just give us list of files with \\0 as a\n-\t\t# delimiter, and pass -z to git-update-index\n-\t\tgit-apply --numstat \"$p\" | cut -f 3- | git-update-index --add --remove --stdin\n-\tfi\n \n-\t# grab a commit message out of the patch\n-\tdo_get_header \"$p\" > /tmp/guilt.msg.$$\n+\t\t\t# FIXME: Path munging is being done, we need to convince\n+\t\t\t# git-apply to just give us list of files with \\0 as a\n+\t\t\t# delimiter, and pass -z to git-update-index\n+\t\t\tgit-apply --numstat \"$p\" | cut -f 3- | git-update-index --add --remove --stdin\n+\t\tfi\n \n-\t# make a default commit message if patch doesn't contain one\n-\t[ ! -s /tmp/guilt.msg.$$ ] && echo \"patch $pname\" > /tmp/guilt.msg.$$\n+\t\t# grab a commit message out of the patch\n+\t\tdo_get_header \"$p\" > /tmp/guilt.msg.$$\n \n-\t# extract a From line from the patch header, and set\n-\t# GIT_AUTHOR_{NAME,EMAIL}\n-\tlocal author_str=`cat \"$p\" | grep -e '^From: ' | sed -e 's/^From: //'`\n-\tif [ ! -z \"$author_str\" ]; then\n-\t\tlocal backup_author_name=\"$GIT_AUTHOR_NAME\"\n-\t\tlocal backup_author_email=\"$GIT_AUTHOR_EMAIL\"\n-\t\tGIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`\n-\t\tGIT_AUTHOR_EMAIL=`echo $author_str | sed -e 's/[^<]*//'`\n+\t\t# make a default commit message if patch doesn't contain one\n+\t\t[ ! -s /tmp/guilt.msg.$$ ] && echo \"patch $pname\" > /tmp/guilt.msg.$$\n \n-\t\tif [ -z \"$GIT_AUTHOR_NAME\" ]; then\n-\t\t\tGIT_AUTHOR_NAME=\" \"\n+\t\t# extract a From line from the patch header, and set\n+\t\t# GIT_AUTHOR_{NAME,EMAIL}\n+\t\tauthor_str=`sed -n -e '/^From:/ { s/^From: //; p; q }' \"$p\"`\n+\t\tif [ ! -z \"$author_str\" ]; then\n+\t\t\tGIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`\n+\t\t\texport GIT_AUTHOR_NAME=\"${GIT_AUTHOR_NAME:-\" \"}\"\n+                        export GIT_AUTHOR_EMAIL=\"`echo $author_str | sed -e 's/[^<]*//'`\"\n \t\tfi\n+\t\texport GIT_AUTHOR_DATE=\"`stat -c %y \"$p\"`\"\n+\t\texport GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"\n \n-\t\texport GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL\n-\tfi\n-\tlocal backup_author_date=\"$GIT_AUTHOR_DATE\"\n-\tlocal backup_committer_date=\"$GIT_COMMITTER_DATE\"\n-\texport GIT_AUTHOR_DATE=`stat -c %y \"$p\"`\n-\texport GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE\n-\n-\t# commit\n-\tlocal treeish=`git-write-tree`\n-\tlocal commitish=`git-commit-tree $treeish -p HEAD < /tmp/guilt.msg.$$`\n-\techo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`\n+\t\t# commit\n+\t\ttreeish=`git-write-tree`\n+\t\tcommitish=`git-commit-tree $treeish -p HEAD < /tmp/guilt.msg.$$`\n+\t\techo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`\n \n-\t# mark patch as applied\n-\techo \"$commitish:$pname\" >> $applied\n-\n-\tcd - 2>&1 >/dev/null\n+\t\t# mark patch as applied\n+\t\techo \"$commitish:$pname\" >> $applied\n+\t)\n \n \t# update references to top, bottom, and base of the stack\n \tupdate_stack_tags\n \n-\t# restore original GIT_AUTHOR_{NAME,EMAIL}\n-\tif [ ! -z \"$author_str\" ]; then\n-\t\tif [ ! -z \"$backup_author_name\" ]; then\n-\t\t\texport GIT_AUTHOR_NAME=\"$backup_author_name\"\n-\t\telse\n-\t\t\tunset GIT_AUTHOR_NAME\n-\t\tfi\n-\n-\t\tif [ ! -z \"$backup_author_name\" ]; then\n-\t\t\texport GIT_AUTHOR_EMAIL=\"$backup_author_email\"\n-\t\telse\n-\t\t\tunset GIT_AUTHOR_EMAIL\n-\t\tfi\n-\tfi\n-\tif [ ! -z \"$backup_author_date\" ]; then\n-\t\texport GIT_AUTHOR_DATE=\"$backup_author_date\"\n-\telse\n-\t\tunset GIT_AUTHOR_DATE\n-\tfi\n-\t\tif [ ! -z \"$backup_committer_date\" ]; then\n-\t\texport GIT_COMMITTER_DATE=\"$backup_committer_date\"\n-\telse\n-\t\tunset GIT_COMMITTER_DATE\n-\tfi\n-\n \trm -f /tmp/guilt.msg.$$ /tmp/guilt.log.$$\n-\n-\treturn $bail\n+\treturn $__push_patch_bail\n }\n \n # usage: must_commit_first\n-- \n1.5.2.1\n"},{"id":"45067","messageId":"11818254621993-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] Easy commands, without bashisms.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:51:00Z","receivedAt":"2007-06-14T12:51:00Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  Just move to /bin/sh and use . `dirname $0`/guilt as posh fails else.\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt-applied |    4 ++--\n guilt-delete  |    4 ++--\n guilt-fold    |    4 ++--\n guilt-header  |    4 ++--\n guilt-init    |    4 ++--\n guilt-pop     |    4 ++--\n guilt-prev    |    4 ++--\n guilt-rebase  |    4 ++--\n guilt-refresh |    4 ++--\n guilt-rm      |    4 ++--\n guilt-top     |    4 ++--\n 11 files changed, 22 insertions(+), 22 deletions(-)\n\ndiff --git a/guilt-applied b/guilt-applied\nindex 373e5f7..52f8470 100755\n--- a/guilt-applied\n+++ b/guilt-applied\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[-c]\"\n-. guilt\n+. `dirname $0`/guilt\n \n case $# in\n \t0)\ndiff --git a/guilt-delete b/guilt-delete\nindex 8649875..1118b00 100755\n--- a/guilt-delete\n+++ b/guilt-delete\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[-f] <patchname>\"\n-. guilt\n+. `dirname $0`/guilt\n \n case $# in\n \t1)\ndiff --git a/guilt-fold b/guilt-fold\nindex 0d0222b..92fac1a 100755\n--- a/guilt-fold\n+++ b/guilt-fold\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"<patchname>\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -ne 1 ]; then\n \tusage\ndiff --git a/guilt-header b/guilt-header\nindex eb89cfd..d07e2be 100755\n--- a/guilt-header\n+++ b/guilt-header\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[<patchname>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -gt 1 ]; then\n \tusage\ndiff --git a/guilt-init b/guilt-init\nindex feacf95..ffe2434 100755\n--- a/guilt-init\n+++ b/guilt-init\n@@ -1,4 +1,4 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n@@ -6,7 +6,7 @@\n DO_NOT_CHECK_BRANCH_EXISTENCE=1\n \n USAGE=\"[-n]\"\n-. guilt\n+. `dirname $0`/guilt\n \n autotag=1\n \ndiff --git a/guilt-pop b/guilt-pop\nindex 2b9c2ec..89ad021 100755\n--- a/guilt-pop\n+++ b/guilt-pop\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[-f] [-a | --all | <patchname>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n while [ $# -gt 0 ]; do\n \tcase \"$1\" in\ndiff --git a/guilt-prev b/guilt-prev\nindex 5348f88..26e7a51 100755\n--- a/guilt-prev\n+++ b/guilt-prev\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -ne 0 ]; then\n \tusage\ndiff --git a/guilt-rebase b/guilt-rebase\nindex 823384d..cc8dcf6 100755\n--- a/guilt-rebase\n+++ b/guilt-rebase\n@@ -1,4 +1,4 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n@@ -6,7 +6,7 @@\n #\n \n USAGE=\"<upstream>\"\n-. guilt\n+. `dirname $0`/guilt\n \n case \"$#\" in\n \t1) \ndiff --git a/guilt-refresh b/guilt-refresh\nindex 957f23d..8541484 100755\n--- a/guilt-refresh\n+++ b/guilt-refresh\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -ne 0 ]; then\n \tusage\ndiff --git a/guilt-rm b/guilt-rm\nindex f0025b4..0ec120d 100755\n--- a/guilt-rm\n+++ b/guilt-rm\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"<file>...\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -lt 1 ]; then\n \tusage\ndiff --git a/guilt-top b/guilt-top\nindex 3d407e8..8004f10 100755\n--- a/guilt-top\n+++ b/guilt-top\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -ne 0 ]; then\n \tusage\n-- \n1.5.2.1\n"},{"id":"45064","messageId":"11818254624139-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] guilt-status(1): Remove bashisms.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:51:01Z","receivedAt":"2007-06-14T12:51:01Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt-status |   58 ++++++++++++++++++++++++++++------------------------------\n 1 files changed, 28 insertions(+), 30 deletions(-)\n\ndiff --git a/guilt-status b/guilt-status\nindex 934ea53..bc2f33e 100755\n--- a/guilt-status\n+++ b/guilt-status\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[-a|-A] [-c|-C] [-d|-D] [-m|-M] [-r|-R] [-t|-T] [-u|-U] [-x|-X] [-n]\"\n-. guilt\n+. `dirname $0`/guilt\n \n untracked=\"\"\n DIFF_FILTER=\"\"\n@@ -53,7 +53,7 @@ fi\n \n git-rev-parse --verify HEAD >/dev/null 2>&1 || IS_INITIAL=t\n \n-function print_status\n+print_status()\n {\n \tif [ -z \"$no_prefix\" ] ; then\n \t\tApfx=\"A \"\n@@ -81,34 +81,32 @@ function print_status\n \tdone\n }\n \n-cd \"$TOP_DIR\"\n-\n (\n-# untracked; FIXME: there's got to be a better way\n-if [ ! -z \"$untracked\" ]; then\n-\tif [ -f \"$GIT_DIR/info/exclude\" ]; then\n-\t\tgit-ls-files -z --others \\\n-\t\t--exclude-from=\"$GIT_DIR/info/exclude\" \\\n-\t\t--exclude-per-directory=.gitignore\n-\telse\n-\t\tgit-ls-files -z --others --exclude-per-directory=.gitignore\n-\tfi | xargs -0 -L 1 echo | while read n; do\n-\t\t[ -z \"$n\" ] && continue\n-\t\techo \"$n\" | sed -e \"s/^/?\\t/\"\n-\tdone\n-fi\n+\tcd \"$TOP_DIR\"\n+\t# untracked; FIXME: there's got to be a better way\n+\tif [ ! -z \"$untracked\" ]; then\n+\t\tif [ -f \"$GIT_DIR/info/exclude\" ]; then\n+\t\t\tgit-ls-files -z --others \\\n+\t\t\t--exclude-from=\"$GIT_DIR/info/exclude\" \\\n+\t\t\t--exclude-per-directory=.gitignore\n+\t\telse\n+\t\t\tgit-ls-files -z --others --exclude-per-directory=.gitignore\n+\t\tfi | xargs -0 -L 1 echo | while read n; do\n+\t\t\t[ -z \"$n\" ] && continue\n+\t\t\techo \"$n\" | sed -e \"s/^/?\\t/\"\n+\t\tdone\n+\tfi\n \n-# added\n-if [ -z \"$IS_INITIAL\" ]; then\n-\t# non-initial commit\n-\tgit-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD\n-else\n-\t# initial commit\n-\tgit-ls-files | sed -e \"s/^/A\\t/\"\n-fi | sed -e '\n-\ts/\\\\/\\\\\\\\/g\n-\ts/ /\\\\ /g\n-'\n+\t# added\n+\tif [ -z \"$IS_INITIAL\" ]; then\n+\t\t# non-initial commit\n+\t\tgit-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD\n+\telse\n+\t\t# initial commit\n+\t\tgit-ls-files | sed -e \"s/^/A\\t/\"\n+\tfi | sed -e '\n+\t\ts/\\\\/\\\\\\\\/g\n+\t\ts/ /\\\\ /g\n+\t'\n ) | print_status\n \n-cd - 2>&1 >/dev/null\n-- \n1.5.2.1\n"},{"id":"45068","messageId":"11818254623724-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] Remove last bashisms from remaining commands.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T12:51:02Z","receivedAt":"2007-06-14T12:51:02Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  Especially also simplify the (quite sloppy) loops to extract ranges of\nlines, use sed -n -e '<min>,<max>p' for that.\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt-add           |    7 +++----\n guilt-export        |    6 +++---\n guilt-files         |    6 +++---\n guilt-fork          |    6 +++---\n guilt-graph         |   13 +++++++------\n guilt-help          |    6 +++---\n guilt-import        |    6 +++---\n guilt-import-commit |    6 +++---\n guilt-new           |   15 ++++++++-------\n guilt-next          |    6 +++---\n guilt-patchbomb     |   10 +++++-----\n guilt-push          |   16 ++++++----------\n guilt-series        |    6 +++---\n guilt-unapplied     |   12 +++---------\n uninstall           |    7 ++-----\n 15 files changed, 58 insertions(+), 70 deletions(-)\n\ndiff --git a/guilt-add b/guilt-add\nindex fd1e716..ebf41e4 100755\n--- a/guilt-add\n+++ b/guilt-add\n@@ -1,14 +1,13 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"<file>...\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -lt 1 ]; then\n \tusage\n fi\n \n-git-add -- \"$@\"\n-\n+exec git-add -- \"$@\"\ndiff --git a/guilt-export b/guilt-export\nindex 444ccdf..2c0a9fd 100755\n--- a/guilt-export\n+++ b/guilt-export\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Pierre Habouzit, 2007\n #\n \n USAGE=\"[<target_dir>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -gt 1 ]; then\n \tusage\n@@ -19,7 +19,7 @@ trap \"rm -rf \\\"$target_dir\\\"\" 0\n mkdir -p \"$target_dir\"\n \n get_series | tee \"$target_dir/series\" | while read p; do\n-\tmkdir -p \"`dirname $target_dir/$p`\" 2> /dev/null || true\n+\tsilent mkdir -p \"`dirname $target_dir/$p`\" || true\n \tcp \"$GUILT_DIR/$branch/$p\" \"$target_dir/$p\"\n done\n \ndiff --git a/guilt-files b/guilt-files\nindex bc06f39..3428be4 100755\n--- a/guilt-files\n+++ b/guilt-files\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (C) 2007 Yasushi SHOJI <yashi@atmark-techno.com>\n #\n \n USAGE=\"[-v] [-a] [-l]\"\n-. guilt\n+. `dirname $0`/guilt\n \n opt_verbose=\n opt_all=\n@@ -26,7 +26,7 @@ do\n done\n \n IFS=:\n-if [ $opt_all ]; then\n+if [ -n \"$opt_all\" ]; then\n \tcat $applied\n else\n \ttail -1 $applied\ndiff --git a/guilt-fork b/guilt-fork\nindex 426a7e7..32b31dc 100755\n--- a/guilt-fork\n+++ b/guilt-fork\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n \n USAGE=\"[<new_name>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -gt 1 ]; then\n \tusage\n@@ -28,7 +28,7 @@ else\n \t\t| sed -r -e 's:(\\.diff?|\\.patch)$::')\n \tnum=$(echo \"$base\" | sed -nre 's:.*-([0-9]+)$:\\1:'p)\n \t[ -n \"$num\" ] || num=1\n-\tnewpatch=\"${base%-$num}-$((num+1))${patch#$base}\"\n+\tnewpatch=\"${base%-$num}-$(($num+1))${patch#$base}\"\n fi\n \n if [ -e \"$GUILT_DIR/$branch/$newpatch\" ]; then\ndiff --git a/guilt-graph b/guilt-graph\nindex 5d67040..0c6b890 100755\n--- a/guilt-graph\n+++ b/guilt-graph\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n \n USAGE=\"[<patchname>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -gt 1 ]; then\n \tusage\n@@ -24,13 +24,14 @@ else\n \tfi\n fi\n \n-function getfiles\n+getfiles()\n {\n \tgit-diff-tree -r \"$1^\" \"$1\" | tr '\\t' ' ' | cut -d' ' -f6\n }\n \n cache=\"$GUILT_DIR/$branch/.graphcache.$$\"\n mkdir \"$cache\"\n+trap \"rm -rf \\\"$cache\\\"\" 0\n \n echo \"digraph G {\"\n \n@@ -39,7 +40,7 @@ current=\"$top\"\n while [ \"$current\" != \"$base\" ]; do\n \techo \"# checking rev $current\"\n \n-\techo -n '' > \"$cache/dep\"\n+\ttouch \"$cache/dep\"\n \n \tgetfiles $current | while read f; do\n \t\t# hash the filename\n@@ -51,7 +52,7 @@ while [ \"$current\" != \"$base\" ]; do\n \t\techo \"$current\" > \"$cache/$fh\"\n \tdone\n \n-\tcat \"$cache/dep\" | sort | uniq | while read h; do\n+\tsort -u \"$cache/dep\" | while read h; do\n \t\techo \"\t\\\"${h:0:8}\\\" -> \\\"${current:0:8}\\\"; // ?\"\n \tdone\n \n@@ -60,4 +61,4 @@ done\n \n echo \"}\"\n \n-rm -rf \"$cache\"\n+trap - 0\ndiff --git a/guilt-help b/guilt-help\nindex 5f867b4..274246b 100755\n--- a/guilt-help\n+++ b/guilt-help\n@@ -1,4 +1,4 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n@@ -6,7 +6,7 @@\n DO_NOT_CHECK_BRANCH_EXISTENCE=1\n \n USAGE=\"[<command> | <topic>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n case $# in\n \t0)\n@@ -24,4 +24,4 @@ case $# in\n \t\t;;\n esac\n \n-man \"$page\"\n+exec man \"$page\"\ndiff --git a/guilt-import b/guilt-import\nindex 0e4e037..da3ece8 100755\n--- a/guilt-import\n+++ b/guilt-import\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n \n USAGE=\"[-P <patch> ] <patch_file>\"\n-. guilt\n+. `dirname $0`/guilt\n \n case \"$1\" in\n \t-P)\n@@ -17,7 +17,7 @@ case \"$1\" in\n \t\t;;\n esac\n \n-if [ $# -lt 1 -o $# -gt 3 -o -z \"$newname\" -o -z \"$oldname\" ]; then\n+if [ $# -lt 1 ] || [ $# -gt 3 ] || [ -z \"$newname\" ] || [ -z \"$oldname\" ]; then\n \tusage\n fi\n \ndiff --git a/guilt-import-commit b/guilt-import-commit\nindex 47f0dc0..6aa65e5 100755\n--- a/guilt-import-commit\n+++ b/guilt-import-commit\n@@ -1,12 +1,12 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n \n USAGE=\"[<hash> | <since>..[<until>] | ..<until>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n-if [ $# -ne 1 -o -z \"$1\" ]; then\n+if [ $# -ne 1 ] || [ -z \"$1\" ]; then\n \tdie \"You must specify a range of commits\"\n fi\n \ndiff --git a/guilt-new b/guilt-new\nindex 7a89b42..5c7eb39 100755\n--- a/guilt-new\n+++ b/guilt-new\n@@ -1,12 +1,12 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[-f] [-s] [-e|-m message] <patchname>\"\n-. guilt\n+. `dirname $0`/guilt\n \n-if [ $# -lt 1 -o $# -gt 4 ]; then\n+if [ $# -lt 1 ] || [ $# -gt 4 ]; then\n \tusage\n fi\n \n@@ -80,10 +80,11 @@ mkdir_dir=`dirname \"$GUILT_DIR/$branch/$patch\"`\n [ \"$edit\" = \"t\" ] && $editor \"$GUILT_DIR/$branch/$patch\"\n \n if [ ! -z \"$force\" ]; then\n-\tcd \"$TOP_DIR\"\n-\tgit-diff HEAD >> \"$GUILT_DIR/$branch/$patch\"\n-\tgit-reset --hard HEAD > /dev/null\n-\tcd -\n+\t(\n+\t\tcd \"$TOP_DIR\"\n+\t\tgit-diff HEAD >> \"$GUILT_DIR/$branch/$patch\"\n+\t\tgit-reset --hard HEAD > /dev/null\n+\t)\n fi\n \n # insert the patch name into the series file\ndiff --git a/guilt-next b/guilt-next\nindex b25c761..f38f1cc 100755\n--- a/guilt-next\n+++ b/guilt-next\n@@ -1,17 +1,17 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -ne 0 ]; then\n \tusage\n fi\n \n n=`wc -l < $applied`\n-n=`expr $n + 1`\n+n=$(($n + 1))\n \n get_series | awk \"{ if (NR == $n) print \\$0}\"\n \ndiff --git a/guilt-patchbomb b/guilt-patchbomb\nindex c1c3ea0..5001d47 100755\n--- a/guilt-patchbomb\n+++ b/guilt-patchbomb\n@@ -1,4 +1,4 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2007\n #\n@@ -6,7 +6,7 @@\n DO_NOT_CHECK_BRANCH_EXISTENCE=1\n \n USAGE=\"[-n] [--in-reply-to <msgid>] [<hash> | <since>..[<until>] | ..<until>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n while [ $# -gt 0 ]; do\n \tcase \"$1\" in\n@@ -34,7 +34,7 @@ git-log --pretty=oneline \"$r\" | cut -c 1-8,41- | $pager\n \n echo -n \"Are these what you want to send? [Y/n] \"\n read n\n-if [ \"$n\" = \"n\" -o \"$n\" = \"N\" ]; then\n+if [ \"$n\" = \"n\" ] || [ \"$n\" = \"N\" ]; then\n \tdie \"Aborting...\"\n fi\n \n@@ -72,7 +72,7 @@ opts=\"$opts $to_opts\"\n # last possible point to abort!\n echo -n \"Proceed with patchbomb (this is the last chance to abort)? [y/N] \"\n read n\n-if [ \"$n\" != \"y\" -a \"$n\" != \"Y\" ]; then\n+if [ \"$n\" != \"y\" ] && [ \"$n\" != \"Y\" ]; then\n \tdie \"Aborting...\"\n fi\n \n@@ -93,5 +93,5 @@ fi\n echo -n \"Delete temporary directory? [Y/n] \"\n read n\n \n-[ \"$n\" = \"n\" -o \"$n\" = \"N\" ] && exit 0\n+[ \"$n\" = \"n\" ] || [ \"$n\" = \"N\" ] && exit 0\n rm -rf $dir\ndiff --git a/guilt-push b/guilt-push\nindex c7d8355..ad3616b 100755\n--- a/guilt-push\n+++ b/guilt-push\n@@ -1,15 +1,15 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[ -f ] [-a | --all | <patchname>]\"\n-. guilt\n+. `dirname $0`/guilt\n \n abort_flag=\"abort\"\n \n \n-if [ \"$1\" == \"-f\" ]; then\n+if [ \"$1\" = \"-f\" ]; then\n \tabort_flag=\"\"\n \tshift\n fi\n@@ -20,7 +20,7 @@ fi\n \n patch=\"$1\"\n \n-if [ \"$patch\" = \"--all\" -o \"$patch\" = \"-a\" ]; then\n+if [ \"$patch\" = \"--all\" ] || [ \"$patch\" = \"-a\" ]; then\n \t# we are supposed to push all patches, get the last one out of\n \t# series\n \n@@ -52,12 +52,8 @@ fi\n sidx=`wc -l < $applied`\n sidx=`expr $sidx + 1`\n \n-idx=0\n-for p in `get_series`; do\n-\tidx=`expr $idx + 1`\n-\t[ $idx -lt $sidx ] && continue\n-\t[ $idx -gt $eidx ] && break\n-\n+get_series | sed -n -e \"${sidx},${eidx}p\" | while read p\n+do\n \techo \"Applying patch..$p\"\n \tif [ ! -f \"$GUILT_DIR/$branch/$p\" ]; then\n \t\tdie \"Patch $patch does not exist. Aborting.\"\ndiff --git a/guilt-series b/guilt-series\nindex af1c8f2..efb11c2 100755\n--- a/guilt-series\n+++ b/guilt-series\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"[-v]\"\n-. guilt\n+. `dirname $0`/guilt\n \n while case \"$#\" in 0) break ;; esac\n do\n@@ -17,7 +17,7 @@ do\n \tshift\n done\n \n-if ! [ $verbose ]; then\n+if ! [ -n \"$verbose\" ]; then\n \tget_series\n else\n \tprefix=\"+\"\ndiff --git a/guilt-unapplied b/guilt-unapplied\nindex 5bbe4d8..192a7e5 100755\n--- a/guilt-unapplied\n+++ b/guilt-unapplied\n@@ -1,10 +1,10 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) Josef \"Jeff\" Sipek, 2006, 2007\n #\n \n USAGE=\"\"\n-. guilt\n+. `dirname $0`/guilt\n \n if [ $# -ne 0 ]; then\n \tusage\n@@ -13,10 +13,4 @@ fi\n n=`wc -l < $applied`\n n=`expr $n + 1`\n \n-idx=0\n-for p in `get_series`; do\n-\tidx=`expr $idx + 1`\n-\t[ $idx -lt $n ] && continue\n-\n-\techo $p\n-done\n+get_series | sed -n -e \"$n,\\$p\"\ndiff --git a/uninstall b/uninstall\nindex 54c6d26..9c8a3b7 100755\n--- a/uninstall\n+++ b/uninstall\n@@ -1,4 +1,4 @@\n-#!/bin/bash\n+#!/bin/sh\n #\n # Copyright (c) 2007 Nur Hussein <hussein@cs.usm.my>\n #\n@@ -12,7 +12,4 @@ PRE=$1\n \n shift\n \n-for x in \"$@\"\n-do\n-\trm \"$PRE/$x\"\n-done\n+(cd $PRE; rm \"$@\")\n-- \n1.5.2.1\n"},{"id":"45070","messageId":"20070614130752.GB23324@artemis","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T13:07:52Z","receivedAt":"2007-06-14T13:07:52Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Thu, Jun 14, 2007 at 02:50:55PM +0200, Pierre Habouzit wrote:\n> This patch series makes guilt be able to work with a standard posix shell.\n> \n\n> This has been tested with bash, zsh, dash and posh acting as /bin/sh.\n\n  By tested I mean that I carefully crafted the changes, and ran make\ntest with /bin/sh pointing to those shells, and the suite passed.\n\n  Though, we could have /some/ regressions.\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"45071","messageId":"11818272231872-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] Small regresson when series file is empty.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T13:20:23Z","receivedAt":"2007-06-14T13:20:23Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex f77c050..58df606 100755\n--- a/guilt\n+++ b/guilt\n@@ -246,8 +246,9 @@ head_check()\n # usage: series_insert_patch <patchname>\n series_insert_patch()\n {\n-\tawk -v top=\"`get_top`\" -v new=\"$1\" '{\n-\t\t\tif (top == \"\" && NR == 1) print new;\n+\tawk -v top=\"`get_top`\" -v new=\"$1\" \\\n+\t\t'BEGIN{if (top == \"\") print new;}\n+\t\t{\n \t\t\tprint $0;\n \t\t\tif (top != \"\" && top == $0) print new;\n \t\t}' \"$series\" > \"$series.tmp\"\n-- \n1.5.2.1\n"},{"id":"45074","messageId":"20070614145845.GA934@filer.fsl.cs.sunysb.edu","threadId":"8599","inReplyTo":"11818254621458-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] guilt(1): simplifications...","fromName":"Josef Sipek","fromEmail":"jsipek@cs.sunysb.edu","sentAt":"2007-06-14T14:58:45Z","receivedAt":"2007-06-14T14:58:45Z","isPatch":true,"sender":{"key":"jsipek@cs.sunysb.edu","avatar":null},"body":"On Thu, Jun 14, 2007 at 02:50:58PM +0200, Pierre Habouzit wrote:\n>   + using awk to avoid local variables\n>   + more clever with sed\n>   + reimplement munge_hash_range with case\n> \n>   and some whitespace problems.\n\nFew tiny comments.\n\nThanks for the patches.\n\n... \n>  # usage: do_make_header <hash>\n>  do_make_header()\n>  {\n> -\t# which revision do we want to work with?\n> -\tlocal rev=\"$1\"\n> -\n>  \t# we should try to work with commit objects only\n> -\tif [ `git-cat-file -t \"$rev\"` != \"commit\" ]; then\n> -\t\techo \"Hash $rev is not a commit object\" >&2\n> +\tif [ `git-cat-file -t \"$1\"` != \"commit\" ]; then\n> +\t\techo \"Hash $1 is not a commit object\" >&2\n>  \t\techo \"Aborting...\" >&2\n>  \t\texit 2\n>  \tfi\n>  \n> -\t# get the author line from the commit object\n> -\tlocal author=`git-cat-file -p \"$rev\" | grep -e '^author ' | head -1`\n> -\n> -\t# strip the timestamp & '^author ' string\n> -\tauthor=`echo \"$author\" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`\n> -\n> -\tgit-cat-file -p \"$rev\" | awk \"\n> -BEGIN{ok=0}\n> -(ok==1){print \\$0; print \\\"\\nFrom: $author\\\"; ok=2; next}\n> -(ok==2){print \\$0}\n> -/^\\$/ && (ok==0){ok=1}\n> -\"\n> +\tgit-cat-file -p \"$1\" | sed -e \\\n> +\t\t'1,/^$/ {\n> +\t\t\t/^author/ {\n> +\t\t\t\ts/^author /From: /\n> +\t\t\t\ts/ [0-9]* [+-]*[0-9][0-9]*$//\n> +\t\t\t\tp\n> +\t\t\t}\n> +\t\t\t/^$/p\n> +\t\t\td\n> +\t\t}'\n\nYou changed the output slightly. The original awk script outputed:\n\n>>>>>\nthe first line of the commit message\n\nFrom: foo@....\n\nremainder of the commit message\n<<<<<\n\nYours outputs:\n\n>>>>>\nFrom: foo@....\n\nthe entire commit message\n<<<<<\n\nI'd like to keep the previous format as it makes it easier to grab the first\nline of each patch file to get the \"short summary\" (assuming you follow the\nkernel/git/guilt commit message conventions). This doesn't make anything in\nguilt easier, it just makes the patch files more friendly to other tools one\nmight use. (Especially if they grab the first line and use it as the subject\nin emails.)\n\n\n\n> @@ -260,17 +246,12 @@ head_check()\n>  # usage: series_insert_patch <patchname>\n>  series_insert_patch()\n>  {\n> -\tlocal top=`get_top | sed -e 's,/,\\\\\\\\/,g'`\n> -\tlocal new=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'` \n> -\n> -\tif [ ! -z \"$top\" ]; then\n> -\t\tsed -i -e \"s/^$top\\$/$top\\n$new/\" \"$series\"\n> -\telse\n> -\t\t# don't use $new here as it would only complicate things\n> -\t\techo \"$1\" > \"$series.tmp\"\n> -\t\tcat \"$series\" >> \"$series.tmp\"\n> -\t\tmv \"$series.tmp\" \"$series\"\n> -\tfi\n> +\tawk -v top=\"`get_top`\" -v new=\"$1\" '{\n> +\t\t\tif (top == \"\" && NR == 1) print new;\n> +\t\t\tprint $0;\n> +\t\t\tif (top != \"\" && top == $0) print new;\n> +\t\t}' \"$series\" > \"$series.tmp\"\n> +\tmv \"$series.tmp\" \"$series\"\n>  }\n>  \n>  # usage: series_remove_patch <patchname>\n> @@ -283,10 +264,11 @@ series_remove_patch()\n>  # usage: series_rename_patch <oldname> <newname>\n>  series_rename_patch()\n>  {\n> -\tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n> -\tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n> +\tawk -v old=\"$1\" -v new=\"$2\" \\\n> +\t\t'{ if ($0 == old) print new; else print $0 }' \\\n> +\t\t\"$series.tmp\" > \"$series\"\n \nShouldn't that be '\"$series\" > \"$series.tmp\"' ?\n\n> -\tsed -i -e \"s/^$old\\$/$new/\" \"$series\"\n> +\tmv \"$series.tmp\" \"$series\"\n>  }\n>  \n>  # Beware! This is one of the few (only?) places where we modify the applied\n> @@ -295,10 +277,15 @@ series_rename_patch()\n>  # usage: applied_rename_patch <oldname> <newname>\n>  applied_rename_patch()\n>  {\n> -\tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n> -\tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n> +\tawk -v old=\"$1\" -v new=\"$2\" \\\n> +\t\t\t'BEGIN{FS=\":\"}\n> +\t\t\t{ if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)\n> +\t\t\t\tprint substr($0, 0, 41) new;\n> +\t\t\telse\n> +\t\t\t\tprint;\n> +\t\t\t}' \"$applied\" > \"$applied.new\"\n                                                 ^^^^\n\n> -\tsed -i -e \"s/^\\\\([0-9a-f]\\\\{40\\\\}\\\\):$old\\$/\\\\1:$new/\" \"$applied\"\n> +\tmv \"$applied.tmp\" \"$applied\"\n                    ^^^^\n\n.new or .tmp?\n\nJosef \"Jeff\" Sipek.\n\n-- \nThe reasonable man adapts himself to the world; the unreasonable one\npersists in trying to adapt the world to himself. Therefore all progress\ndepends on the unreasonable man.\n\t\t- George Bernard Shaw\n"},{"id":"45076","messageId":"20070614151512.GB934@filer.fsl.cs.sunysb.edu","threadId":"8599","inReplyTo":"1181825462590-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] guilt(1): Obvious bashisms fixed.","fromName":"Josef Sipek","fromEmail":"jsipek@cs.sunysb.edu","sentAt":"2007-06-14T15:15:12Z","receivedAt":"2007-06-14T15:15:12Z","isPatch":true,"sender":{"key":"jsipek@cs.sunysb.edu","avatar":null},"body":"On Thu, Jun 14, 2007 at 02:50:57PM +0200, Pierre Habouzit wrote:\n>   + function foo { } -> foo() { }\n>   + add wrapper for echo -e\n>   + couple of '[' bashisms\n>   + get rid of easy local variables to remove\n>   + avoid cd - (using subshells)\n... \n\nJust a small nit-pick :)\n\n> diff --git a/guilt b/guilt\n> index 2ae76f8..80f3faf 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1\n...\n> +guilt_commands()\n>  {\n>  \tlocal command\n>  \tfor command in $0-*\n> @@ -32,7 +54,7 @@ function guilt_commands\n>  \tdone\n>  }\n>  \n> -if [ `basename $0` = \"guilt\" ]; then\n> +if [ \"`basename $0`\" = \"guilt\" ]; then\n\nYou added quotes here - that's ok....\n\n>  \t# being run as standalone\n>  \n>  \t# by default, we shouldn't fail\n> @@ -58,7 +80,7 @@ if [ `basename $0` = \"guilt\" ]; then\n\nBut did not add them here.... :)\n\nJosef \"Jeff\" Sipek.\n\n-- \nA CRAY is the only computer that runs an endless loop in just 4 hours...\n"},{"id":"45077","messageId":"20070614151658.GK23324@artemis","threadId":"8599","inReplyTo":"20070614145845.GA934@filer.fsl.cs.sunysb.edu","subject":"Re: [PATCH] guilt(1): simplifications...","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T15:16:58Z","receivedAt":"2007-06-14T15:16:58Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Thu, Jun 14, 2007 at 10:58:45AM -0400, Josef Sipek wrote:\n> On Thu, Jun 14, 2007 at 02:50:58PM +0200, Pierre Habouzit wrote:\n\n> >  # usage: do_make_header <hash>\n> >  do_make_header()\n> >  {\n> > -\t# which revision do we want to work with?\n> > -\tlocal rev=\"$1\"\n> > -\n> >  \t# we should try to work with commit objects only\n> > -\tif [ `git-cat-file -t \"$rev\"` != \"commit\" ]; then\n> > -\t\techo \"Hash $rev is not a commit object\" >&2\n> > +\tif [ `git-cat-file -t \"$1\"` != \"commit\" ]; then\n> > +\t\techo \"Hash $1 is not a commit object\" >&2\n> >  \t\techo \"Aborting...\" >&2\n> >  \t\texit 2\n> >  \tfi\n> >  \n> > -\t# get the author line from the commit object\n> > -\tlocal author=`git-cat-file -p \"$rev\" | grep -e '^author ' | head -1`\n> > -\n> > -\t# strip the timestamp & '^author ' string\n> > -\tauthor=`echo \"$author\" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`\n> > -\n> > -\tgit-cat-file -p \"$rev\" | awk \"\n> > -BEGIN{ok=0}\n> > -(ok==1){print \\$0; print \\\"\\nFrom: $author\\\"; ok=2; next}\n> > -(ok==2){print \\$0}\n> > -/^\\$/ && (ok==0){ok=1}\n> > -\"\n> > +\tgit-cat-file -p \"$1\" | sed -e \\\n> > +\t\t'1,/^$/ {\n> > +\t\t\t/^author/ {\n> > +\t\t\t\ts/^author /From: /\n> > +\t\t\t\ts/ [0-9]* [+-]*[0-9][0-9]*$//\n> > +\t\t\t\tp\n> > +\t\t\t}\n> > +\t\t\t/^$/p\n> > +\t\t\td\n> > +\t\t}'\n> \n> You changed the output slightly. The original awk script outputed:\n> \n> >>>>>\n> the first line of the commit message\n> \n> From: foo@....\n> \n> remainder of the commit message\n> <<<<<\n> \n> Yours outputs:\n> \n> >>>>>\n> From: foo@....\n> \n> the entire commit message\n> <<<<<\n> \n> I'd like to keep the previous format as it makes it easier to grab the first\n> line of each patch file to get the \"short summary\" (assuming you follow the\n> kernel/git/guilt commit message conventions). This doesn't make anything in\n> guilt easier, it just makes the patch files more friendly to other tools one\n> might use. (Especially if they grab the first line and use it as the subject\n> in emails.)\n\n  damn, I thought I had checked that thouroughly, I'll see that in\ndetails then. and will give you a new patch.\n\n> > @@ -283,10 +264,11 @@ series_remove_patch()\n> >  # usage: series_rename_patch <oldname> <newname>\n> >  series_rename_patch()\n> >  {\n> > -\tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n> > -\tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n> > +\tawk -v old=\"$1\" -v new=\"$2\" \\\n> > +\t\t'{ if ($0 == old) print new; else print $0 }' \\\n> > +\t\t\"$series.tmp\" > \"$series\"\n>  \n> Shouldn't that be '\"$series\" > \"$series.tmp\"' ?\n> \n> > -\tsed -i -e \"s/^$old\\$/$new/\" \"$series\"\n> > +\tmv \"$series.tmp\" \"$series\"\n> >  }\n> >  \n> >  # Beware! This is one of the few (only?) places where we modify the applied\n> > @@ -295,10 +277,15 @@ series_rename_patch()\n> >  # usage: applied_rename_patch <oldname> <newname>\n> >  applied_rename_patch()\n> >  {\n> > -\tlocal old=`echo \"$1\" | sed -e 's,/,\\\\\\\\/,g'`\n> > -\tlocal new=`echo \"$2\" | sed -e 's,/,\\\\\\\\/,g'` \n> > +\tawk -v old=\"$1\" -v new=\"$2\" \\\n> > +\t\t\t'BEGIN{FS=\":\"}\n> > +\t\t\t{ if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)\n> > +\t\t\t\tprint substr($0, 0, 41) new;\n> > +\t\t\telse\n> > +\t\t\t\tprint;\n> > +\t\t\t}' \"$applied\" > \"$applied.new\"\n>                                                  ^^^^\n> \n> > -\tsed -i -e \"s/^\\\\([0-9a-f]\\\\{40\\\\}\\\\):$old\\$/\\\\1:$new/\" \"$applied\"\n> > +\tmv \"$applied.tmp\" \"$applied\"\n>                     ^^^^\n> \n> ..new or .tmp?\n\n  Those are obvious blatant mistakes. THe fixes will be available in the\ncoming patch as well.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"45078","messageId":"20070614151834.GL23324@artemis","threadId":"8599","inReplyTo":"20070614151512.GB934@filer.fsl.cs.sunysb.edu","subject":"Re: [PATCH] guilt(1): Obvious bashisms fixed.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T15:18:34Z","receivedAt":"2007-06-14T15:18:34Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Thu, Jun 14, 2007 at 11:15:12AM -0400, Josef Sipek wrote:\n> On Thu, Jun 14, 2007 at 02:50:57PM +0200, Pierre Habouzit wrote:\n> >   + function foo { } -> foo() { }\n> >   + add wrapper for echo -e\n> >   + couple of '[' bashisms\n> >   + get rid of easy local variables to remove\n> >   + avoid cd - (using subshells)\n> .... \n> \n> Just a small nit-pick :)\n> \n> > diff --git a/guilt b/guilt\n> > index 2ae76f8..80f3faf 100755\n> > --- a/guilt\n> > +++ b/guilt\n> > @@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1\n> ....\n> > +guilt_commands()\n> >  {\n> >  \tlocal command\n> >  \tfor command in $0-*\n> > @@ -32,7 +54,7 @@ function guilt_commands\n> >  \tdone\n> >  }\n> >  \n> > -if [ `basename $0` = \"guilt\" ]; then\n> > +if [ \"`basename $0`\" = \"guilt\" ]; then\n> \n> You added quotes here - that's ok....\n> \n> >  \t# being run as standalone\n> >  \n> >  \t# by default, we shouldn't fail\n> > @@ -58,7 +80,7 @@ if [ `basename $0` = \"guilt\" ]; then\n> \n> But did not add them here.... :)\n\n  heh, I tried my best, I've no automated tool for that, only my eyes\nand thise code will break iff `basename $0` has spaces in it, which is\nrather crazy anyways. But you're welcome to add the missing ones *sigh*\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"45079","messageId":"20070614152702.GC934@filer.fsl.cs.sunysb.edu","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Josef Sipek","fromEmail":"jsipek@cs.sunysb.edu","sentAt":"2007-06-14T15:27:02Z","receivedAt":"2007-06-14T15:27:02Z","isPatch":true,"sender":{"key":"jsipek@cs.sunysb.edu","avatar":null},"body":"On Thu, Jun 14, 2007 at 02:50:55PM +0200, Pierre Habouzit wrote:\n> This patch series makes guilt be able to work with a standard posix shell.\n> \n> This has been tested with bash, zsh, dash and posh acting as /bin/sh.\n> \n> This uses awk and sed a bit more than before, but POSIX awk and sed should be\n> enough. Though GNU find and GNU /bin/echo from the coreutils needs to be\n> there.\n> \n> Here is the shortlog:\n> \n> \tPierre Habouzit (7):\n> \t\t  Regression test suite needs bash, that's OK.\n> \t\t  guilt(1): Obvious bashisms fixed.\n> \t\t  guilt(1): simplifications...\n> \t\t  guilt(1): reimplement push_patch, using a subshell to avoid locals.\n> \t\t  Easy commands, without bashisms.\n> \t\t  guilt-status(1): Remove bashisms.\n> \t\t  Remove last bashisms from remaining commands.\n \nI went though the patches, and it's mostly good (see individual patch\nreplies for details). I noticed an indentation issue or two, but I can fix\nthat up easily, I can take care of the quoting of `basename $0`.\n\nThe regression suite is little lacking, so I am going to put your updated\npatches onto a special branch, and test it for a while - fixing up any\npotential bugs. (I don't want to be even remotely responsible for people's\npatches turning into empty files :) )\n\nThanks a lot!\n\nJosef \"Jeff\" Sipek.\n\n-- \nA CRAY is the only computer that runs an endless loop in just 4 hours...\n"},{"id":"45082","messageId":"11818362542177-git-send-email-madcoder@debian.org","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"[PATCH] More regressions fixes.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T15:50:54Z","receivedAt":"2007-06-14T15:50:54Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  + use awk again to parse git-cat-file properly\n  + fixes .new -> .tmp (always use the same suffix to avoid problems)\n  + write in foo.tmp and move it, and not the reverse :)\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n guilt |   28 +++++++++++++++++-----------\n 1 files changed, 17 insertions(+), 11 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex 58df606..7c78cc7 100755\n--- a/guilt\n+++ b/guilt\n@@ -177,16 +177,22 @@ do_make_header()\n \t\texit 2\n \tfi\n \n-\tgit-cat-file -p \"$1\" | sed -e \\\n-\t\t'1,/^$/ {\n-\t\t\t/^author/ {\n-\t\t\t\ts/^author /From: /\n-\t\t\t\ts/ [0-9]* [+-]*[0-9][0-9]*$//\n-\t\t\t\tp\n+\tgit-cat-file -p \"$1\" | awk '\n+\t\tBEGIN{headers=1; firstline=1}\n+\t\t/^author / && headers {\n+\t\t\tsub(/^author +/, \"\");\n+\t\t\tsub(/ [0-9]* [+-]*[0-9][0-9]*$/, \"\");\n+\t\t\tauthor=$0\n+\t\t}\n+\t\t!headers {\n+\t\t\tprint\n+\t\t\tif (firstline) {\n+\t\t\t\tfirstline = 0;\n+\t\t\t\tprint \"\\nFrom: \" author;\n \t\t\t}\n-\t\t\t/^$/p\n-\t\t\td\n-\t\t}'\n+\t\t}\n+\t\t/^$/ && headers { headers = 0 }\n+\t'\n }\n \n # usage: do_get_header patchfile\n@@ -267,7 +273,7 @@ series_rename_patch()\n {\n \tawk -v old=\"$1\" -v new=\"$2\" \\\n \t\t'{ if ($0 == old) print new; else print $0 }' \\\n-\t\t\"$series.tmp\" > \"$series\"\n+\t\t\"$series\" > \"$series.tmp\"\n \n \tmv \"$series.tmp\" \"$series\"\n }\n@@ -284,7 +290,7 @@ applied_rename_patch()\n \t\t\t\tprint substr($0, 0, 41) new;\n \t\t\telse\n \t\t\t\tprint;\n-\t\t\t}' \"$applied\" > \"$applied.new\"\n+\t\t\t}' \"$applied\" > \"$applied.tmp\"\n \n \tmv \"$applied.tmp\" \"$applied\"\n }\n-- \n1.5.2.1\n"},{"id":"45083","messageId":"20070614155600.GM23324@artemis","threadId":"8599","inReplyTo":"20070614152702.GC934@filer.fsl.cs.sunysb.edu","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T15:56:00Z","receivedAt":"2007-06-14T15:56:00Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Thu, Jun 14, 2007 at 11:27:02AM -0400, Josef Sipek wrote:\n> On Thu, Jun 14, 2007 at 02:50:55PM +0200, Pierre Habouzit wrote:\n> > This patch series makes guilt be able to work with a standard posix shell.\n> > \n> > This has been tested with bash, zsh, dash and posh acting as /bin/sh.\n> > \n> > This uses awk and sed a bit more than before, but POSIX awk and sed should be\n> > enough. Though GNU find and GNU /bin/echo from the coreutils needs to be\n> > there.\n> > \n> > Here is the shortlog:\n> > \n> > \tPierre Habouzit (7):\n> > \t\t  Regression test suite needs bash, that's OK.\n> > \t\t  guilt(1): Obvious bashisms fixed.\n> > \t\t  guilt(1): simplifications...\n> > \t\t  guilt(1): reimplement push_patch, using a subshell to avoid locals.\n> > \t\t  Easy commands, without bashisms.\n> > \t\t  guilt-status(1): Remove bashisms.\n> > \t\t  Remove last bashisms from remaining commands.\n>  \n> I went though the patches, and it's mostly good (see individual patch\n> replies for details). I noticed an indentation issue or two, but I can fix\n> that up easily, I can take care of the quoting of `basename $0`.\n\n  Thanks.\n\n> The regression suite is little lacking, so I am going to put your updated\n> patches onto a special branch, and test it for a while - fixing up any\n> potential bugs. (I don't want to be even remotely responsible for people's\n> patches turning into empty files :) )\n\n  That seems like a very good plan. I just sent the fixes. Hopefully\nthis should fix major issues right now.\n\n  Interestingly enough, benchmarking for runs with different shells as\n/bin/sh show:\n\n  dash: 1.63s user 3.93s system 102% cpu 5.436 total\n  posh: 2.02s user 4.29s system 100% cpu 6.260 total\n  bash: 2.82s user 5.78s system 104% cpu 8.223 total\n  zsh:  3.70s user 5.86s system  99% cpu 9.626 total\n\n  (this is obviously completely not unreliable, but gives some rough\nideas though)\n\n> Thanks a lot!\n\n  Well, worry for the obvious mistakes.\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"45084","messageId":"20070614155826.GN23324@artemis","threadId":"8599","inReplyTo":"20070614155600.GM23324@artemis","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T15:58:26Z","receivedAt":"2007-06-14T15:58:26Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Thu, Jun 14, 2007 at 05:56:00PM +0200, Pierre Habouzit wrote:\n> On Thu, Jun 14, 2007 at 11:27:02AM -0400, Josef Sipek wrote:\n> > Thanks a lot!\n> \n>   Well, worry for the obvious mistakes.\n         *sorry\n\n  Now, *that* was an interesting typo :P\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"45085","messageId":"20070614163940.GA4752@filer.fsl.cs.sunysb.edu","threadId":"8599","inReplyTo":"20070614155826.GN23324@artemis","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Josef Sipek","fromEmail":"jsipek@cs.sunysb.edu","sentAt":"2007-06-14T16:39:40Z","receivedAt":"2007-06-14T16:39:40Z","isPatch":true,"sender":{"key":"jsipek@cs.sunysb.edu","avatar":null},"body":"On Thu, Jun 14, 2007 at 05:58:26PM +0200, Pierre Habouzit wrote:\n> On Thu, Jun 14, 2007 at 05:56:00PM +0200, Pierre Habouzit wrote:\n> > On Thu, Jun 14, 2007 at 11:27:02AM -0400, Josef Sipek wrote:\n> > > Thanks a lot!\n> > \n> >   Well, worry for the obvious mistakes.\n>          *sorry\n> \n>   Now, *that* was an interesting typo :P\n\n:)\n\nOk, pushed to kernel.org. I folded the 2 regression fixing patches into the\nright places.\n\nThanks a lot!\n\nJosef \"Jeff\" Sipek.\n\n-- \nLinux, n.:\n  Generous programmers from around the world all join forces to help\n  you shoot yourself in the foot for free. \n"},{"id":"45087","messageId":"20070614171611.GW23324@artemis","threadId":"8599","inReplyTo":"20070614163940.GA4752@filer.fsl.cs.sunysb.edu","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-06-14T17:16:11Z","receivedAt":"2007-06-14T17:16:11Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Thu, Jun 14, 2007 at 12:39:40PM -0400, Josef Sipek wrote:\n> On Thu, Jun 14, 2007 at 05:58:26PM +0200, Pierre Habouzit wrote:\n> > On Thu, Jun 14, 2007 at 05:56:00PM +0200, Pierre Habouzit wrote:\n> > > On Thu, Jun 14, 2007 at 11:27:02AM -0400, Josef Sipek wrote:\n> > > > Thanks a lot!\n> > > \n> > >   Well, worry for the obvious mistakes.\n> >          *sorry\n> > \n> >   Now, *that* was an interesting typo :P\n> \n> :)\n> \n> Ok, pushed to kernel.org. I folded the 2 regression fixing patches into the\n> right places.\n\n  Just a small remark: 87739d0e should be merged in the master branch,\nas the regression suite does not work atm if you are using a shell that\ndoes not understands enough bashisms.\n\n  The patch is safe (it only adds /bin/bash shebangs to tests, and\nchanges the way tests are called in the Makefile).\n\n  For the rest, I agree the patches should continue to live in a\nseparate branch until better coverage of the testsuite can give us more\nfaith in those patches :)\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"45125","messageId":"20070615090104.B20266@mrwint.cisco.com","threadId":"8599","inReplyTo":"11818254621527-git-send-email-madcoder@debian.org","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Derek Fawcus","fromEmail":"dfawcus@cisco.com","sentAt":"2007-06-15T08:01:04Z","receivedAt":"2007-06-15T08:01:04Z","isPatch":true,"sender":{"key":"dfawcus@cisco.com","avatar":null},"body":"On Thu, Jun 14, 2007 at 02:50:55PM +0200, Pierre Habouzit wrote:\n> This patch series makes guilt be able to work with a standard posix shell.\n> \n> This has been tested with bash, zsh, dash and posh acting as /bin/sh.\n\nWell if you want to try with a 'real' bourne shell,  there is always the\nheirloom sh or the v7 shell...\n\nhttp://heirloom.sourceforge.net/sh.html\nhttp://www.collyer.net/who/geoff/v7sh.tar \nhttp://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/\n\nDF\n"},{"id":"45152","messageId":"1621f9fa0706151531w7878b7b0kf35d615563f4cd07@mail.gmail.com","threadId":"8599","inReplyTo":"20070615090104.B20266@mrwint.cisco.com","subject":"Re: [PATCH guilt] make guilt use standard POSIX shell","fromName":"Benjamin Sergeant","fromEmail":"bsergean@gmail.com","sentAt":"2007-06-15T22:31:12Z","receivedAt":"2007-06-15T22:31:12Z","isPatch":true,"sender":{"key":"bsergean@gmail.com","avatar":null},"body":"On 6/15/07, Derek Fawcus <dfawcus@cisco.com> wrote:\n> On Thu, Jun 14, 2007 at 02:50:55PM +0200, Pierre Habouzit wrote:\n> > This patch series makes guilt be able to work with a standard posix shell.\n> >\n> > This has been tested with bash, zsh, dash and posh acting as /bin/sh.\n>\n> Well if you want to try with a 'real' bourne shell,  there is always the\n> heirloom sh or the v7 shell...\n>\n> http://heirloom.sourceforge.net/sh.html\n\n>From the main page\n'''\ninteractive use. The Bourne shell provides job control if it is\ninvoked as jsh and runs on a terminal. Of course, it lacks fancy\nfeatures such as a command history, command line completion, etc. But\nworking with these features tends to distract the user's attention.\nAfter a familiarization phase, use of the Bourne shell can lead to a\nmore even-tempered, concentrated working style. Give it a try.\nSeriously.\n'''\n\nI love it. I acknowledge that you have to be fairly well concentrated\nif you want to type\n/usr/lib/python2.5/site-packages/spambayes/resources/ (as an example)\nwithout missing one char.\n\n:)\nBenjamin.\n\n\n> http://www.collyer.net/who/geoff/v7sh.tar\n> http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/\n>\n> DF\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"}]}