Subject: [PATCH] guilt-status(1): Remove bashisms.

From: Pierre Habouzit <[email-masked]>
Date: Thu, 14 Jun 2007 14:51:01 +0200

Signed-off-by: Pierre Habouzit <[email-masked]>
---
 guilt-status |   58 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/guilt-status b/guilt-status
index 934ea53..bc2f33e 100755
--- a/guilt-status
+++ b/guilt-status
@@ -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
-- 
1.5.2.1