From 6635cfe307dd82787403f5112a19c7a2b93384af Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 27 Aug 2012 17:24:53 +0000 Subject: [PATCH] list-source-files: Process subdirectories correctly git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4475 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/list-source-files | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/list-source-files b/scripts/list-source-files index 768a9fdfe..a14307b3b 100755 --- a/scripts/list-source-files +++ b/scripts/list-source-files @@ -1,16 +1,17 @@ #!/bin/bash list_source_files() { - local r + local d r - r="$1" + d="$(cd "$1" && echo "$PWD")" + r="$d" while [ "$r" != "/" -a ! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do r="$(dirname "$r")" done if [ -e "$r/.svn" ]; then ( - cd "$1" + cd "$d" svn status -v | \ grep -vE '^[D?]|^Performing|^$' | \ cut -c41- | \ @@ -21,20 +22,16 @@ list_source_files() { done ) elif [ -e "$r/.git" ]; then - git_dir="$PWD" - while [ "$git_dir" != "" -a ! -e "$git_dir/.git" ]; do - git_dir="$(dirname "$git_dir")" - done - subdir="${PWD#${git_dir}}" - if [ "$git_dir" != "" ]; then - git ls-tree --name-only -r HEAD | sed "s|^$subdir/||" + subdir="${d#${r}}" + if [ "$r" != "" ]; then + ( cd "$d" && git ls-tree --name-only -r HEAD ) | sed "s|^$subdir/||" else - echo "Ignored directory $PWD" >&2 + echo "Ignored directory $1" >&2 fi elif [ -e "$r/.hg" ]; then hg manifest else - echo "Not under source control: $PWD ?" >&2 + echo "Not under source control: $1 ?" >&2 fi }