|
|
|
@ -173,7 +173,7 @@ if [ -z "$GW_RL_BIN" ]; then RL="readlink"; else RL="$GW_RL_BIN"; fi
|
|
|
|
|
|
|
|
|
|
# Check availability of selected binaries and die if not met
|
|
|
|
|
for cmd in "$GIT" "$INW"; do
|
|
|
|
|
is_command "$cmd" || { stderr "Error: Required command '$cmd' not found." ; exit 1; }
|
|
|
|
|
is_command "$cmd" || { stderr "Error: Required command '$cmd' not found." ; exit 2; }
|
|
|
|
|
done
|
|
|
|
|
unset cmd
|
|
|
|
|
|
|
|
|
@ -227,7 +227,7 @@ elif [ -f "$1" ]; then # if the target is a single file
|
|
|
|
|
GIT_COMMIT_ARGS="" # no need to add anything more to "commit" call
|
|
|
|
|
else
|
|
|
|
|
stderr "Error: The target is neither a regular file nor a directory."
|
|
|
|
|
exit 1
|
|
|
|
|
exit 3
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# If $GIT_DIR is set, verify that it is a directory, and then add parameters to
|
|
|
|
@ -236,7 +236,7 @@ if [ -n "$GIT_DIR" ]; then
|
|
|
|
|
|
|
|
|
|
if [ ! -d "$GIT_DIR" ]; then
|
|
|
|
|
stderr ".git location is not a directory: $GIT_DIR";
|
|
|
|
|
exit 1;
|
|
|
|
|
exit 4;
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
GIT="$GIT --no-pager --work-tree $TARGETDIR --git-dir $GIT_DIR"
|
|
|
|
@ -249,7 +249,7 @@ if ! grep "%d" > /dev/null <<< "$COMMITMSG"; then # if commitmsg didn't contain
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# CD into right dir
|
|
|
|
|
cd "$TARGETDIR" || { stderr "Error: Can't change directory to '${TARGETDIR}'." ; exit 1; }
|
|
|
|
|
cd "$TARGETDIR" || { stderr "Error: Can't change directory to '${TARGETDIR}'." ; exit 5; }
|
|
|
|
|
|
|
|
|
|
if [ -n "$REMOTE" ]; then # are we pushing to a remote?
|
|
|
|
|
if [ -z "$BRANCH" ]; then # Do we have a branch set to push to ?
|
|
|
|
@ -339,7 +339,7 @@ eval "$INW" "${INW_ARGS[@]}" | while read -r line; do
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# CD into right dir
|
|
|
|
|
cd "$TARGETDIR" || { stderr "Error: Can't change directory to '${TARGETDIR}'." ; exit 1; }
|
|
|
|
|
cd "$TARGETDIR" || { stderr "Error: Can't change directory to '${TARGETDIR}'." ; exit 6; }
|
|
|
|
|
STATUS=$($GIT status -s)
|
|
|
|
|
if [ -n "$STATUS" ]; then # only commit if status shows tracked changes.
|
|
|
|
|
$GIT add $GIT_ADD_ARGS # add file(s) to index
|
|
|
|
|