Browse Source

Added functionality for git_init and git_commit

old-stable
gau1991 11 years ago
parent
commit
6daab83573
  1. 15
      src/lib/ee_lib_git_commit.sh
  2. 21
      src/lib/ee_lib_git_init.sh
  3. 2
      src/lib/ee_lib_service.sh

15
src/lib/ee_lib_git_commit.sh

@ -0,0 +1,15 @@
# Record changes to the repository
function ee_lib_git_commit()
{
cd $EE_GIT_DIR \
|| ee_lib_error "Unable to change directory $EE_GIT_DIR, exit status = " $?
if [ $(git status -s | wc -l) -ne 0 ]; then
ee_lib_echo "Commiting changes inside $EE_GIT_DIR, please wait..."
# Add newly created files && commit it
git add --all && git commit -am "$EE_GIT_MESSAGE" &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to Git commit on $EE_GIT_DIR, exit status = " $?
fi
}

21
src/lib/ee_lib_git_init.sh

@ -0,0 +1,21 @@
# Initialise Git
function ee_lib_git_init()
{
# Change directory
cd $EE_GIT_DIR || ee_lib_error "Unable to change directory $EE_GIT_DIR, exit status = " $?
# Check .git
if [ ! -d .git ]; then
ee_lib_echo "Initialise Git On $EE_GIT_DIR..."
git init &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to initialize Git on $EE_GIT_DIR, exit status = " $?
fi
# Check for untracked files
if [ $(git status -s | wc -l) -ne 0 ]; then
# Add files in Git version control
git add --all && git commit -am "Initialize Git On $EE_GIT_DIR" &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to Git commit on $EE_GIT_DIR, exit status = " $?
fi
}

2
src/lib/ee_lib_service.sh

@ -21,4 +21,4 @@ function ee_lib_service()
fi
done
}
}

Loading…
Cancel
Save