From a5e180fe77a7aaccfcbd26aba8ee1c484ef9aad6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 15 Jan 2013 12:47:59 -0200 Subject: Cleanup and minor fixes at commit script --- commit | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/commit b/commit index a113432..2be27dd 100755 --- a/commit +++ b/commit @@ -3,30 +3,11 @@ # Commit both on git and svn # -# Get the absolute folder from a file -# Usage: absolute_folder -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 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 -- cgit v1.2.3