From f8b0b971bb7a66a322c02eea837672d82a7157e5 Mon Sep 17 00:00:00 2001 From: Benedikt Schesch <37979523+benedikt-schesch@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:29:57 +0200 Subject: [PATCH] Exit within subshell (#350) --- src/scripts/merge_tools/git_hires_merge.sh | 2 +- src/scripts/merge_tools/gitmerge.sh | 2 +- src/scripts/merge_tools/gitmerge_resolve.sh | 2 +- src/scripts/merge_tools/intellimerge.sh | 2 +- src/scripts/merge_tools/merge_git_then_plumelib.sh | 2 +- src/scripts/merge_tools/merge_script_then_plumelib.sh | 2 +- src/scripts/merge_tools/spork.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scripts/merge_tools/git_hires_merge.sh b/src/scripts/merge_tools/git_hires_merge.sh index 737f30c7cf..ef1795eb9c 100755 --- a/src/scripts/merge_tools/git_hires_merge.sh +++ b/src/scripts/merge_tools/git_hires_merge.sh @@ -16,7 +16,7 @@ branch2=$3 # Print the current PATH echo "PATH: $PATH" -cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) +cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir from $(pwd)"; exit 2; } git checkout "$branch1" --force diff --git a/src/scripts/merge_tools/gitmerge.sh b/src/scripts/merge_tools/gitmerge.sh index 79e69c1687..ce27cc1161 100755 --- a/src/scripts/merge_tools/gitmerge.sh +++ b/src/scripts/merge_tools/gitmerge.sh @@ -21,7 +21,7 @@ git_strategy=$4 ## Perform merge -cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) +cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } git checkout "$branch1" --force git config --local merge.conflictstyle diff3 diff --git a/src/scripts/merge_tools/gitmerge_resolve.sh b/src/scripts/merge_tools/gitmerge_resolve.sh index 14b7dd8219..3287584a16 100755 --- a/src/scripts/merge_tools/gitmerge_resolve.sh +++ b/src/scripts/merge_tools/gitmerge_resolve.sh @@ -12,7 +12,7 @@ status=$? if [ "$status" -ne 0 ]; then echo "Removing filenames from conflict markers." - cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) + cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } readarray -t files < <(grep -l -r '^\(<<<<<<<\||||||||\|>>>>>>>\) .merge_file_') for file in "${files[@]}" ; do echo "Removing filenames from conflict markers in $file" diff --git a/src/scripts/merge_tools/intellimerge.sh b/src/scripts/merge_tools/intellimerge.sh index 72c10f0352..3ddd822427 100755 --- a/src/scripts/merge_tools/intellimerge.sh +++ b/src/scripts/merge_tools/intellimerge.sh @@ -34,7 +34,7 @@ echo "Temp dir: $temp_out_dir" clone_dir_absolutepath=$(realpath "$clone_dir") # run intellimerge -cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) +cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } java -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -Djava.io.tmpdir="$temp_intellimerge_dir" -jar "$intellimerge_absolutepath" -r "$clone_dir_absolutepath" -b "$branch1" "$branch2" -o $temp_out_dir diff --git a/src/scripts/merge_tools/merge_git_then_plumelib.sh b/src/scripts/merge_tools/merge_git_then_plumelib.sh index a51b0ba564..c06a827be3 100755 --- a/src/scripts/merge_tools/merge_git_then_plumelib.sh +++ b/src/scripts/merge_tools/merge_git_then_plumelib.sh @@ -23,7 +23,7 @@ plumelib_strategy=$5 #"--only-adjacent" echo "$0: Merging $branch1 and $branch2 with git_strategy=$git_strategy and plumelib_strategy=$plumelib_strategy" -cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) +cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } git checkout "$branch1" --force git config --local merge.conflictstyle diff3 diff --git a/src/scripts/merge_tools/merge_script_then_plumelib.sh b/src/scripts/merge_tools/merge_script_then_plumelib.sh index 13cb2ac1c7..f2fa314512 100755 --- a/src/scripts/merge_tools/merge_script_then_plumelib.sh +++ b/src/scripts/merge_tools/merge_script_then_plumelib.sh @@ -24,7 +24,7 @@ plumelib_strategy=$5 #"--only-adjacent" echo "$0: Merging $branch1 and $branch2 with merge_script=$merge_script and plumelib_strategy=$plumelib_strategy" -cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) +cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } git checkout "$branch1" --force git config --local merge.conflictstyle diff3 diff --git a/src/scripts/merge_tools/spork.sh b/src/scripts/merge_tools/spork.sh index 42182223ce..595cee1473 100755 --- a/src/scripts/merge_tools/spork.sh +++ b/src/scripts/merge_tools/spork.sh @@ -26,7 +26,7 @@ clone_dir=$1 branch1=$2 branch2=$3 -cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 2) +cd "$clone_dir" || { echo "$0: cannot cd to $clone_dir"; exit 2; } # set up spork driver git config --local merge.spork.name "spork"