summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2006-05-26 10:18:47 +0000
committerAndreas Gruenbacher <agruen@suse.de>2006-05-26 10:18:47 +0000
commit67c9b8be811e53890964a3e7cf05c3b533ec8ec8 (patch)
treeb82bde333bfd2ccf73ff17ec3eda3777248eef80
parentfb27983ea696a9758e50de0fcefe0e6108bab624 (diff)
downloadquilt-67c9b8be811e53890964a3e7cf05c3b533ec8ec8.tar.gz
- quilt/scripts/patchfns.in: Fix bugs in basename() and dirname().
-rw-r--r--quilt.changes5
-rw-r--r--quilt/scripts/patchfns.in31
2 files changed, 30 insertions, 6 deletions
diff --git a/quilt.changes b/quilt.changes
index c4ca730..cffc7b8 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Fri May 26 12:16:18 CEST 2006 - agruen@suse.de
+
+- quilt/scripts/patchfns.in: Fix bugs in basename() and dirname().
+
+-------------------------------------------------------------------
Thu May 25 09:12:08 CEST 2006 - khali@linux-fr.org
- quilt/edit.in, quilt/header.in, quilt/mail.in: Run $EDITOR with
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 64c2a11..fa591c1 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -87,19 +87,38 @@ quote_re()
basename()
{
- local path="${1//\/\//}"
- path="${path%%/}"
+ local path=$1
+ while [ "${path:(-1)}" = "/" ]
+ do
+ path=${path%/}
+ done
echo "${path##*/}"
}
dirname()
{
- local path="${1//\/\//}"
- path="${path%%/}"
+ local path=$1
+ while [ "${path:(-1)}" = "/" ]
+ do
+ path=${path%/}
+ done
local basename="${path##*/}"
path="${path:0:${#path}-${#basename}}"
- [ x"$path" != x"/" ] && path="${path%/}"
- echo "${path:-.}"
+ while [ "${path:(-1)}" = "/" ]
+ do
+ path=${path%/}
+ done
+ if [ -n "$path" ]
+ then
+ echo "$path"
+ else
+ if [ ${1:0:1} = "/" ]
+ then
+ echo "/"
+ else
+ echo "."
+ fi
+ fi
}
patch_file_name()