aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcommit-updates21
1 files changed, 13 insertions, 8 deletions
diff --git a/commit-updates b/commit-updates
index 082727d..ab56b2e 100755
--- a/commit-updates
+++ b/commit-updates
@@ -4,20 +4,25 @@
#
# Parameters
+PROJECT="$1"
+
+# Check if param is a project
+if [ ! -z "$PROJECT" ] && [ -z "$2" ] && ( cd $PROJECT &> /dev/null ); then
+ cd $PROJECT &> /dev/null
+ shift
+fi
+
+# Commit message
ARGS="$*"
# Simply update commit
if git status &> /dev/null; then
- if [ ! -z "$1" ]; then
- commit "Updates $*"
+ if [ ! -z "$ARGS" ]; then
+ commit "Updates $ARGS"
else
commit "Updates $(basename `pwd`)"
fi
else
- if [ ! -z "$1" ] && [ -d "$1" ]; then
- ( cd $1 &> /dev/null && commit "Updates $(basename $1)" )
- else
- mr commit -m "Updates"
- mr fetch
- fi
+ mr commit -m "Updates"
+ mr fetch
fi