Permalink
Browse files

Handle spaces in path names in git dirty repository finder

  • Loading branch information...
1 parent 4d91a68 commit c9faaa4ede5136c4c87ea179f535680828e2e8f1 @matthewmccullough committed Sep 9, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 git-finddirty
View
@@ -13,6 +13,11 @@
# Very verbose mode that outputs what files are dirty
##############################################################################
+# Preserve the old input field separator
+OLDIFS=$IFS
+# Change the input field separator from a space to a null
+IFS=$'\n'
+
# Find all directories that have a .git directory in them
for gitprojpath in `find . -type d -name .git | sort | sed "s/\/\.git//"`; do
# Save the current working directory before CDing for git's purpose
@@ -39,3 +44,6 @@ for gitprojpath in `find . -type d -name .git | sort | sed "s/\/\.git//"`; do
# Return to the starting directory, suppressing the output
popd >/dev/null
done
+
+# restore the input field separator
+IFS=$OLDIFS

0 comments on commit c9faaa4

Please sign in to comment.