From eafc9c16c9e5aa1bafab689641818a38ba869794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arild=20H=C3=A5kon=20Olsen?= Date: Fri, 9 Feb 2024 14:29:32 +0100 Subject: [PATCH] fixed the from-commit parameter --- smud-cli/functions-upgrade.sh | 28 +++++++++++++++++++++++++++- smud-cli/include.sh | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/smud-cli/functions-upgrade.sh b/smud-cli/functions-upgrade.sh index 13689c1..102e5f7 100644 --- a/smud-cli/functions-upgrade.sh +++ b/smud-cli/functions-upgrade.sh @@ -138,6 +138,32 @@ upgrade() local cherrypick_options="--keep-redundant-commits --allow-empty -x" local upgrade_error_code=0 if [ "$yes_no" = "yes" ]; then + + local user_name=$(git config --get user.name) + local user_email=$(git config --get user.email) + + if [ ! "$user_name" ] || [ ! "$user_email" ]; then + local remote_origin_url="$(git config --get remote.origin.url| sed -e 's/https:\/\//')" + if [ ! "$user_name" ]; then + local user_name="githubservicesmud" + fi + + if [ ! "$user_email" ]; then + local user_email="githubservicesmud@dips.no" + fi + local user_name_ask="$user_name" + local user_email_ask="$user_email" + if [ ! "$silent" ]; then + ask user_name_ask $blue "Please configure git user.name: Push ENTER to use '$user_name_ask': " + ask user_email_ask $blue "Please configure git user.email: Push ENTER to use '$user_email_ask': " + fi + + local dummy=$(git config --unset user.name) + local dummy=$(git config --unset user.email) + local dummy=$(git config --add user.name "$user_name_ask" ) + local dummy=$(git config --add user.email "$user_email_ask" ) + fi + commits="${rev_list[@]}" print_gray "Running: git cherry-pick [commits]...\n" print_debug "$commits" @@ -197,7 +223,7 @@ upgrade() else printf "${red}The follwing contains changes that must be resolved:\n${normal}" fi - + for status_code in "${!status_map[@]}"; do filenames="${status_map[$status_code]}" description=$(get_status_description "$status_code") diff --git a/smud-cli/include.sh b/smud-cli/include.sh index f0487b9..27eff32 100644 --- a/smud-cli/include.sh +++ b/smud-cli/include.sh @@ -477,7 +477,7 @@ if [ "$has_args" ] && [ ! "$help" ] && [ "$is_repo" ]; then if [ ! "$from_commit" ] && [ ! "$from_date" ] && [ "$can_do_git" ] ; then - from_commit_command="git rev-list $default_branch -1" + from_commit_command="git rev-list $current_branch -1" { run_command from-commit --command-var from_commit_command --return-var from_commit --skip-error --debug-title "from-commit-command" } || {