aboutsummaryrefslogtreecommitdiff
path: root/commit-updates
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-05-14 16:42:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-05-14 16:42:58 -0300
commitc3ad995c1ecf910e3a657293f9c8d4a614059f4f (patch)
treef83faa6c5a9c2b7154d7475563a2940eafc967c8 /commit-updates
parentc31d9f1126dd87fefc5d36673a03ddfa753bf2b4 (diff)
downloadutils-git-c3ad995c1ecf910e3a657293f9c8d4a614059f4f.tar.gz
utils-git-c3ad995c1ecf910e3a657293f9c8d4a614059f4f.tar.bz2
Make commit-updates work for any project we can cd into
Diffstat (limited to 'commit-updates')
-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