aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-15 17:27:19 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-15 17:27:19 -0200
commit047aa24b29c9355648bdc8633c3face176572adf (patch)
treed97b9ed020214681bf0e6fad4fd2ed98f25728b8
parent9d8ade1f5314dcad5845cf8ae5308cbd557b4344 (diff)
downloadscripts-047aa24b29c9355648bdc8633c3face176572adf.tar.gz
scripts-047aa24b29c9355648bdc8633c3face176572adf.tar.bz2
Adding --config option to commit script
-rwxr-xr-xcommit44
1 files changed, 29 insertions, 15 deletions
diff --git a/commit b/commit
index 03e9a8a..3cf9980 100755
--- a/commit
+++ b/commit
@@ -3,6 +3,9 @@
# Commit both on git and svn
#
+# Parameters
+ARGS="$*"
+
# Check if a file is inside a git repository
# Usage: git_folder <file>
function git_folder {
@@ -84,24 +87,35 @@ function git_push {
# Check user information
function git_user {
if ! grep -q "^\[user\]" $GIT_FOLDER/.git/config; then
- echo "No user configuration section found in the repository."
- echo "This might be a privacy issue"
-
- if [ -e "$HOME/.gitconfig" ]; then
- echo "You should try to use your default setting:"
- if [ "$GIT_FOLDER" == "$(pwd)" ]; then
- echo "cat <<EOF >> .git/config"
- else
- echo "cat <<EOF >> $GIT_FOLDER/.git/config"
- fi
- grep -A 2 "^\[user\]" $HOME/.gitconfig
- echo "EOF"
- fi
-
- exit 1
+ if echo $ARGS | grep -q '--config'; then
+ grep -A 2 "^\[user\]" $HOME/.gitconfig >> $GIT_FOLDER/.git/config
+ else
+
+ echo "No user configuration section found in the repository."
+ echo "This might be a privacy issue"
+ echo ""
+
+ if [ -e "$HOME/.gitconfig" ]; then
+ echo "You should try to use your default setting:"
+ if [ "$GIT_FOLDER" == "$(pwd)" ]; then
+ echo "cat <<EOF >> .git/config"
+ else
+ echo "cat <<EOF >> $GIT_FOLDER/.git/config"
+ fi
+ grep -A 2 "^\[user\]" $HOME/.gitconfig
+ echo "EOF"
+
+ echo ""
+ echo "Use --config if you want these lines to be added at .git/config"
+ fi
+
+ exit 1
+
+ fi
fi
}
+# Main
if [ ! -z "$1" ]; then
if is_svn .; then
svn commit -m "$*"