]> gitweb.fluxo.info Git - utils-git.git/commitdiff
Fix: better handling of paths with spaces
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 20 Jul 2023 18:15:40 +0000 (15:15 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 20 Jul 2023 18:15:40 +0000 (15:15 -0300)
commit
commit-updates

diff --git a/commit b/commit
index fe2ade67519b8c3c3cae14e8df81220ec88c80b8..d16fc816bb839d22a5ae6dc3cba5d8d8894deab7 100755 (executable)
--- a/commit
+++ b/commit
@@ -13,7 +13,7 @@ GIT="hit"
 # Usage: git_folder <file>
 function git_folder {
 
-  local folder="$1" folder folders dir_list cwd
+  local folder="$*" folder folders dir_list cwd
 
   if [ -d "$folder/.git" ]; then
     GIT_FOLDER="$folder"
@@ -27,18 +27,18 @@ function git_folder {
   done
 
   cwd="`pwd`"
-  cd $folder
+  cd "$folder"
 
   for i in $folders; do
     cd ..
     if [ -d "$(pwd)/.git" ]; then
       GIT_FOLDER="$(pwd)"
-      cd $cwd
+      cd "$cwd"
       return
     fi
   done
 
-  cd $cwd
+  cd "$cwd"
   return 1
 
 }
index 9fe77d78d1da3f9d35338e91e524a9dd0ecdddeb..1ebcecef1e708f0c762806e83a4ed79017779a35 100755 (executable)
@@ -28,7 +28,7 @@ if $GIT status &> /dev/null; then
   if [ ! -z "$ARGS" ]; then
     commit "Updates $ARGS"
   else
-    commit "Updates $(basename `pwd`)"
+    commit "Updates $(basename "`pwd`")"
   fi
 else
   mr commit -m "Updates"