From b4050fce75a036279f8fb62d27324a7d3a35a1cd Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sun, 15 Sep 2024 06:55:35 -0700 Subject: [PATCH] Use grouping rather than subshell --- 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 b9a1e56fd0..eb6da7fc58 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 7012e0b587..d00011ab40 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 47b45b4b89..5e935a97c9 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 2b9595e367..6e5fccae73 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 25645c9695..f8fa5fca06 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 5aad05c8c6..3f2619ee93 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 761725d303..5ad8e2674e 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"