diff options
-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 "$*" |