diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-15 12:47:59 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-15 12:47:59 -0200 |
commit | a5e180fe77a7aaccfcbd26aba8ee1c484ef9aad6 (patch) | |
tree | e0a86be82089678cc4127e604bcea27b5535a7c2 | |
parent | 9e844111caa8f4f9fbc69981b49caa4d09d09980 (diff) | |
download | scripts-a5e180fe77a7aaccfcbd26aba8ee1c484ef9aad6.tar.gz scripts-a5e180fe77a7aaccfcbd26aba8ee1c484ef9aad6.tar.bz2 |
Cleanup and minor fixes at commit script
-rwxr-xr-x | commit | 26 |
1 files changed, 3 insertions, 23 deletions
@@ -3,30 +3,11 @@ # Commit both on git and svn # -# Get the absolute folder from a file -# Usage: absolute_folder <file> -function absolute_folder { - - local file="$1" cwd - - if [ -e "$file" ]; then - cwd="`pwd`" - cd `dirname $file` - pwd - cd $cwd - fi - -} - # Check if a file is inside a git repository # Usage: git_folder <file> function git_folder { - local file="$1" folder folders dir_list cwd - - if [ -e "$file" ]; then - folder="`absolute_folder $file`" - fi + local folder="$1" folder folders dir_list cwd if [ -d "$folder/.git" ]; then GIT_FOLDER="$folder" @@ -42,13 +23,12 @@ function git_folder { cwd="`pwd`" cd $folder -echo folders: $folders for i in $folders; do cd .. if [ -d "$(pwd)/.git" ]; then - cd $cwd GIT_FOLDER="$(pwd)" - return true + cd $cwd + return fi done |