Skip to contentSkip to conversation

make guilt use standard POSIX shell

PATCH In review Pierre Habouzit 4 participants 22 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make guilt use standard POSIX shell

This patch series makes guilt be able to work with a standard posix shell.

This has been tested with bash, zsh, dash and posh acting as /bin/sh.

This uses awk and sed a bit more than before, but POSIX awk and sed should be enough. Though GNU find and GNU /bin/echo from the coreutils needs to be there.

Here is the shortlog:

Pierre Habouzit (7):
Regression test suite needs bash, that's OK. guilt(1): Obvious bashisms fixed.
guilt(1): simplifications...
guilt(1): reimplement push_patch, using a subshell to avoid locals. Easy commands, without bashisms.
guilt-status(1): Remove bashisms.
Remove last bashisms from remaining commands.

and the diffstat:

	 guilt                       |  448 +++++++++++++++++++------------------------
	 guilt-add                   |    7 +-
	 guilt-applied               |    4 +-
	 guilt-delete                |    4 +-
	 guilt-export                |    6 +-
	 guilt-files                 |    6 +-
	 guilt-fold                  |    4 +-
	 guilt-fork                  |    6 +-
	 guilt-graph                 |   13 +-
	 guilt-header                |    4 +-
	 guilt-help                  |    6 +-
	 guilt-import                |    6 +-
	 guilt-import-commit         |    6 +-
	 guilt-init                  |    4 +-
	 guilt-new                   |   15 +-
	 guilt-next                  |    6 +-
	 guilt-patchbomb             |   10 +-
	 guilt-pop                   |    4 +-
	 guilt-prev                  |    4 +-
	 guilt-push                  |   16 +-
	 guilt-rebase                |    4 +-
	 guilt-refresh               |    4 +-
	 guilt-rm                    |    4 +-
	 guilt-series                |    6 +-
	 guilt-status                |   58 +++---
	 guilt-top                   |    4 +-
	 guilt-unapplied             |   12 +-
	 regression/010-init.sh      |    1 +
	 regression/011-no-repo.sh   |    1 +
	 regression/020-push.sh      |    1 +
	 regression/021-pop.sh       |    1 +
	 regression/022-applied.sh   |    1 +
	 regression/023-top.sh       |    1 +
	 regression/024-unapplied.sh |    1 +
	 regression/025-new.sh       |    1 +
	 regression/026-delete.sh    |    1 +
	 regression/027-refresh.sh   |    1 +
	 regression/050-series.sh    |    1 +
	 regression/060-files.sh     |    1 +
	 regression/Makefile         |    2 +-
	 uninstall                   |    7 +-
	 41 files changed, 317 insertions(+), 375 deletions(-)
#1 lore raw

PATCH 1/1 guilt(1): simplifications...

+ using awk to avoid local variables
+ more clever with sed
+ reimplement munge_hash_range with case

and some whitespace problems.

---
 guilt |  132 ++++++++++++++++++++++++++++-------------------------------------
 1 files changed, 57 insertions(+), 75 deletions(-)
guilt +57 -75
index 80f3faf..44273f3 100755
@@ -44,14 +44,7 @@ silent()
 
 guilt_commands()
 {
-	local command
-	for command in $0-*
-	do
-		if [ -f "$command" -a -x "$command" ]
-		then
-			echo ${command##$0-}
-		fi
-	done
+	find "`dirname $0`" -maxdepth 1 -name "guilt-*" -type f -perm /111 | sed -e "s/.*\\/`basename $0`-//"
 }
 
 if [ "`basename $0`" = "guilt" ]; then
@@ -97,9 +90,7 @@ if [ "`basename $0`" = "guilt" ]; then
 	echo "Guilt v$GUILT_VERSION"
 	echo ""
 	echo "Pick a command:"
-	for x in `dirname $0`/guilt-*; do
-		[ -x $x ] && echo -e ${x##$0-}
-	done | sort | column | column -t | sed -e $'s/^/\t/'
+	guilt_commands | sort | column | column -t | sed -e 's/^/\t/'
 
 	echo ""
 	echo "Example:"
@@ -173,34 +164,29 @@ get_series()
 	#	- whitespace only
 	#	- optional whitespace followed by '#' followed by more
 	#	  optional whitespace
-	grep -ve '^[[:space:]]*\(#.*\)*$' < "$series"
+	grep -ve '^[[:space:]]*\(#.*\)*$' "$series"
 }
 
 # usage: do_make_header <hash>
 do_make_header()
 {
-	# which revision do we want to work with?
-	local rev="$1"
-
 	# we should try to work with commit objects only
-	if [ `git-cat-file -t "$rev"` != "commit" ]; then
-		echo "Hash $rev is not a commit object" >&2
+	if [ `git-cat-file -t "$1"` != "commit" ]; then
+		echo "Hash $1 is not a commit object" >&2
 		echo "Aborting..." >&2
 		exit 2
 	fi
 
-	# get the author line from the commit object
-	local author=`git-cat-file -p "$rev" | grep -e '^author ' | head -1`
-
-	# strip the timestamp & '^author ' string
-	author=`echo "$author" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`
-
-	git-cat-file -p "$rev" | awk "
-BEGIN{ok=0}
-(ok==1){print \$0; print \"\nFrom: $author\"; ok=2; next}
-(ok==2){print \$0}
-/^\$/ && (ok==0){ok=1}
-"
+	git-cat-file -p "$1" | sed -e \
+		'1,/^$/ {
+			/^author/ {
+				s/^author /From: /
+				s/ [0-9]* [+-]*[0-9][0-9]*$//
+				p
+			}
+			/^$/p
+			d
+		}'
 }
 
 # usage: do_get_header patchfile
@@ -260,17 +246,12 @@ head_check()
 # usage: series_insert_patch <patchname>
 series_insert_patch()
 {
-	local top=`get_top | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$1" | sed -e 's,/,\\\\/,g'` 
-
-	if [ ! -z "$top" ]; then
-		sed -i -e "s/^$top\$/$top\n$new/" "$series"
-	else
-		# don't use $new here as it would only complicate things
-		echo "$1" > "$series.tmp"
-		cat "$series" >> "$series.tmp"
-		mv "$series.tmp" "$series"
-	fi
+	awk -v top="`get_top`" -v new="$1" '{
+			if (top == "" && NR == 1) print new;
+			print $0;
+			if (top != "" && top == $0) print new;
+		}' "$series" > "$series.tmp"
+	mv "$series.tmp" "$series"
 }
 
 # usage: series_remove_patch <patchname>
@@ -283,10 +264,11 @@ series_remove_patch()
 # usage: series_rename_patch <oldname> <newname>
 series_rename_patch()
 {
-	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
+	awk -v old="$1" -v new="$2" \
+		'{ if ($0 == old) print new; else print $0 }' \
+		"$series.tmp" > "$series"
 
-	sed -i -e "s/^$old\$/$new/" "$series"
+	mv "$series.tmp" "$series"
 }
 
 # Beware! This is one of the few (only?) places where we modify the applied
@@ -295,10 +277,15 @@ series_rename_patch()
 # usage: applied_rename_patch <oldname> <newname>
 applied_rename_patch()
 {
-	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
+	awk -v old="$1" -v new="$2" \
+			'BEGIN{FS=":"}
+			{ if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)
+				print substr($0, 0, 41) new;
+			else
+				print;
+			}' "$applied" > "$applied.new"
 
-	sed -i -e "s/^\\([0-9a-f]\\{40\\}\\):$old\$/\\1:$new/" "$applied"
+	mv "$applied.tmp" "$applied"
 }
 
 # usage: pop_many_patches <commitish> <number of patches>
@@ -307,11 +294,11 @@ pop_many_patches()
 	assert_head_check
 
 	(
-	cd "$TOP_DIR"
+		cd "$TOP_DIR"
 
-	git-reset --hard "$1" > /dev/null
-	head -n "-$2" < "$applied" > "$applied.tmp"
-	mv "$applied.tmp" "$applied"
+		git-reset --hard "$1" > /dev/null
+		head -n "-$2" < "$applied" > "$applied.tmp"
+		mv "$applied.tmp" "$applied"
 	)
 
 	# update references to top, bottom, and base
@@ -490,7 +477,7 @@ __refresh_patch()
 
 	(
 		cd "$TOP_DIR"
-			p="$GUILT_DIR/$branch/$1"
+		p="$GUILT_DIR/$branch/$1"
 
 		git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
 
@@ -524,30 +511,25 @@ __refresh_patch()
 # The output of this function is suitable to be passed to git-rev-list
 munge_hash_range()
 {
-	[ -z "$1" ] && return 1
-
-	local l=`echo "$1" | sed -e 's/\.\./ /'`
-
-	local h1=`echo "$l" | cut -s -d' ' -f 1`
-	local h2=`echo "$l" | cut -s -d' ' -f 2`
-
-	if [ -z "$h1" -a -z "$h2" ]; then
-		# e.g., "v0.19"
-		echo "$l^..$l"
-	elif [ -z "$h1" ]; then
-		# e.g., "..v0.10"
-		echo "$h2"
-	elif [ -z "$h2" ]; then
-		# e.g., "v0.19.."
-		echo "$h1..HEAD"
-	elif [ ! -z "$h1" -a ! -z "$h2" ]; then
-		# e.g., "v0.19-rc1..v0.19"
-		echo "$h1..$h2"
-	else
-		# unknown hash range format
-		return 1
-	fi
-
+	case "$1" in
+		*..*..*|*\ *)
+			# double .. or space is illegal
+			return 1;;
+		..*)
+			# e.g., "..v0.10"
+			echo ${1#..};;
+		*..)
+			# e.g., "v0.19.."
+			echo ${1%..}..HEAD;;
+		*..*)
+			# e.g., "v0.19-rc1..v0.19"
+			echo ${1%%..*}..${1#*..};;
+		?*)
+			# e.g., "v0.19"
+			echo $1^..$1;;
+		*)  # empty
+			return 1;;
+	esac
 	return 0
 }
 
Signature · 1 line
1.5.2.1
#2 lore raw

Re: [PATCH] guilt(1): simplifications...

Quoted 5 lines · Pierre Habouzit

+ using awk to avoid local variables
+ more clever with sed
+ reimplement munge_hash_range with case

and some whitespace problems.

Few tiny comments.

Thanks for the patches.

...

Quoted 27 lines

# usage: do_make_header <hash>
do_make_header()
{

guilt +2 -17
-	# which revision do we want to work with?
-	local rev="$1"
-
 	# we should try to work with commit objects only
-	if [ `git-cat-file -t "$rev"` != "commit" ]; then
-		echo "Hash $rev is not a commit object" >&2
+	if [ `git-cat-file -t "$1"` != "commit" ]; then
+		echo "Hash $1 is not a commit object" >&2
 		echo "Aborting..." >&2
 		exit 2
 	fi
 
-	# get the author line from the commit object
-	local author=`git-cat-file -p "$rev" | grep -e '^author ' | head -1`
-
-	# strip the timestamp & '^author ' string
-	author=`echo "$author" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`
-
-	git-cat-file -p "$rev" | awk "
-BEGIN{ok=0}
-(ok==1){print \$0; print \"\nFrom: $author\"; ok=2; next}
-(ok==2){print \$0}
-/^\$/ && (ok==0){ok=1}
-"

guilt get_series() · line 189

Quoted 10 lines
guilt +10 -0
+	git-cat-file -p "$1" | sed -e \
+		'1,/^$/ {
+			/^author/ {
+				s/^author /From: /
+				s/ [0-9]* [+-]*[0-9][0-9]*$//
+				p
+			}
+			/^$/p
+			d
+		}'

You changed the output slightly. The original awk script outputed:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the first line of the commit message

From: foo@....

remainder of the commit message
<<<<<

Yours outputs:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: foo@....

the entire commit message
<<<<<

I'd like to keep the previous format as it makes it easier to grab the first line of each patch file to get the "short summary" (assuming you follow the kernel/git/guilt commit message conventions). This doesn't make anything in guilt easier, it just makes the patch files more friendly to other tools one might use. (Especially if they grab the first line and use it as the subject in emails.)

Quoted 25 lines
guilt +6 -11
@@ -260,17 +246,12 @@ head_check()
 # usage: series_insert_patch <patchname>
 series_insert_patch()
 {
-	local top=`get_top | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$1" | sed -e 's,/,\\\\/,g'` 
-
-	if [ ! -z "$top" ]; then
-		sed -i -e "s/^$top\$/$top\n$new/" "$series"
-	else
-		# don't use $new here as it would only complicate things
-		echo "$1" > "$series.tmp"
-		cat "$series" >> "$series.tmp"
-		mv "$series.tmp" "$series"
-	fi
+	awk -v top="`get_top`" -v new="$1" '{
+			if (top == "" && NR == 1) print new;
+			print $0;
+			if (top != "" && top == $0) print new;
+		}' "$series" > "$series.tmp"
+	mv "$series.tmp" "$series"
 }
 
 # usage: series_remove_patch <patchname>

guilt series_remove_patch() · line 269

Quoted 8 lines
guilt +3 -2
@@ -283,10 +264,11 @@ series_remove_patch()
 # usage: series_rename_patch <oldname> <newname>
 series_rename_patch()
 {
-	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
+	awk -v old="$1" -v new="$2" \
+		'{ if ($0 == old) print new; else print $0 }' \
+		"$series.tmp" > "$series"

Shouldn't that be '"$series" > "$series.tmp"' ?

Quoted 8 lines
guilt +1 -1
-	sed -i -e "s/^$old\$/$new/" "$series"
+	mv "$series.tmp" "$series"
 }
 
 # Beware! This is one of the few (only?) places where we modify the applied
@@ -295,10 +277,15 @@ series_rename_patch()
 # usage: applied_rename_patch <oldname> <newname>
 applied_rename_patch()

guilt series_rename_patch() · line 286

Quoted 10 lines
guilt +7 -2
 {
-	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
+	awk -v old="$1" -v new="$2" \
+			'BEGIN{FS=":"}
+			{ if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)
+				print substr($0, 0, 41) new;
+			else
+				print;
+			}' "$applied" > "$applied.new"
                                                 ^^^^

guilt series_rename_patch() · line 288

Quoted 2 lines
guilt +1 -1
-	sed -i -e "s/^\\([0-9a-f]\\{40\\}\\):$old\$/\\1:$new/" "$applied"
+	mv "$applied.tmp" "$applied"
                    ^^^^

.new or .tmp?

Josef "Jeff" Sipek.

Signature · 4 lines
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
		- George Bernard Shaw
#3 lore raw

Re: [PATCH] guilt(1): simplifications...

Quoted 58 lines · Josef Sipek
Quoted 27 lines · Pierre Habouzit

# usage: do_make_header <hash>
do_make_header()
{

guilt +2 -17
-	# which revision do we want to work with?
-	local rev="$1"
-
 	# we should try to work with commit objects only
-	if [ `git-cat-file -t "$rev"` != "commit" ]; then
-		echo "Hash $rev is not a commit object" >&2
+	if [ `git-cat-file -t "$1"` != "commit" ]; then
+		echo "Hash $1 is not a commit object" >&2
 		echo "Aborting..." >&2
 		exit 2
 	fi
 
-	# get the author line from the commit object
-	local author=`git-cat-file -p "$rev" | grep -e '^author ' | head -1`
-
-	# strip the timestamp & '^author ' string
-	author=`echo "$author" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`
-
-	git-cat-file -p "$rev" | awk "
-BEGIN{ok=0}
-(ok==1){print \$0; print \"\nFrom: $author\"; ok=2; next}
-(ok==2){print \$0}
-/^\$/ && (ok==0){ok=1}
-"

guilt get_series() · line 189

Quoted 10 lines
guilt +10 -0
+	git-cat-file -p "$1" | sed -e \
+		'1,/^$/ {
+			/^author/ {
+				s/^author /From: /
+				s/ [0-9]* [+-]*[0-9][0-9]*$//
+				p
+			}
+			/^$/p
+			d
+		}'

You changed the output slightly. The original awk script outputed:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the first line of the commit message

From: foo@....

remainder of the commit message
<<<<<

Yours outputs:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

From: foo@....

the entire commit message
<<<<<

Quoted 6 lines

I'd like to keep the previous format as it makes it easier to grab the first line of each patch file to get the "short summary" (assuming you follow the kernel/git/guilt commit message conventions). This doesn't make anything in guilt easier, it just makes the patch files more friendly to other tools one might use. (Especially if they grab the first line and use it as the subject in emails.)

damn, I thought I had checked that thouroughly, I'll see that in
details then. and will give you a new patch.

Quoted 32 lines

guilt series_remove_patch() · line 269

Quoted 9 lines
guilt +3 -2
@@ -283,10 +264,11 @@ series_remove_patch()
 # usage: series_rename_patch <oldname> <newname>
 series_rename_patch()
 {
-	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
+	awk -v old="$1" -v new="$2" \
+		'{ if ($0 == old) print new; else print $0 }' \
+		"$series.tmp" > "$series"

Shouldn't that be '"$series" > "$series.tmp"' ?

Quoted 8 lines
guilt +1 -1
-	sed -i -e "s/^$old\$/$new/" "$series"
+	mv "$series.tmp" "$series"
 }
 
 # Beware! This is one of the few (only?) places where we modify the applied
@@ -295,10 +277,15 @@ series_rename_patch()
 # usage: applied_rename_patch <oldname> <newname>
 applied_rename_patch()

guilt series_rename_patch() · line 286

Quoted 10 lines
guilt +7 -2
 {
-	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
-	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
+	awk -v old="$1" -v new="$2" \
+			'BEGIN{FS=":"}
+			{ if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)
+				print substr($0, 0, 41) new;
+			else
+				print;
+			}' "$applied" > "$applied.new"
                                                 ^^^^
Quoted 5 lines

guilt series_rename_patch() · line 288

Quoted 2 lines
guilt +1 -1
-	sed -i -e "s/^\\([0-9a-f]\\{40\\}\\):$old\$/\\1:$new/" "$applied"
+	mv "$applied.tmp" "$applied"
                    ^^^^

..new or .tmp?

Those are obvious blatant mistakes. THe fixes will be available in the
coming patch as well.

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#4 lore raw

PATCH 1/1 Easy commands, without bashisms.

In reply to Pierre Habouzit

Just move to /bin/sh and use . dirname $0/guilt as posh fails else.

---
 guilt-applied |    4 ++--
 guilt-delete  |    4 ++--
 guilt-fold    |    4 ++--
 guilt-header  |    4 ++--
 guilt-init    |    4 ++--
 guilt-pop     |    4 ++--
 guilt-prev    |    4 ++--
 guilt-rebase  |    4 ++--
 guilt-refresh |    4 ++--
 guilt-rm      |    4 ++--
 guilt-top     |    4 ++--
 11 files changed, 22 insertions(+), 22 deletions(-)
guilt-applied +2 -2
index 373e5f7..52f8470 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[-c]"
-. guilt
+. `dirname $0`/guilt
 
 case $# in
 	0)
guilt-delete +2 -2
index 8649875..1118b00 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[-f] <patchname>"
-. guilt
+. `dirname $0`/guilt
 
 case $# in
 	1)
guilt-fold +2 -2
index 0d0222b..92fac1a 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="<patchname>"
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -ne 1 ]; then
 	usage
guilt-header +2 -2
index eb89cfd..d07e2be 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[<patchname>]"
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -gt 1 ]; then
 	usage
guilt-init +2 -2
index feacf95..ffe2434 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
@@ -6,7 +6,7 @@
 DO_NOT_CHECK_BRANCH_EXISTENCE=1
 
 USAGE="[-n]"
-. guilt
+. `dirname $0`/guilt
 
 autotag=1
 
guilt-pop +2 -2
index 2b9c2ec..89ad021 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[-f] [-a | --all | <patchname>]"
-. guilt
+. `dirname $0`/guilt
 
 while [ $# -gt 0 ]; do
 	case "$1" in
guilt-prev +2 -2
index 5348f88..26e7a51 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE=""
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -ne 0 ]; then
 	usage
guilt-rebase +2 -2
index 823384d..cc8dcf6 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
@@ -6,7 +6,7 @@
 #
 
 USAGE="<upstream>"
-. guilt
+. `dirname $0`/guilt
 
 case "$#" in
 	1) 
guilt-refresh +2 -2
index 957f23d..8541484 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE=""
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -ne 0 ]; then
 	usage
guilt-rm +2 -2
index f0025b4..0ec120d 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="<file>..."
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -lt 1 ]; then
 	usage
guilt-top +2 -2
index 3d407e8..8004f10 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE=""
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -ne 0 ]; then
 	usage
Signature · 1 line
1.5.2.1
#5 lore raw

PATCH 1/1 Regression test suite needs bash, that's OK.

In reply to Pierre Habouzit
---
 regression/010-init.sh      |    1 +
 regression/011-no-repo.sh   |    1 +
 regression/020-push.sh      |    1 +
 regression/021-pop.sh       |    1 +
 regression/022-applied.sh   |    1 +
 regression/023-top.sh       |    1 +
 regression/024-unapplied.sh |    1 +
 regression/025-new.sh       |    1 +
 regression/026-delete.sh    |    1 +
 regression/027-refresh.sh   |    1 +
 regression/050-series.sh    |    1 +
 regression/060-files.sh     |    1 +
 regression/Makefile         |    2 +-
 13 files changed, 13 insertions(+), 1 deletions(-)
regression/010-init.sh +1 -0
index 17c1c16..1553d0c 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the init code
 #
regression/011-no-repo.sh +1 -0
index b37a548..fd4f6a5 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test that all commands that should fail do indeed fail if the branch was
 # not guilt-init'ed
regression/020-push.sh +1 -0
index 0d49a7e..6242529 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the push code
 #
regression/021-pop.sh +1 -0
index 418a054..e1af856 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the pop code
 #
regression/022-applied.sh +1 -0
index 78d00d9..f259bf4 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the applied code
 #
regression/023-top.sh +1 -0
index d490f14..c486448 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the top code
 #
regression/024-unapplied.sh +1 -0
index 368b3cc..ecb0298 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the unapplied code
 #
regression/025-new.sh +1 -0
index f17f20e..680f6da 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the new code
 #
regression/026-delete.sh +1 -0
index 7c16b38..07c969a 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the delete code
 #
regression/027-refresh.sh +1 -0
index 4a3270e..704d0b5 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the refresh code
 #
regression/050-series.sh +1 -0
index 437cd2f..eb23540 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the series parsing code
 #
regression/060-files.sh +1 -0
index 875f991..915c73a 100755
@@ -1,3 +1,4 @@
+#!/bin/bash
 #
 # Test the series parsing code
 #
regression/Makefile +1 -1
index c538029..3dd9d0e 100644
@@ -1,3 +1,3 @@
 .PHONY: all
 all:
-	(for x in *.sh ; do sh $$x || exit $?; done)
+	set -e; $(foreach x,$(wildcard *.sh),./$x;)
Signature · 1 line
1.5.2.1
#6 lore raw

PATCH 1/1 guilt(1): reimplement push_patch, using a subshell to avoid locals.

In reply to Pierre Habouzit

this is a bit ugly, but makes the code really shorter, and more readable
anyway. We still need the old bail variable, named __push_patch_bail to avoid spurious collisions (we are not recursing into ourselves, so it's safe).

---
 guilt |  133 ++++++++++++++++++++++++-----------------------------------------
 1 files changed, 49 insertions(+), 84 deletions(-)
guilt +49 -84
index 44273f3..f77c050 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
@@ -341,106 +341,71 @@ update_stack_tags()
 # usage: push_patch patchname [bail_action]
 push_patch()
 {
-	local p="$GUILT_DIR/$branch/$1"
-	local pname="$1"
-	local bail_action="$2"
+	__push_patch_bail=0
 
-	local bail=0
-	local reject="--reject"
-
-	assert_head_check
-
-	cd "$TOP_DIR"
+	(
+		p="$GUILT_DIR/$branch/$1"
+		pname="$1"
+		bail_action="$2"
+		reject="--reject"
 
-	# apply the patch if and only if there is something to apply
-	if [ `git-apply --numstat "$p" | wc -l` -gt 0 ]; then
-		if [ "$bail_action" = abort ]; then
-		    reject=""
-		fi
-		git-apply -C$guilt_push_diff_context \
-			$reject "$p" > /dev/null 2> /tmp/guilt.log.$$
-		bail=$?
+		assert_head_check
+		cd "$TOP_DIR"
 
-		if [ $bail -ne 0 ]; then
-			cat /tmp/guilt.log.$$ >&2
+		# apply the patch if and only if there is something to apply
+		if [ `git-apply --numstat "$p" | wc -l` -gt 0 ]; then
 			if [ "$bail_action" = abort ]; then
-				return $bail
+				reject=""
+			fi
+			git-apply -C$guilt_push_diff_context \
+				$reject "$p" > /dev/null 2> /tmp/guilt.log.$$
+			__push_patch_bail=$?
+
+			if [ $__push_patch_bail -ne 0 ]; then
+				cat /tmp/guilt.log.$$ >&2
+				if [ "$bail_action" = "abort" ]; then
+					rm -f /tmp/guilt.log.$$ /tmp/guilt.msg.$$
+					return $__push_patch_bail
+				fi
 			fi
-		fi
-
-		# FIXME: Path munging is being done, we need to convince
-		# git-apply to just give us list of files with \0 as a
-		# delimiter, and pass -z to git-update-index
-		git-apply --numstat "$p" | cut -f 3- | git-update-index --add --remove --stdin
-	fi
 
-	# grab a commit message out of the patch
-	do_get_header "$p" > /tmp/guilt.msg.$$
+			# FIXME: Path munging is being done, we need to convince
+			# git-apply to just give us list of files with \0 as a
+			# delimiter, and pass -z to git-update-index
+			git-apply --numstat "$p" | cut -f 3- | git-update-index --add --remove --stdin
+		fi
 
-	# make a default commit message if patch doesn't contain one
-	[ ! -s /tmp/guilt.msg.$$ ] && echo "patch $pname" > /tmp/guilt.msg.$$
+		# grab a commit message out of the patch
+		do_get_header "$p" > /tmp/guilt.msg.$$
 
-	# extract a From line from the patch header, and set
-	# GIT_AUTHOR_{NAME,EMAIL}
-	local author_str=`cat "$p" | grep -e '^From: ' | sed -e 's/^From: //'`
-	if [ ! -z "$author_str" ]; then
-		local backup_author_name="$GIT_AUTHOR_NAME"
-		local backup_author_email="$GIT_AUTHOR_EMAIL"
-		GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
-		GIT_AUTHOR_EMAIL=`echo $author_str | sed -e 's/[^<]*//'`
+		# make a default commit message if patch doesn't contain one
+		[ ! -s /tmp/guilt.msg.$$ ] && echo "patch $pname" > /tmp/guilt.msg.$$
 
-		if [ -z "$GIT_AUTHOR_NAME" ]; then
-			GIT_AUTHOR_NAME=" "
+		# extract a From line from the patch header, and set
+		# GIT_AUTHOR_{NAME,EMAIL}
+		author_str=`sed -n -e '/^From:/ { s/^From: //; p; q }' "$p"`
+		if [ ! -z "$author_str" ]; then
+			GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
+			export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
+                        export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
 		fi
+		export GIT_AUTHOR_DATE="`stat -c %y "$p"`"
+		export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
 
-		export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
-	fi
-	local backup_author_date="$GIT_AUTHOR_DATE"
-	local backup_committer_date="$GIT_COMMITTER_DATE"
-	export GIT_AUTHOR_DATE=`stat -c %y "$p"`
-	export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
-
-	# commit
-	local treeish=`git-write-tree`
-	local commitish=`git-commit-tree $treeish -p HEAD < /tmp/guilt.msg.$$`
-	echo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`
+		# commit
+		treeish=`git-write-tree`
+		commitish=`git-commit-tree $treeish -p HEAD < /tmp/guilt.msg.$$`
+		echo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`
 
-	# mark patch as applied
-	echo "$commitish:$pname" >> $applied
-
-	cd - 2>&1 >/dev/null
+		# mark patch as applied
+		echo "$commitish:$pname" >> $applied
+	)
 
 	# update references to top, bottom, and base of the stack
 	update_stack_tags
 
-	# restore original GIT_AUTHOR_{NAME,EMAIL}
-	if [ ! -z "$author_str" ]; then
-		if [ ! -z "$backup_author_name" ]; then
-			export GIT_AUTHOR_NAME="$backup_author_name"
-		else
-			unset GIT_AUTHOR_NAME
-		fi
-
-		if [ ! -z "$backup_author_name" ]; then
-			export GIT_AUTHOR_EMAIL="$backup_author_email"
-		else
-			unset GIT_AUTHOR_EMAIL
-		fi
-	fi
-	if [ ! -z "$backup_author_date" ]; then
-		export GIT_AUTHOR_DATE="$backup_author_date"
-	else
-		unset GIT_AUTHOR_DATE
-	fi
-		if [ ! -z "$backup_committer_date" ]; then
-		export GIT_COMMITTER_DATE="$backup_committer_date"
-	else
-		unset GIT_COMMITTER_DATE
-	fi
-
 	rm -f /tmp/guilt.msg.$$ /tmp/guilt.log.$$
-
-	return $bail
+	return $__push_patch_bail
 }
 
 # usage: must_commit_first
Signature · 1 line
1.5.2.1
#7 lore raw

PATCH 1/1 Remove last bashisms from remaining commands.

In reply to Pierre Habouzit

Especially also simplify the (quite sloppy) loops to extract ranges of
lines, use sed -n -e '<min>,<max>p' for that.

---
 guilt-add           |    7 +++----
 guilt-export        |    6 +++---
 guilt-files         |    6 +++---
 guilt-fork          |    6 +++---
 guilt-graph         |   13 +++++++------
 guilt-help          |    6 +++---
 guilt-import        |    6 +++---
 guilt-import-commit |    6 +++---
 guilt-new           |   15 ++++++++-------
 guilt-next          |    6 +++---
 guilt-patchbomb     |   10 +++++-----
 guilt-push          |   16 ++++++----------
 guilt-series        |    6 +++---
 guilt-unapplied     |   12 +++---------
 uninstall           |    7 ++-----
 15 files changed, 58 insertions(+), 70 deletions(-)
guilt-add +3 -4
index fd1e716..ebf41e4 100755
@@ -1,14 +1,13 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="<file>..."
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -lt 1 ]; then
 	usage
 fi
 
-git-add -- "$@"
-
+exec git-add -- "$@"
guilt-export +3 -3
index 444ccdf..2c0a9fd 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Pierre Habouzit, 2007
 #
 
 USAGE="[<target_dir>]"
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -gt 1 ]; then
 	usage
@@ -19,7 +19,7 @@ trap "rm -rf \"$target_dir\"" 0
 mkdir -p "$target_dir"
 
 get_series | tee "$target_dir/series" | while read p; do
-	mkdir -p "`dirname $target_dir/$p`" 2> /dev/null || true
+	silent mkdir -p "`dirname $target_dir/$p`" || true
 	cp "$GUILT_DIR/$branch/$p" "$target_dir/$p"
 done
 
guilt-files +3 -3
index bc06f39..3428be4 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (C) 2007 Yasushi SHOJI <[email protected]>
 #
 
 USAGE="[-v] [-a] [-l]"
-. guilt
+. `dirname $0`/guilt
 
 opt_verbose=
 opt_all=
@@ -26,7 +26,7 @@ do
 done
 
 IFS=:
-if [ $opt_all ]; then
+if [ -n "$opt_all" ]; then
 	cat $applied
 else
 	tail -1 $applied
guilt-fork +3 -3
index 426a7e7..32b31dc 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
 
 USAGE="[<new_name>]"
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -gt 1 ]; then
 	usage
@@ -28,7 +28,7 @@ else
 		| sed -r -e 's:(\.diff?|\.patch)$::')
 	num=$(echo "$base" | sed -nre 's:.*-([0-9]+)$:\1:'p)
 	[ -n "$num" ] || num=1
-	newpatch="${base%-$num}-$((num+1))${patch#$base}"
+	newpatch="${base%-$num}-$(($num+1))${patch#$base}"
 fi
 
 if [ -e "$GUILT_DIR/$branch/$newpatch" ]; then
guilt-graph +7 -6
index 5d67040..0c6b890 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
 
 USAGE="[<patchname>]"
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -gt 1 ]; then
 	usage
@@ -24,13 +24,14 @@ else
 	fi
 fi
 
-function getfiles
+getfiles()
 {
 	git-diff-tree -r "$1^" "$1" | tr '\t' ' ' | cut -d' ' -f6
 }
 
 cache="$GUILT_DIR/$branch/.graphcache.$$"
 mkdir "$cache"
+trap "rm -rf \"$cache\"" 0
 
 echo "digraph G {"
 
@@ -39,7 +40,7 @@ current="$top"
 while [ "$current" != "$base" ]; do
 	echo "# checking rev $current"
 
-	echo -n '' > "$cache/dep"
+	touch "$cache/dep"
 
 	getfiles $current | while read f; do
 		# hash the filename
@@ -51,7 +52,7 @@ while [ "$current" != "$base" ]; do
 		echo "$current" > "$cache/$fh"
 	done
 
-	cat "$cache/dep" | sort | uniq | while read h; do
+	sort -u "$cache/dep" | while read h; do
 		echo "	\"${h:0:8}\" -> \"${current:0:8}\"; // ?"
 	done
 
@@ -60,4 +61,4 @@ done
 
 echo "}"
 
-rm -rf "$cache"
+trap - 0
guilt-help +3 -3
index 5f867b4..274246b 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
@@ -6,7 +6,7 @@
 DO_NOT_CHECK_BRANCH_EXISTENCE=1
 
 USAGE="[<command> | <topic>]"
-. guilt
+. `dirname $0`/guilt
 
 case $# in
 	0)
@@ -24,4 +24,4 @@ case $# in
 		;;
 esac
 
-man "$page"
+exec man "$page"
guilt-import +3 -3
index 0e4e037..da3ece8 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
 
 USAGE="[-P <patch> ] <patch_file>"
-. guilt
+. `dirname $0`/guilt
 
 case "$1" in
 	-P)
@@ -17,7 +17,7 @@ case "$1" in
 		;;
 esac
 
-if [ $# -lt 1 -o $# -gt 3 -o -z "$newname" -o -z "$oldname" ]; then
+if [ $# -lt 1 ] || [ $# -gt 3 ] || [ -z "$newname" ] || [ -z "$oldname" ]; then
 	usage
 fi
 
guilt-import-commit +3 -3
index 47f0dc0..6aa65e5 100755
@@ -1,12 +1,12 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
 
 USAGE="[<hash> | <since>..[<until>] | ..<until>]"
-. guilt
+. `dirname $0`/guilt
 
-if [ $# -ne 1 -o -z "$1" ]; then
+if [ $# -ne 1 ] || [ -z "$1" ]; then
 	die "You must specify a range of commits"
 fi
 
guilt-new +8 -7
index 7a89b42..5c7eb39 100755
@@ -1,12 +1,12 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[-f] [-s] [-e|-m message] <patchname>"
-. guilt
+. `dirname $0`/guilt
 
-if [ $# -lt 1 -o $# -gt 4 ]; then
+if [ $# -lt 1 ] || [ $# -gt 4 ]; then
 	usage
 fi
 
@@ -80,10 +80,11 @@ mkdir_dir=`dirname "$GUILT_DIR/$branch/$patch"`
 [ "$edit" = "t" ] && $editor "$GUILT_DIR/$branch/$patch"
 
 if [ ! -z "$force" ]; then
-	cd "$TOP_DIR"
-	git-diff HEAD >> "$GUILT_DIR/$branch/$patch"
-	git-reset --hard HEAD > /dev/null
-	cd -
+	(
+		cd "$TOP_DIR"
+		git-diff HEAD >> "$GUILT_DIR/$branch/$patch"
+		git-reset --hard HEAD > /dev/null
+	)
 fi
 
 # insert the patch name into the series file
guilt-next +3 -3
index b25c761..f38f1cc 100755
@@ -1,17 +1,17 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE=""
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -ne 0 ]; then
 	usage
 fi
 
 n=`wc -l < $applied`
-n=`expr $n + 1`
+n=$(($n + 1))
 
 get_series | awk "{ if (NR == $n) print \$0}"
 
guilt-patchbomb +5 -5
index c1c3ea0..5001d47 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2007
 #
@@ -6,7 +6,7 @@
 DO_NOT_CHECK_BRANCH_EXISTENCE=1
 
 USAGE="[-n] [--in-reply-to <msgid>] [<hash> | <since>..[<until>] | ..<until>]"
-. guilt
+. `dirname $0`/guilt
 
 while [ $# -gt 0 ]; do
 	case "$1" in
@@ -34,7 +34,7 @@ git-log --pretty=oneline "$r" | cut -c 1-8,41- | $pager
 
 echo -n "Are these what you want to send? [Y/n] "
 read n
-if [ "$n" = "n" -o "$n" = "N" ]; then
+if [ "$n" = "n" ] || [ "$n" = "N" ]; then
 	die "Aborting..."
 fi
 
@@ -72,7 +72,7 @@ opts="$opts $to_opts"
 # last possible point to abort!
 echo -n "Proceed with patchbomb (this is the last chance to abort)? [y/N] "
 read n
-if [ "$n" != "y" -a "$n" != "Y" ]; then
+if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
 	die "Aborting..."
 fi
 
@@ -93,5 +93,5 @@ fi
 echo -n "Delete temporary directory? [Y/n] "
 read n
 
-[ "$n" = "n" -o "$n" = "N" ] && exit 0
+[ "$n" = "n" ] || [ "$n" = "N" ] && exit 0
 rm -rf $dir
guilt-push +6 -10
index c7d8355..ad3616b 100755
@@ -1,15 +1,15 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[ -f ] [-a | --all | <patchname>]"
-. guilt
+. `dirname $0`/guilt
 
 abort_flag="abort"
 
 
-if [ "$1" == "-f" ]; then
+if [ "$1" = "-f" ]; then
 	abort_flag=""
 	shift
 fi
@@ -20,7 +20,7 @@ fi
 
 patch="$1"
 
-if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
+if [ "$patch" = "--all" ] || [ "$patch" = "-a" ]; then
 	# we are supposed to push all patches, get the last one out of
 	# series
 
@@ -52,12 +52,8 @@ fi
 sidx=`wc -l < $applied`
 sidx=`expr $sidx + 1`
 
-idx=0
-for p in `get_series`; do
-	idx=`expr $idx + 1`
-	[ $idx -lt $sidx ] && continue
-	[ $idx -gt $eidx ] && break
-
+get_series | sed -n -e "${sidx},${eidx}p" | while read p
+do
 	echo "Applying patch..$p"
 	if [ ! -f "$GUILT_DIR/$branch/$p" ]; then
 		die "Patch $patch does not exist. Aborting."
guilt-series +3 -3
index af1c8f2..efb11c2 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[-v]"
-. guilt
+. `dirname $0`/guilt
 
 while case "$#" in 0) break ;; esac
 do
@@ -17,7 +17,7 @@ do
 	shift
 done
 
-if ! [ $verbose ]; then
+if ! [ -n "$verbose" ]; then
 	get_series
 else
 	prefix="+"
guilt-unapplied +3 -9
index 5bbe4d8..192a7e5 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE=""
-. guilt
+. `dirname $0`/guilt
 
 if [ $# -ne 0 ]; then
 	usage
@@ -13,10 +13,4 @@ fi
 n=`wc -l < $applied`
 n=`expr $n + 1`
 
-idx=0
-for p in `get_series`; do
-	idx=`expr $idx + 1`
-	[ $idx -lt $n ] && continue
-
-	echo $p
-done
+get_series | sed -n -e "$n,\$p"
uninstall +2 -5
index 54c6d26..9c8a3b7 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) 2007 Nur Hussein <[email protected]>
 #
@@ -12,7 +12,4 @@ PRE=$1
 
 shift
 
-for x in "$@"
-do
-	rm "$PRE/$x"
-done
+(cd $PRE; rm "$@")
Signature · 1 line
1.5.2.1
#8 lore raw

PATCH 1/1 guilt-status(1): Remove bashisms.

In reply to Pierre Habouzit
---
 guilt-status |   58 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 28 insertions(+), 30 deletions(-)
guilt-status +28 -30
index 934ea53..bc2f33e 100755
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
 #
 
 USAGE="[-a|-A] [-c|-C] [-d|-D] [-m|-M] [-r|-R] [-t|-T] [-u|-U] [-x|-X] [-n]"
-. guilt
+. `dirname $0`/guilt
 
 untracked=""
 DIFF_FILTER=""
@@ -53,7 +53,7 @@ fi
 
 git-rev-parse --verify HEAD >/dev/null 2>&1 || IS_INITIAL=t
 
-function print_status
+print_status()
 {
 	if [ -z "$no_prefix" ] ; then
 		Apfx="A "
@@ -81,34 +81,32 @@ function print_status
 	done
 }
 
-cd "$TOP_DIR"
-
 (
-# untracked; FIXME: there's got to be a better way
-if [ ! -z "$untracked" ]; then
-	if [ -f "$GIT_DIR/info/exclude" ]; then
-		git-ls-files -z --others \
-		--exclude-from="$GIT_DIR/info/exclude" \
-		--exclude-per-directory=.gitignore
-	else
-		git-ls-files -z --others --exclude-per-directory=.gitignore
-	fi | xargs -0 -L 1 echo | while read n; do
-		[ -z "$n" ] && continue
-		echo "$n" | sed -e "s/^/?\t/"
-	done
-fi
+	cd "$TOP_DIR"
+	# untracked; FIXME: there's got to be a better way
+	if [ ! -z "$untracked" ]; then
+		if [ -f "$GIT_DIR/info/exclude" ]; then
+			git-ls-files -z --others \
+			--exclude-from="$GIT_DIR/info/exclude" \
+			--exclude-per-directory=.gitignore
+		else
+			git-ls-files -z --others --exclude-per-directory=.gitignore
+		fi | xargs -0 -L 1 echo | while read n; do
+			[ -z "$n" ] && continue
+			echo "$n" | sed -e "s/^/?\t/"
+		done
+	fi
 
-# added
-if [ -z "$IS_INITIAL" ]; then
-	# non-initial commit
-	git-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD
-else
-	# initial commit
-	git-ls-files | sed -e "s/^/A\t/"
-fi | sed -e '
-	s/\\/\\\\/g
-	s/ /\\ /g
-'
+	# added
+	if [ -z "$IS_INITIAL" ]; then
+		# non-initial commit
+		git-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD
+	else
+		# initial commit
+		git-ls-files | sed -e "s/^/A\t/"
+	fi | sed -e '
+		s/\\/\\\\/g
+		s/ /\\ /g
+	'
 ) | print_status
 
-cd - 2>&1 >/dev/null
Signature · 1 line
1.5.2.1
#9 lore raw

PATCH 1/1 guilt(1): Obvious bashisms fixed.

In reply to Pierre Habouzit

+ function foo { } -> foo() { }
+ add wrapper for echo -e
+ couple of '[' bashisms
+ get rid of easy local variables to remove
+ avoid cd - (using subshells)

---
 guilt |  185 ++++++++++++++++++++++++++++++++---------------------------------
 1 files changed, 91 insertions(+), 94 deletions(-)
guilt +91 -94
index 2ae76f8..80f3faf 100755
@@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1
 
 . git-sh-setup
 
-function guilt_commands
+#
+# Shell library
+#
+
+# echo -e is a bashism, fallback to /bin/echo if the builtin does not supports it
+echo()
+{
+	/bin/echo "$@"
+}
+
+noerr()
+{
+    "$@" 2>/dev/null
+}
+
+silent()
+{
+    "$@" >/dev/null 2>/dev/null
+}
+
+########
+
+guilt_commands()
 {
 	local command
 	for command in $0-*
@@ -32,7 +54,7 @@ function guilt_commands
 	done
 }
 
-if [ `basename $0` = "guilt" ]; then
+if [ "`basename $0`" = "guilt" ]; then
 	# being run as standalone
 
 	# by default, we shouldn't fail
@@ -58,7 +80,7 @@ if [ `basename $0` = "guilt" ]; then
 				esac
 			done
 		fi
-		if [ $cmd ]; then
+		if [ -n "$cmd" ]; then
 			shift
 			exec "$dir/guilt-$cmd" "$@"
 
@@ -96,68 +118,55 @@ fi
 #
 
 # usage: valid_patchname <patchname>
-function valid_patchname
+valid_patchname()
 {
-	[ `echo "$1" | grep -e '^/' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '^\./' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '^\.\./' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '/\./' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '/\.\./' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '/\.$' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '/\.\.$' | wc -l` -gt 0 ] && return 1
-	[ `echo "$1" | grep -e '/$' | wc -l` -gt 0 ] && return 1
-	return 0
+	case "$1" in
+		/*|./*|../*|*/./*|*/../*|*/.|*/..|*/)
+			return 1;;
+		*)
+			return 0;;
+	esac
 }
 
-function get_branch
+get_branch()
 {
 	git-symbolic-ref HEAD | sed -e 's,^refs/heads/,,'
 }
 
-function verify_branch
+verify_branch()
 {
-	local b=$branch
-
 	[ ! -d "$GIT_DIR/patches" ] &&
 		echo "Patches directory doesn't exist, try guilt-init" >&2 &&
 		return 1
-	[ ! -d "$GIT_DIR/patches/$b" ] &&
-		echo "Branch $b is not initialized, try guilt-init" >&2 &&
+	[ ! -d "$GIT_DIR/patches/$branch" ] &&
+		echo "Branch $branch is not initialized, try guilt-init" >&2 &&
 		return 1
-	[ ! -f "$GIT_DIR/patches/$b/series" ] &&
-		echo "Branch $b does not have a series file" >&2 &&
+	[ ! -f "$GIT_DIR/patches/$branch/series" ] &&
+		echo "Branch $branch does not have a series file" >&2 &&
 		return 1
-	[ ! -f "$GIT_DIR/patches/$b/status" ] &&
-		echo "Branch $b does not have a status file" >&2 &&
+	[ ! -f "$GIT_DIR/patches/$branch/status" ] &&
+		echo "Branch $branch does not have a status file" >&2 &&
 		return 1
-	[ -f "$GIT_DIR/patches/$b/applied" ] &&
-		echo "Warning: Branch $b has 'applied' file - guilt is not compatible with stgit" >&2 &&
+	[ -f "$GIT_DIR/patches/$branch/applied" ] &&
+		echo "Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit" >&2 &&
 		return 1
 
 	return 0
 }
 
-function get_top
+get_top()
 {
 	tail -1 "$GUILT_DIR/$branch/status" | cut -d: -f 2-
 }
 
-function get_prev
+get_prev()
 {
-	local n=`wc -l < "$GUILT_DIR/$branch/status"`
-	local n=`expr $n - 1`
-
-	local idx=0
-	cat "$GUILT_DIR/$branch/status" | while read p; do
-		idx=`expr $idx + 1`
-		[ $idx -lt $n ] && continue
-		[ $idx -gt $n ] && break
-
-		echo "$p"
-	done
+	if [ `wc -l < "$GUILT_DIR/$branch/status"` -gt 1 ]; then
+		tail -n 2 "$GUILT_DIR/$branch/status" | head -n 1
+	fi
 }
 
-function get_series
+get_series()
 {
 	# ignore all lines matching:
 	#	- empty lines
@@ -168,7 +177,7 @@ function get_series
 }
 
 # usage: do_make_header <hash>
-function do_make_header
+do_make_header()
 {
 	# which revision do we want to work with?
 	local rev="$1"
@@ -195,7 +204,7 @@ BEGIN{ok=0}
 }
 
 # usage: do_get_header patchfile
-function do_get_header
+do_get_header()
 {
 	# The complexity arises from the fact that we want to ignore the
 	# From line and the empty line after it if it exists
@@ -212,7 +221,7 @@ END{}
 }
 
 # usage: do_get_full_header patchfile
-function do_get_full_header
+do_get_full_header()
 {
 	# 2nd line checks for the begining of a patch
 	# 3rd line outputs the line if it didn't get pruned by the above rules
@@ -225,37 +234,31 @@ END{}
 }
 
 # usage: assert_head_check
-function assert_head_check
+assert_head_check()
 {
-	local eh=`tail -1 < "$applied" | cut -d: -f 1`
-
-	if ! head_check "$eh"; then
+	if ! head_check "`tail -1 < "$applied" | cut -d: -f 1`"; then
 		die "aborting..."
 	fi
-
-	return 0
 }
 
 # usage: head_check <expected hash>
-function head_check
+head_check()
 {
 	# make sure we're not doing funky things to commits that don't
 	# belong to us
-	local ch=`cat "$GIT_DIR/refs/heads/$branch"`
-
 	# if the expected hash is empty, just return
 	[ -z "$1" ] && return 0
 
-	if [ "$ch" != "$1" ]; then
+	if [ "`cat "$GIT_DIR/refs/heads/$branch"`" != "$1" ]; then
 		echo "Expected HEAD commit $1" >&2
-		echo "                 got $ch" >&2
+		echo "                 got `cat "$GIT_DIR/refs/heads/$branch"`" >&2
 		return 1
 	fi
 	return 0
 }
 
 # usage: series_insert_patch <patchname>
-function series_insert_patch
+series_insert_patch()
 {
 	local top=`get_top | sed -e 's,/,\\\\/,g'`
 	local new=`echo "$1" | sed -e 's,/,\\\\/,g'` 
@@ -271,14 +274,14 @@ function series_insert_patch
 }
 
 # usage: series_remove_patch <patchname>
-function series_remove_patch
+series_remove_patch()
 {
 	grep -v "^$1\$" < "$series" > "$series.tmp"
 	mv "$series.tmp" "$series"
 }
 
 # usage: series_rename_patch <oldname> <newname>
-function series_rename_patch
+series_rename_patch()
 {
 	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
 	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
@@ -290,7 +293,7 @@ function series_rename_patch
 # file directly
 #
 # usage: applied_rename_patch <oldname> <newname>
-function applied_rename_patch
+applied_rename_patch()
 {
 	local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
 	local new=`echo "$2" | sed -e 's,/,\\\\/,g'` 
@@ -299,33 +302,32 @@ function applied_rename_patch
 }
 
 # usage: pop_many_patches <commitish> <number of patches>
-function pop_many_patches
+pop_many_patches()
 {
 	assert_head_check
 
+	(
 	cd "$TOP_DIR"
 
 	git-reset --hard "$1" > /dev/null
 	head -n "-$2" < "$applied" > "$applied.tmp"
 	mv "$applied.tmp" "$applied"
-
-	cd - 2>&1 >/dev/null
+	)
 
 	# update references to top, bottom, and base
 	update_stack_tags
 }
 
 # usage: pop_all_patches
-function pop_all_patches
+pop_all_patches()
 {
-	local x=`head -1 "$applied" | cut -d: -f1`
-	local n=`wc -l < "$applied"`
-
-	pop_many_patches $x^ $n
+	pop_many_patches \
+		`head -1 "$applied" | cut -d: -f1`^ \
+		`wc -l < "$applied"`
 }
 
 # usage: update_stack_tags
-function update_stack_tags
+update_stack_tags()
 {
 	# bail if autotagging is not enabled
 	if [ $autotag -eq 0 ]; then
@@ -336,13 +338,9 @@ function update_stack_tags
 		# there are patches applied, therefore we must get the top,
 		# bottom and base hashes, and update the tags
 
-		local top_hash=`git-rev-parse HEAD`
-		local bottom_hash=`head -1 < $applied | cut -d: -f1`
-		local base_hash=`git-rev-parse $bottom_hash^`
-
-		echo $top_hash > "$GIT_DIR/refs/tags/${branch}_top"
-		echo $bottom_hash > "$GIT_DIR/refs/tags/${branch}_bottom"
-		echo $base_hash > "$GIT_DIR/refs/tags/${branch}_base"
+                git-rev-parse HEAD > "$GIT_DIR/refs/tags/${branch}_top"
+                head -1 < $applied | cut -d: -f1 > "$GIT_DIR/refs/tags/${branch}_bottom"
+		git-rev-parse $(head -1 < $applied | cut -d: -f1)^ > "$GIT_DIR/refs/tags/${branch}_base"
 	else
 		# there are no patches applied, therefore we must remove the
 		# tags to old top, bottom, and base
@@ -354,7 +352,7 @@ function update_stack_tags
 }
 
 # usage: push_patch patchname [bail_action]
-function push_patch
+push_patch()
 {
 	local p="$GUILT_DIR/$branch/$1"
 	local pname="$1"
@@ -459,54 +457,53 @@ function push_patch
 }
 
 # usage: must_commit_first
-function must_commit_first
+must_commit_first()
 {
 	[ `git-diff-files | wc -l` -eq 0 ]
 	return $?
 }
 
 # usage: fold_patch patchname
-function fold_patch
+fold_patch()
 {
-	local top_patch=`get_top`
+	set -- "$1" "`get_top`"
 
 	assert_head_check
 
 	push_patch "$1"
 
-	__refresh_patch "$top_patch" HEAD^^ 2
+	__refresh_patch "$2" HEAD^^ 2
 
 	series_remove_patch "$1"
 }
 
 # usage: refresh_patch patchname
-function refresh_patch
+refresh_patch()
 {
 	__refresh_patch "$1" HEAD^ 1
 }
 
 # usage: __refresh_patch patchname commitish number_of_commits
-function __refresh_patch
+__refresh_patch()
 {
-	local p="$GUILT_DIR/$branch/$1"
-
 	assert_head_check
 
-	cd "$TOP_DIR"
-
-	git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
+	(
+		cd "$TOP_DIR"
+			p="$GUILT_DIR/$branch/$1"
 
-	# get the patch header
-	do_get_full_header "$p" > /tmp/guilt.diff.$$
+		git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
 
-	# get the new patch
-	git-diff "$2" >> /tmp/guilt.diff.$$
+		# get the patch header
+		do_get_full_header "$p" > /tmp/guilt.diff.$$
 
-	# move the new patch in
-	mv "$p" "$p~"
-	mv /tmp/guilt.diff.$$ $p
+		# get the new patch
+		git-diff "$2" >> /tmp/guilt.diff.$$
 
-	cd - 2>&1 >/dev/null
+		# move the new patch in
+		mv "$p" "$p~"
+		mv /tmp/guilt.diff.$$ $p
+	)
 
 	# drop the currently applied patch, pop_many_patches does it's own
 	# cd $TOP_DIR
@@ -525,7 +522,7 @@ function __refresh_patch
 #	<hash1>..<hash2>	- from hash to hash (inclusive)
 #
 # The output of this function is suitable to be passed to git-rev-list
-function munge_hash_range
+munge_hash_range()
 {
 	[ -z "$1" ] && return 1
 
Signature · 1 line
1.5.2.1
#10 lore raw

Re: [PATCH] guilt(1): Obvious bashisms fixed.

Quoted 5 lines · Pierre Habouzit

+ function foo { } -> foo() { }
+ add wrapper for echo -e
+ couple of '[' bashisms
+ get rid of easy local variables to remove
+ avoid cd - (using subshells)

...

Just a small nit-pick :)

Quoted 5 lines
guilt +0 -0
index 2ae76f8..80f3faf 100755
@@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1

...

guilt function guilt_commands · line 57

Quoted 10 lines
guilt +2 -1
+guilt_commands()
 {
 	local command
 	for command in $0-*
@@ -32,7 +54,7 @@ function guilt_commands
 	done
 }
 
-if [ `basename $0` = "guilt" ]; then
+if [ "`basename $0`" = "guilt" ]; then

You added quotes here - that's ok....

guilt if [ `basename $0` = "guilt" ]; then

Quoted 4 lines
guilt +0 -0
 	# being run as standalone
 
 	# by default, we shouldn't fail
@@ -58,7 +80,7 @@ if [ `basename $0` = "guilt" ]; then

But did not add them here.... :)

Josef "Jeff" Sipek.

Signature · 1 line
A CRAY is the only computer that runs an endless loop in just 4 hours...
#11 lore raw

Re: [PATCH] guilt(1): Obvious bashisms fixed.

Quoted 29 lines · Josef Sipek
Quoted 5 lines · Pierre Habouzit

+ function foo { } -> foo() { }
+ add wrapper for echo -e
+ couple of '[' bashisms
+ get rid of easy local variables to remove
+ avoid cd - (using subshells)

....

Just a small nit-pick :)

Quoted 5 lines
guilt +0 -0
index 2ae76f8..80f3faf 100755
@@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1

....

guilt function guilt_commands · line 57

Quoted 10 lines
guilt +2 -1
+guilt_commands()
 {
 	local command
 	for command in $0-*
@@ -32,7 +54,7 @@ function guilt_commands
 	done
 }
 
-if [ `basename $0` = "guilt" ]; then
+if [ "`basename $0`" = "guilt" ]; then

You added quotes here - that's ok....

Quoted 6 lines

guilt if [ `basename $0` = "guilt" ]; then

Quoted 4 lines
guilt +0 -0
 	# being run as standalone
 
 	# by default, we shouldn't fail
@@ -58,7 +80,7 @@ if [ `basename $0` = "guilt" ]; then

But did not add them here.... :)

heh, I tried my best, I've no automated tool for that, only my eyes
and thise code will break iff basename $0 has spaces in it, which is rather crazy anyways. But you're welcome to add the missing ones *sigh*

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#12 lore raw

PATCH 1/1 Small regresson when series file is empty.

In reply to Pierre Habouzit
---
 guilt |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
guilt +3 -2
index f77c050..58df606 100755
@@ -246,8 +246,9 @@ head_check()
 # usage: series_insert_patch <patchname>
 series_insert_patch()
 {
-	awk -v top="`get_top`" -v new="$1" '{
-			if (top == "" && NR == 1) print new;
+	awk -v top="`get_top`" -v new="$1" \
+		'BEGIN{if (top == "") print new;}
+		{
 			print $0;
 			if (top != "" && top == $0) print new;
 		}' "$series" > "$series.tmp"
Signature · 1 line
1.5.2.1
#13 lore raw

PATCH 1/1 More regressions fixes.

In reply to Pierre Habouzit

+ use awk again to parse git-cat-file properly
+ fixes .new -> .tmp (always use the same suffix to avoid problems)
+ write in foo.tmp and move it, and not the reverse :)

---
 guilt |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
guilt +17 -11
index 58df606..7c78cc7 100755
@@ -177,16 +177,22 @@ do_make_header()
 		exit 2
 	fi
 
-	git-cat-file -p "$1" | sed -e \
-		'1,/^$/ {
-			/^author/ {
-				s/^author /From: /
-				s/ [0-9]* [+-]*[0-9][0-9]*$//
-				p
+	git-cat-file -p "$1" | awk '
+		BEGIN{headers=1; firstline=1}
+		/^author / && headers {
+			sub(/^author +/, "");
+			sub(/ [0-9]* [+-]*[0-9][0-9]*$/, "");
+			author=$0
+		}
+		!headers {
+			print
+			if (firstline) {
+				firstline = 0;
+				print "\nFrom: " author;
 			}
-			/^$/p
-			d
-		}'
+		}
+		/^$/ && headers { headers = 0 }
+	'
 }
 
 # usage: do_get_header patchfile
@@ -267,7 +273,7 @@ series_rename_patch()
 {
 	awk -v old="$1" -v new="$2" \
 		'{ if ($0 == old) print new; else print $0 }' \
-		"$series.tmp" > "$series"
+		"$series" > "$series.tmp"
 
 	mv "$series.tmp" "$series"
 }
@@ -284,7 +290,7 @@ applied_rename_patch()
 				print substr($0, 0, 41) new;
 			else
 				print;
-			}' "$applied" > "$applied.new"
+			}' "$applied" > "$applied.tmp"
 
 	mv "$applied.tmp" "$applied"
 }
Signature · 1 line
1.5.2.1
#14 lore raw
In reply to Pierre Habouzit
Quoted 4 lines · Pierre Habouzit

This patch series makes guilt be able to work with a standard posix shell.

This has been tested with bash, zsh, dash and posh acting as /bin/sh.

By tested I mean that I carefully crafted the changes, and ran make
test with /bin/sh pointing to those shells, and the suite passed.

Though, we could have /some/ regressions.

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#15 lore raw
In reply to Pierre Habouzit
Quoted 10 lines · Pierre Habouzit

This patch series makes guilt be able to work with a standard posix shell.

This has been tested with bash, zsh, dash and posh acting as /bin/sh.

This uses awk and sed a bit more than before, but POSIX awk and sed should be enough. Though GNU find and GNU /bin/echo from the coreutils needs to be there.

Here is the shortlog:

Quoted 8 lines

Pierre Habouzit (7):
Regression test suite needs bash, that's OK. guilt(1): Obvious bashisms fixed.
guilt(1): simplifications...
guilt(1): reimplement push_patch, using a subshell to avoid locals. Easy commands, without bashisms.
guilt-status(1): Remove bashisms.
Remove last bashisms from remaining commands.

I went though the patches, and it's mostly good (see individual patch replies for details). I noticed an indentation issue or two, but I can fix that up easily, I can take care of the quoting of basename $0.

The regression suite is little lacking, so I am going to put your updated patches onto a special branch, and test it for a while - fixing up any potential bugs. (I don't want to be even remotely responsible for people's patches turning into empty files :) )

Thanks a lot!

Josef "Jeff" Sipek.

Signature · 1 line
A CRAY is the only computer that runs an endless loop in just 4 hours...
#16 lore raw
Quoted 20 lines · Josef Sipek
Quoted 10 lines · Pierre Habouzit

This patch series makes guilt be able to work with a standard posix shell.

This has been tested with bash, zsh, dash and posh acting as /bin/sh.

This uses awk and sed a bit more than before, but POSIX awk and sed should be enough. Though GNU find and GNU /bin/echo from the coreutils needs to be there.

Here is the shortlog:

Quoted 8 lines

Pierre Habouzit (7):
Regression test suite needs bash, that's OK. guilt(1): Obvious bashisms fixed.
guilt(1): simplifications...
guilt(1): reimplement push_patch, using a subshell to avoid locals. Easy commands, without bashisms.
guilt-status(1): Remove bashisms.
Remove last bashisms from remaining commands.

Quoted 3 lines

I went though the patches, and it's mostly good (see individual patch replies for details). I noticed an indentation issue or two, but I can fix that up easily, I can take care of the quoting of basename $0.

Thanks.

Quoted 4 lines

The regression suite is little lacking, so I am going to put your updated patches onto a special branch, and test it for a while - fixing up any potential bugs. (I don't want to be even remotely responsible for people's patches turning into empty files :) )

That seems like a very good plan. I just sent the fixes. Hopefully
this should fix major issues right now.

Interestingly enough, benchmarking for runs with different shells as
/bin/sh show:

dash: 1.63s user 3.93s system 102% cpu 5.436 total
posh: 2.02s user 4.29s system 100% cpu 6.260 total
bash: 2.82s user 5.78s system 104% cpu 8.223 total
zsh: 3.70s user 5.86s system 99% cpu 9.626 total

(this is obviously completely not unreliable, but gives some rough
ideas though)

Quoted 1 line

Thanks a lot!

Well, worry for the obvious mistakes.

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#17 lore raw
Quoted 4 lines · Pierre Habouzit
Quoted 1 line · Josef Sipek

Thanks a lot!

Well, worry for the obvious mistakes.

*sorry

Now, *that* was an interesting typo :P

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#18 lore raw
Quoted 8 lines · Pierre Habouzit
Quoted 4 lines · Pierre Habouzit
Quoted 1 line · Josef Sipek

Thanks a lot!

Well, worry for the obvious mistakes.

*sorry

Now, *that* was an interesting typo :P

:)

Ok, pushed to kernel.org. I folded the 2 regression fixing patches into the right places.

Thanks a lot!

Josef "Jeff" Sipek.

Signature · 3 lines
Linux, n.:
  Generous programmers from around the world all join forces to help
  you shoot yourself in the foot for free. 
#19 lore raw
Quoted 6 lines · Josef Sipek
Quoted 5 lines · Pierre Habouzit
Quoted 4 lines · Pierre Habouzit
Quoted 1 line · Josef Sipek

Thanks a lot!

Well, worry for the obvious mistakes.

Quoted 8 lines
Quoted 3 lines

*sorry

Now, *that* was an interesting typo :P

:)

Ok, pushed to kernel.org. I folded the 2 regression fixing patches into the right places.

Just a small remark: 87739d0e should be merged in the master branch,
as the regression suite does not work atm if you are using a shell that does not understands enough bashisms.

The patch is safe (it only adds /bin/bash shebangs to tests, and
changes the way tests are called in the Makefile).

For the rest, I agree the patches should continue to live in a
separate branch until better coverage of the testsuite can give us more faith in those patches :)

Signature · 3 lines
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org
#21 lore raw
Quoted 11 lines · Derek Fawcus
Quoted 3 lines · Pierre Habouzit

This patch series makes guilt be able to work with a standard posix shell.

This has been tested with bash, zsh, dash and posh acting as /bin/sh.

Well if you want to try with a 'real' bourne shell, there is always the heirloom sh or the v7 shell...

http://heirloom.sourceforge.net/sh.html

From the main page

'''
interactive use. The Bourne shell provides job control if it is invoked as jsh and runs on a terminal. Of course, it lacks fancy features such as a command history, command line completion, etc. But working with these features tends to distract the user's attention. After a familiarization phase, use of the Bourne shell can lead to a more even-tempered, concentrated working style. Give it a try. Seriously.
'''

I love it. I acknowledge that you have to be fairly well concentrated if you want to type /usr/lib/python2.5/site-packages/spambayes/resources/ (as an example) without missing one char.

:)
Benjamin.

Quoted 9 lines

http://www.collyer.net/who/geoff/v7sh.tar
http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/

DF
-
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html