diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-15 17:27:19 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-15 17:27:19 -0200 |
commit | 047aa24b29c9355648bdc8633c3face176572adf (patch) | |
tree | d97b9ed020214681bf0e6fad4fd2ed98f25728b8 | |
parent | 9d8ade1f5314dcad5845cf8ae5308cbd557b4344 (diff) | |
download | scripts-047aa24b29c9355648bdc8633c3face176572adf.tar.gz scripts-047aa24b29c9355648bdc8633c3face176572adf.tar.bz2 |
Adding --config option to commit script
-rwxr-xr-x | commit | 44 |
1 files changed, 29 insertions, 15 deletions
@@ -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 "$*" |