commit 79c49d8454129776fe282b780f5836be20ea0052 from: Mark Jamsek date: Mon Jul 24 12:35:34 2023 UTC regress: nix 'set -A' kshism from tests As reported by naddy, this is a non-portable Korn shell construct. Instead, use the one argument array then make faux space-delimited string "arrays" for the other ids; they can still be indexed with pop_idx. improved by + ok naddy@ commit - 99301cec42290cd26b9757c17eaaab5d70781bf1 commit + 79c49d8454129776fe282b780f5836be20ea0052 blob - a52ad3f5f3953de8ae74d10f7a9f2b3d9f880cc1 blob + 709d4ccef8fe3657aabd7178ce86cd34b6abd820 --- regress/cmdline/blame.sh +++ regress/cmdline/blame.sh @@ -997,7 +997,7 @@ test_blame_commit_keywords() { local wt="$testroot/wt" local id=$(git_show_head "$repo") - set -A ids "$(trim_obj_id 32 $id)" + set -- "$(trim_obj_id 32 $id)" # :base requires work tree echo "got: '-c :base' requires work tree" > "$testroot/stderr.expected" @@ -1038,15 +1038,14 @@ test_blame_commit_keywords() { fi id=$(git_show_head "$repo") - set -- "$ids" "$(trim_obj_id 32 $id)" - ids=$* + set -- "$@" "$(trim_obj_id 32 $id)" done local author_time=$(git_show_author_time "$repo") local d=$(date -u -r $author_time +"%G-%m-%d") got blame -r "$repo" -c:head:-8 alpha > "$testroot/stdout" - echo "1) $(pop_id 1 $ids) $d $GOT_AUTHOR_8 alpha" > \ + echo "1) $(pop_idx 1 $@) $d $GOT_AUTHOR_8 alpha" > \ "$testroot/stdout.expected" cmp -s $testroot/stdout.expected $testroot/stdout @@ -1059,11 +1058,11 @@ test_blame_commit_keywords() { (cd "$wt" && got blame -cmaster:-5 alpha > "$testroot/stdout") - echo "1) $(pop_id 2 $ids) $d $GOT_AUTHOR_8 change 1" > \ + echo "1) $(pop_idx 2 $@) $d $GOT_AUTHOR_8 change 1" > \ "$testroot/stdout.expected" - echo "2) $(pop_id 3 $ids) $d $GOT_AUTHOR_8 change 2" >> \ + echo "2) $(pop_idx 3 $@) $d $GOT_AUTHOR_8 change 2" >> \ "$testroot/stdout.expected" - echo "3) $(pop_id 4 $ids) $d $GOT_AUTHOR_8 change 3" >> \ + echo "3) $(pop_idx 4 $@) $d $GOT_AUTHOR_8 change 3" >> \ "$testroot/stdout.expected" cmp -s $testroot/stdout.expected $testroot/stdout @@ -1076,13 +1075,13 @@ test_blame_commit_keywords() { (cd "$wt" && got blame -c:head:-4 alpha > "$testroot/stdout") - echo "1) $(pop_id 2 $ids) $d $GOT_AUTHOR_8 change 1" > \ + echo "1) $(pop_idx 2 $@) $d $GOT_AUTHOR_8 change 1" > \ "$testroot/stdout.expected" - echo "2) $(pop_id 3 $ids) $d $GOT_AUTHOR_8 change 2" >> \ + echo "2) $(pop_idx 3 $@) $d $GOT_AUTHOR_8 change 2" >> \ "$testroot/stdout.expected" - echo "3) $(pop_id 4 $ids) $d $GOT_AUTHOR_8 change 3" >> \ + echo "3) $(pop_idx 4 $@) $d $GOT_AUTHOR_8 change 3" >> \ "$testroot/stdout.expected" - echo "4) $(pop_id 5 $ids) $d $GOT_AUTHOR_8 change 4" >> \ + echo "4) $(pop_idx 5 $@) $d $GOT_AUTHOR_8 change 4" >> \ "$testroot/stdout.expected" cmp -s $testroot/stdout.expected $testroot/stdout @@ -1096,15 +1095,15 @@ test_blame_commit_keywords() { (cd "$wt" && got up -c:head:-8 > /dev/null) (cd "$wt" && got blame -c:base:+5 alpha > "$testroot/stdout") - echo "1) $(pop_id 2 $ids) $d $GOT_AUTHOR_8 change 1" > \ + echo "1) $(pop_idx 2 $@) $d $GOT_AUTHOR_8 change 1" > \ "$testroot/stdout.expected" - echo "2) $(pop_id 3 $ids) $d $GOT_AUTHOR_8 change 2" >> \ + echo "2) $(pop_idx 3 $@) $d $GOT_AUTHOR_8 change 2" >> \ "$testroot/stdout.expected" - echo "3) $(pop_id 4 $ids) $d $GOT_AUTHOR_8 change 3" >> \ + echo "3) $(pop_idx 4 $@) $d $GOT_AUTHOR_8 change 3" >> \ "$testroot/stdout.expected" - echo "4) $(pop_id 5 $ids) $d $GOT_AUTHOR_8 change 4" >> \ + echo "4) $(pop_idx 5 $@) $d $GOT_AUTHOR_8 change 4" >> \ "$testroot/stdout.expected" - echo "5) $(pop_id 6 $ids) $d $GOT_AUTHOR_8 change 5" >> \ + echo "5) $(pop_idx 6 $@) $d $GOT_AUTHOR_8 change 5" >> \ "$testroot/stdout.expected" cmp -s $testroot/stdout.expected $testroot/stdout blob - 4bc9143544d7cac2ae3c847fbeb41f48e55a1f0a blob + 5ded37bff3fc54893ebb5730937274ffb904a1e1 --- regress/cmdline/branch.sh +++ regress/cmdline/branch.sh @@ -540,7 +540,7 @@ test_branch_packed_ref_collision() { test_branch_commit_keywords() { local testroot=$(test_init branch_commit_keywords) - set -A ids "$(git_show_head $testroot/repo)" + set -- "$(git_show_head $testroot/repo)" got checkout $testroot/repo $testroot/wt > /dev/null ret=$? @@ -560,14 +560,13 @@ test_branch_commit_keywords() { test_done "$testroot" "$ret" return 1 fi - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $testroot/repo)" done (cd "$testroot/wt" && got up > /dev/null) - echo " kwbranch: $(pop_id 3 $ids)" > $testroot/stdout.expected - echo " master: $(pop_id 5 $ids)" >> $testroot/stdout.expected + echo " kwbranch: $(pop_idx 3 $@)" > $testroot/stdout.expected + echo " master: $(pop_idx 5 $@)" >> $testroot/stdout.expected (cd "$testroot/wt" && got br -nc :head:-2 kwbranch > /dev/null) got br -r "$testroot/repo" -l > "$testroot/stdout" @@ -580,7 +579,7 @@ test_branch_commit_keywords() { return 1 fi - echo " kwbranch2: $(pop_id 4 $ids)" > $testroot/stdout.expected + echo " kwbranch2: $(pop_idx 4 $@)" > $testroot/stdout.expected got br -r "$testroot/repo" -c master:- kwbranch2 > /dev/null got br -r "$testroot/repo" -l | grep kwbranch2 > "$testroot/stdout" blob - 4b561d845788314e3f478551421310e1934634f2 blob + 5a8e3fca28fe70ffe66034d95186576fce8f8100 --- regress/cmdline/cat.sh +++ regress/cmdline/cat.sh @@ -382,8 +382,7 @@ test_cat_commit_keywords() { local delta_id=$(got tree -r "$repo" -i gamma | \ grep 'delta$' | cut -d' ' -f 1) - set -- "$delta_ids" "$delta_id" - delta_ids=$* + set -- "$@" "$delta_id" done # cat blob by path @@ -409,7 +408,7 @@ test_cat_commit_keywords() { fi # cat tree by path - echo "$(pop_id 4 $delta_ids) 0100644 delta" > \ + echo "$(pop_idx 4 $@) 0100644 delta" > \ "$testroot/stdout.expected" (cd "$wt" && got cat -c:base:-4 gamma > "$testroot/stdout") cmp -s "$testroot/stdout.expected" "$testroot/stdout" blob - 9bdce2b8a07cd2893ca474983afc996ca236d190 blob + 993c64afcbd5f4598770774738e513c4afb9387c --- regress/cmdline/checkout.sh +++ regress/cmdline/checkout.sh @@ -935,7 +935,7 @@ test_checkout_ulimit_n() { test_checkout_commit_keywords() { local testroot=$(test_init checkout_commit_keywords) - set -A ids "$(git_show_head $testroot/repo)" + set -- "$(git_show_head $testroot/repo)" got checkout $testroot/repo $testroot/wt > /dev/null ret=$? @@ -955,15 +955,14 @@ test_checkout_commit_keywords() { test_done "$testroot" "$ret" return 1 fi - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $testroot/repo)" done echo "A $testroot/wt2/alpha" > $testroot/stdout.expected echo "A $testroot/wt2/beta" >> $testroot/stdout.expected echo "A $testroot/wt2/epsilon/zeta" >> $testroot/stdout.expected echo "A $testroot/wt2/gamma/delta" >> $testroot/stdout.expected - echo "Checked out refs/heads/master: $(pop_id 4 $ids)" \ + echo "Checked out refs/heads/master: $(pop_idx 4 $@)" \ >> $testroot/stdout.expected echo "Now shut up and hack" >> $testroot/stdout.expected @@ -986,7 +985,7 @@ test_checkout_commit_keywords() { echo "A $testroot/wt3/beta" >> $testroot/stdout.expected echo "A $testroot/wt3/epsilon/zeta" >> $testroot/stdout.expected echo "A $testroot/wt3/gamma/delta" >> $testroot/stdout.expected - echo "Checked out refs/heads/master: $(pop_id 4 $ids)" \ + echo "Checked out refs/heads/master: $(pop_idx 4 $@)" \ >> $testroot/stdout.expected echo "Now shut up and hack" >> $testroot/stdout.expected blob - 8de61842e9e87808d61b276b6d639e2f1b7d5e09 blob + 01c492937e9b0b533e2d98b5ab40a43cf5e03129 --- regress/cmdline/cherrypick.sh +++ regress/cmdline/cherrypick.sh @@ -2031,7 +2031,7 @@ test_cherrypick_logmsg_ref() { test_cherrypick_commit_keywords() { local testroot=`test_init cherrypick_commit_keywords` - set -A ids "$(git_show_head $testroot/repo)" + set -- "$(git_show_head $testroot/repo)" (cd $testroot/repo && git checkout -q -b branch-1) @@ -2045,19 +2045,17 @@ test_cherrypick_commit_keywords() { echo "changed on branch-1" >> "$testroot/repo/alpha" git_commit $testroot/repo -m "alpha changed on branch-1" - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $testroot/repo)" for i in $(seq 4); do echo "branch-1 change $i" >> "$testroot/repo/gamma/delta" git_commit $testroot/repo -m "commit number $i" - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $testroot/repo)" done echo "G alpha" > $testroot/stdout.expected - echo "Merged commit $(pop_id 2 $ids)" >> $testroot/stdout.expected + echo "Merged commit $(pop_idx 2 $@)" >> $testroot/stdout.expected (cd "$testroot/wt" && got cy master:+ > $testroot/stdout) ret=$? @@ -2077,7 +2075,7 @@ test_cherrypick_commit_keywords() { (cd "$testroot/wt" && got rv alpha > /dev/null) echo "C gamma/delta" > $testroot/stdout.expected - echo "Merged commit $(pop_id 5 $ids)" >> $testroot/stdout.expected + echo "Merged commit $(pop_idx 5 $@)" >> $testroot/stdout.expected echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected (cd "$testroot/wt" && got cy branch-1:- > $testroot/stdout) blob - fa848632bdd2c520f0e5186a325f388de3cc8c4b blob + b8a5e77c0f11c353602927ca67ecfe4a36b243d0 --- regress/cmdline/common.sh +++ regress/cmdline/common.sh @@ -140,7 +140,7 @@ trim_obj_id() echo ${id%$pat} } -pop_id() +pop_idx() { shift "$1" printf '%s' "${1:-index-out-of-bounds}" blob - c4c9f0b2ff7a958007c590e9b66a21cb9ad13a07 blob + 40d362b35f6816f824c7f4f341e1ec65900ed41e --- regress/cmdline/diff.sh +++ regress/cmdline/diff.sh @@ -2024,6 +2024,8 @@ EOF test_diff_commit_keywords() { local testroot=`test_init diff_commit_keywords` + local repo="$testroot/repo" + local wt="$testroot/wt" got checkout $testroot/repo $testroot/wt > /dev/null ret=$? @@ -2033,9 +2035,9 @@ test_diff_commit_keywords() { return 1 fi - set -A ids "$(git_show_head $testroot/repo)" - set -A alpha_ids "$(get_blob_id $testroot/repo "" alpha)" - set -A beta_ids "$(get_blob_id $testroot/repo "" beta)" + set -- "$(git_show_head $repo)" + local alpha_ids="$(get_blob_id "$repo" "" alpha)" + local beta_ids="$(get_blob_id "$repo" "" beta)" for i in `seq 8`; do if [ $(( i % 2 )) -eq 0 ]; then @@ -2053,25 +2055,20 @@ test_diff_commit_keywords() { fi if [ $(( i % 2 )) -eq 0 ]; then - set -- "$alpha_ids" \ - "$(get_blob_id $testroot/repo "" alpha)" - alpha_ids=$* + alpha_ids="$alpha_ids $(get_blob_id "$repo" "" alpha)" else - set -- "$beta_ids" \ - "$(get_blob_id $testroot/repo "" beta)" - beta_ids=$* + beta_ids="$beta_ids $(get_blob_id "$repo" "" beta)" fi - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $repo)" done - echo "diff $(pop_id 7 $ids) $(pop_id 8 $ids)" > \ + echo "diff $(pop_idx 7 $@) $(pop_idx 8 $@)" > \ $testroot/stdout.expected - echo "commit - $(pop_id 7 $ids)" >> $testroot/stdout.expected - echo "commit + $(pop_id 8 $ids)" >> $testroot/stdout.expected - echo "blob - $(pop_id 4 $beta_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 5 $beta_ids)" >> $testroot/stdout.expected + echo "commit - $(pop_idx 7 $@)" >> $testroot/stdout.expected + echo "commit + $(pop_idx 8 $@)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 4 $beta_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected echo '--- beta' >> $testroot/stdout.expected echo '+++ beta' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected @@ -2102,12 +2099,12 @@ test_diff_commit_keywords() { return 1 fi - echo "diff $(pop_id 1 $ids) $(pop_id 2 $ids)" > \ + echo "diff $(pop_idx 1 $@) $(pop_idx 2 $@)" > \ $testroot/stdout.expected - echo "commit - $(pop_id 1 $ids)" >> $testroot/stdout.expected - echo "commit + $(pop_id 2 $ids)" >> $testroot/stdout.expected - echo "blob - $(pop_id 1 $beta_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 2 $beta_ids)" >> $testroot/stdout.expected + echo "commit - $(pop_idx 1 $@)" >> $testroot/stdout.expected + echo "commit + $(pop_idx 2 $@)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 1 $beta_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected echo '--- beta' >> $testroot/stdout.expected echo '+++ beta' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected @@ -2130,12 +2127,12 @@ test_diff_commit_keywords() { return 1 fi - echo "diff $(pop_id 3 $ids) $(pop_id 4 $ids)" > \ + echo "diff $(pop_idx 3 $@) $(pop_idx 4 $@)" > \ $testroot/stdout.expected - echo "commit - $(pop_id 3 $ids)" >> $testroot/stdout.expected - echo "commit + $(pop_id 4 $ids)" >> $testroot/stdout.expected - echo "blob - $(pop_id 2 $beta_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 3 $beta_ids)" >> $testroot/stdout.expected + echo "commit - $(pop_idx 3 $@)" >> $testroot/stdout.expected + echo "commit + $(pop_idx 4 $@)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 3 $beta_ids)" >> $testroot/stdout.expected echo '--- beta' >> $testroot/stdout.expected echo '+++ beta' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected @@ -2159,12 +2156,12 @@ test_diff_commit_keywords() { fi # if modifier extends beyond HEAD, we should use HEAD ref - echo "diff $(pop_id 8 $ids) $(pop_id 9 $ids)" > \ + echo "diff $(pop_idx 8 $@) $(pop_idx 9 $@)" > \ $testroot/stdout.expected - echo "commit - $(pop_id 8 $ids)" >> $testroot/stdout.expected - echo "commit + $(pop_id 9 $ids)" >> $testroot/stdout.expected - echo "blob - $(pop_id 4 $alpha_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 5 $alpha_ids)" >> $testroot/stdout.expected + echo "commit - $(pop_idx 8 $@)" >> $testroot/stdout.expected + echo "commit + $(pop_idx 9 $@)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 4 $alpha_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 5 $alpha_ids)" >> $testroot/stdout.expected echo '--- alpha' >> $testroot/stdout.expected echo '+++ alpha' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected @@ -2187,19 +2184,19 @@ test_diff_commit_keywords() { return 1 fi - echo "diff $(pop_id 3 $ids) $(pop_id 9 $ids)" > \ + echo "diff $(pop_idx 3 $@) $(pop_idx 9 $@)" > \ $testroot/stdout.expected - echo "commit - $(pop_id 3 $ids)" >> $testroot/stdout.expected - echo "commit + $(pop_id 9 $ids)" >> $testroot/stdout.expected - echo "blob - $(pop_id 2 $alpha_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 5 $alpha_ids)" >> $testroot/stdout.expected + echo "commit - $(pop_idx 3 $@)" >> $testroot/stdout.expected + echo "commit + $(pop_idx 9 $@)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 2 $alpha_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 5 $alpha_ids)" >> $testroot/stdout.expected echo '--- alpha' >> $testroot/stdout.expected echo '+++ alpha' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha change 2' >> $testroot/stdout.expected echo '+alpha change 8' >> $testroot/stdout.expected - echo "blob - $(pop_id 2 $beta_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 5 $beta_ids)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected echo '--- beta' >> $testroot/stdout.expected echo '+++ beta' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected @@ -2222,19 +2219,19 @@ test_diff_commit_keywords() { return 1 fi - echo "diff $(pop_id 6 $ids) $(pop_id 8 $ids)" > \ + echo "diff $(pop_idx 6 $@) $(pop_idx 8 $@)" > \ $testroot/stdout.expected - echo "commit - $(pop_id 6 $ids)" >> $testroot/stdout.expected - echo "commit + $(pop_id 8 $ids)" >> $testroot/stdout.expected - echo "blob - $(pop_id 3 $alpha_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 4 $alpha_ids)" >> $testroot/stdout.expected + echo "commit - $(pop_idx 6 $@)" >> $testroot/stdout.expected + echo "commit + $(pop_idx 8 $@)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 3 $alpha_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 4 $alpha_ids)" >> $testroot/stdout.expected echo '--- alpha' >> $testroot/stdout.expected echo '+++ alpha' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha change 4' >> $testroot/stdout.expected echo '+alpha change 6' >> $testroot/stdout.expected - echo "blob - $(pop_id 4 $beta_ids)" >> $testroot/stdout.expected - echo "blob + $(pop_id 5 $beta_ids)" >> $testroot/stdout.expected + echo "blob - $(pop_idx 4 $beta_ids)" >> $testroot/stdout.expected + echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected echo '--- beta' >> $testroot/stdout.expected echo '+++ beta' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected blob - 58e79bdb23ae3a08aa668ad20b439963c6eda8d1 blob + e2f69ad6bfabb6d873c7f6e79c7277eb9552ff14 --- regress/cmdline/log.sh +++ regress/cmdline/log.sh @@ -905,7 +905,7 @@ test_log_commit_keywords() { local commit_time=`git_show_author_time $testroot/repo` local d=`date -u -r $commit_time +"%G-%m-%d"` - set -A ids "$(git_show_head $testroot/repo)" + set -- "$(git_show_head $testroot/repo)" got checkout $testroot/repo $testroot/wt > /dev/null ret=$? @@ -925,13 +925,12 @@ test_log_commit_keywords() { test_done "$testroot" "$ret" return 1 fi - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $testroot/repo)" done for i in $(seq 16 2); do printf '%s %.7s commit number %s\n' \ - "$d" $(pop_id $i $ids) "$(( i-1 ))" \ + "$d" $(pop_idx $i $@) "$(( i-1 ))" \ >> $testroot/stdout.expected done @@ -957,10 +956,10 @@ test_log_commit_keywords() { for i in $(seq 9 2); do printf '%s %.7s commit number %s\n' \ - "$d" $(pop_id $i $ids) "$(( i-1 ))" \ + "$d" $(pop_idx $i $@) "$(( i-1 ))" \ >> $testroot/stdout.expected done - printf '%s %.7s adding the test tree\n' "$d" $(pop_id 1 $ids) >> \ + printf '%s %.7s adding the test tree\n' "$d" $(pop_idx 1 $@) >> \ $testroot/stdout.expected (cd $testroot/wt && got log -sc:base > $testroot/stdout) @@ -976,7 +975,7 @@ test_log_commit_keywords() { # if + modifier is too great, use HEAD commit printf '%s %-7s commit number %s\n' "$d" master 16 > \ $testroot/stdout.expected - printf '%s %.7s commit number %s\n' "$d" $(pop_id 16 $ids) 15 >> \ + printf '%s %.7s commit number %s\n' "$d" $(pop_idx 16 $@) 15 >> \ $testroot/stdout.expected (cd $testroot/wt && got log -sc:base:+20 -l2 > $testroot/stdout) @@ -990,7 +989,7 @@ test_log_commit_keywords() { fi # if - modifier is too great, use root commit - printf '%s %.7s adding the test tree\n' "$d" $(pop_id 1 $ids) > \ + printf '%s %.7s adding the test tree\n' "$d" $(pop_idx 1 $@) > \ $testroot/stdout.expected (cd $testroot/wt && got log -sc:base:-10 > $testroot/stdout) @@ -1002,9 +1001,9 @@ test_log_commit_keywords() { return 1 fi - got br -r "$testroot/repo" -c $(pop_id 1 $ids) base+ + got br -r "$testroot/repo" -c $(pop_idx 1 $@) base+ - printf '%s %.7s commit number 1\n' "$d" $(pop_id 2 $ids) > \ + printf '%s %.7s commit number 1\n' "$d" $(pop_idx 2 $@) > \ $testroot/stdout.expected (cd $testroot/wt && got log -scbase+:+ -l1 > $testroot/stdout) @@ -1017,9 +1016,9 @@ test_log_commit_keywords() { return 1 fi - got br -r "$testroot/repo" -c $(pop_id 3 $ids) head-1 + got br -r "$testroot/repo" -c $(pop_idx 3 $@) head-1 - printf '%s %.7s commit number 1\n' "$d" $(pop_id 2 $ids) > \ + printf '%s %.7s commit number 1\n' "$d" $(pop_idx 2 $@) > \ $testroot/stdout.expected (cd $testroot/wt && got log -schead-1:- -l1 > $testroot/stdout) @@ -1032,9 +1031,9 @@ test_log_commit_keywords() { return 1 fi - got br -r "$testroot/repo" -c $(pop_id 16 $ids) base-1+2 + got br -r "$testroot/repo" -c $(pop_idx 16 $@) base-1+2 - printf '%s %.7s commit number 12\n' "$d" $(pop_id 13 $ids) > \ + printf '%s %.7s commit number 12\n' "$d" $(pop_idx 13 $@) > \ $testroot/stdout.expected (cd $testroot/wt && got log -scbase-1+2:-3 -l1 > $testroot/stdout) blob - 40d49081040f0fd5396d77e82ad19b2f5c960858 blob + 0dcbb993cdc019b50ced407fa75909e73e435526 --- regress/cmdline/ref.sh +++ regress/cmdline/ref.sh @@ -462,8 +462,7 @@ test_ref_commit_keywords() { return 1 fi - set -- "$ids" "$(git_show_head $repo)" - ids=$* + set -- "$@" "$(git_show_head $repo)" done (cd "$wt" && got ref -c:head:-4 refs/heads/head-4) @@ -501,11 +500,11 @@ test_ref_commit_keywords() { echo "HEAD: refs/heads/master" > $testroot/stdout.expected echo -n "refs/got/worktree/base-" >> $testroot/stdout.expected cat "$wt/.got/uuid" | tr -d '\n' >> $testroot/stdout.expected - echo ": $(pop_id 4 $ids)" >> $testroot/stdout.expected - echo "refs/heads/base+2: $(pop_id 6 $ids)" >> $testroot/stdout.expected - echo "refs/heads/head-4: $(pop_id 4 $ids)" >> $testroot/stdout.expected - echo "refs/heads/master: $(pop_id 8 $ids)" >> $testroot/stdout.expected - echo "refs/heads/master-: $(pop_id 7 $ids)" >> $testroot/stdout.expected + echo ": $(pop_idx 4 $@)" >> $testroot/stdout.expected + echo "refs/heads/base+2: $(pop_idx 6 $@)" >> $testroot/stdout.expected + echo "refs/heads/head-4: $(pop_idx 4 $@)" >> $testroot/stdout.expected + echo "refs/heads/master: $(pop_idx 8 $@)" >> $testroot/stdout.expected + echo "refs/heads/master-: $(pop_idx 7 $@)" >> $testroot/stdout.expected got ref -r "$repo" -l > $testroot/stdout cmp -s $testroot/stdout $testroot/stdout.expected blob - 9c979ff35454c34d02151d8a65d66ad2cdf10d86 blob + 812f69b2eacd6f0c5c490042706348d24de55019 --- regress/cmdline/update.sh +++ regress/cmdline/update.sh @@ -3233,7 +3233,7 @@ test_update_umask() { test_update_commit_keywords() { local testroot=`test_init update_commit_keywords` - set -A ids "$(git_show_head $testroot/repo)" + set -- "$(git_show_head $testroot/repo)" got checkout $testroot/repo $testroot/wt > /dev/null ret=$? @@ -3257,8 +3257,7 @@ test_update_commit_keywords() { test_done "$testroot" "$ret" return 1 fi - set -- "$ids" "$(git_show_head $testroot/repo)" - ids=$* + set -- "$@" "$(git_show_head $testroot/repo)" done echo "got: reference base not found" > $testroot/stderr.expected @@ -3359,7 +3358,7 @@ test_update_commit_keywords() { echo "U alpha" > $testroot/stdout.expected echo "U beta" >> $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 7 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 7 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -c:base:-2 > $testroot/stdout) ret=$? @@ -3379,7 +3378,7 @@ test_update_commit_keywords() { echo "U beta" > $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 8 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 8 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -cmaster:- > $testroot/stdout) ret=$? @@ -3411,7 +3410,7 @@ test_update_commit_keywords() { echo "U alpha" > $testroot/stdout.expected echo "U beta" >> $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 2 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 2 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -c:base:-6 > $testroot/stdout) ret=$? @@ -3442,7 +3441,7 @@ test_update_commit_keywords() { echo "U alpha" > $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 3 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 3 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -c:base:+ > $testroot/stdout) ret=$? @@ -3474,7 +3473,7 @@ test_update_commit_keywords() { echo "U alpha" > $testroot/stdout.expected echo "U beta" >> $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 7 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 7 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -c:head:-2 > $testroot/stdout) ret=$? @@ -3507,7 +3506,7 @@ test_update_commit_keywords() { echo "U alpha" > $testroot/stdout.expected echo "U beta" >> $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 1 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 1 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -c:base:-20 > $testroot/stdout) ret=$? @@ -3540,7 +3539,7 @@ test_update_commit_keywords() { echo "U alpha" > $testroot/stdout.expected echo "U beta" >> $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected - echo $(pop_id 9 $ids) >> "$testroot/stdout.expected" + echo $(pop_idx 9 $@) >> "$testroot/stdout.expected" (cd $testroot/wt && got update -c:head:+10 > $testroot/stdout) ret=$? blob - a329dca28bf36978b73b04fe71d37578bfbc712f blob + 9f57e1d06d86371e2c8f959955561a8b2d951823 --- regress/tog/blame.sh +++ regress/tog/blame.sh @@ -85,8 +85,7 @@ test_blame_commit_keywords() local author_time=$(git_show_author_time "$repo") local ymd=$(date -u -r $author_time +"%G-%m-%d") - set -A ids "$id" - set -A short_ids "$(trim_obj_id 32 $id)" + set -- "$id" cat <<-EOF >$TOG_TEST_SCRIPT WAIT_FOR_UI wait for blame to finish @@ -115,7 +114,7 @@ test_blame_commit_keywords() cat <<-EOF >$testroot/view.expected commit $id [1/1] /alpha - $(pop_id 1 $short_ids) alpha + $(trim_obj_id 32 $(pop_idx 1 $@)) alpha @@ -165,10 +164,7 @@ test_blame_commit_keywords() fi id=$(git_show_head "$repo") - set -- "$ids" "$id" - ids=$* - set -- "$short_ids" "$(trim_obj_id 32 $id)" - short_ids=$* + set -- "$@" "$id" done author_time=$(git_show_author_time "$repo") @@ -176,15 +172,15 @@ test_blame_commit_keywords() # :base:- keyword in work tree cat <<-EOF >$testroot/view.expected - commit $(pop_id 8 $ids) + commit $(pop_idx 8 $@) [1/7] /alpha - $(pop_id 2 $short_ids) alpha 1 - $(pop_id 3 $short_ids) alpha 2 - $(pop_id 4 $short_ids) alpha 3 - $(pop_id 5 $short_ids) alpha 4 - $(pop_id 6 $short_ids) alpha 5 - $(pop_id 7 $short_ids) alpha 6 - $(pop_id 8 $short_ids) alpha 7 + $(trim_obj_id 32 $(pop_idx 2 $@)) alpha 1 + $(trim_obj_id 32 $(pop_idx 3 $@)) alpha 2 + $(trim_obj_id 32 $(pop_idx 4 $@)) alpha 3 + $(trim_obj_id 32 $(pop_idx 5 $@)) alpha 4 + $(trim_obj_id 32 $(pop_idx 6 $@)) alpha 5 + $(trim_obj_id 32 $(pop_idx 7 $@)) alpha 6 + $(trim_obj_id 32 $(pop_idx 8 $@)) alpha 7 EOF @@ -206,12 +202,12 @@ test_blame_commit_keywords() # :head:-4 keyword in work tree cat <<-EOF >$testroot/view.expected - commit $(pop_id 5 $ids) + commit $(pop_idx 5 $@) [1/4] /alpha - $(pop_id 2 $short_ids) alpha 1 - $(pop_id 3 $short_ids) alpha 2 - $(pop_id 4 $short_ids) alpha 3 - $(pop_id 5 $short_ids) alpha 4 + $(trim_obj_id 32 $(pop_idx 2 $@)) alpha 1 + $(trim_obj_id 32 $(pop_idx 3 $@)) alpha 2 + $(trim_obj_id 32 $(pop_idx 4 $@)) alpha 3 + $(trim_obj_id 32 $(pop_idx 5 $@)) alpha 4 @@ -236,12 +232,12 @@ test_blame_commit_keywords() # :base:+2 keyword in work tree cat <<-EOF >$testroot/view.expected - commit $(pop_id 5 $ids) + commit $(pop_idx 5 $@) [1/4] /alpha - $(pop_id 2 $short_ids) alpha 1 - $(pop_id 3 $short_ids) alpha 2 - $(pop_id 4 $short_ids) alpha 3 - $(pop_id 5 $short_ids) alpha 4 + $(trim_obj_id 32 $(pop_idx 2 $@)) alpha 1 + $(trim_obj_id 32 $(pop_idx 3 $@)) alpha 2 + $(trim_obj_id 32 $(pop_idx 4 $@)) alpha 3 + $(trim_obj_id 32 $(pop_idx 5 $@)) alpha 4 @@ -273,9 +269,9 @@ test_blame_commit_keywords() # master:-99 keyword in work tree cat <<-EOF >$testroot/view.expected - commit $(pop_id 1 $ids) + commit $(pop_idx 1 $@) [1/1] /alpha - $(pop_id 1 $short_ids) alpha + $(trim_obj_id 32 $(pop_idx 1 $@)) alpha blob - 38287ad91c7e0eeaf2c7f133935f5622968b42dd blob + 479afa04f1c6c1a787ee26b12295c42f732bfa08 --- regress/tog/diff.sh +++ regress/tog/diff.sh @@ -212,10 +212,10 @@ test_diff_commit_keywords() local wt="$testroot/wt" local id=$(git_show_head "$repo") local author_time=$(git_show_author_time "$repo") + local ids="$id" + local alpha_ids="$(get_blob_id "$repo" "" alpha)" - set -A ids "$id" - set -A alpha_ids $(get_blob_id "$repo" "" alpha) - set -A dates "$author_time" + set -- "$author_time" got checkout "$repo" "$wt" > /dev/null ret=$? @@ -240,12 +240,9 @@ test_diff_commit_keywords() fi id=$(git_show_head "$repo") - set -- "$ids" "$id" - ids=$* - set -- "$alpha_ids" "$(get_blob_id "$repo" "" alpha)" - alpha_ids=$* - set -- "$dates" $(git_show_author_time "$repo") - dates=$* + ids="$ids $id" + alpha_ids="$alpha_ids $(get_blob_id "$repo" "" alpha)" + set -- "$@" $(git_show_author_time "$repo") done cat <<-EOF >$TOG_TEST_SCRIPT @@ -253,9 +250,9 @@ test_diff_commit_keywords() EOF # diff consecutive commits with keywords - local lhs_id=$(pop_id 1 $ids) - local rhs_id=$(pop_id 2 $ids) - local date=$(date -u -r $(pop_id 2 $dates) +"%a %b %e %X %Y UTC") + local lhs_id=$(pop_idx 1 $ids) + local rhs_id=$(pop_idx 2 $ids) + local date=$(date -u -r $(pop_idx 2 $@) +"%a %b %e %X %Y UTC") cat <<-EOF >$testroot/view.expected [1/20] diff $lhs_id $rhs_id @@ -271,8 +268,8 @@ test_diff_commit_keywords() commit - $lhs_id commit + $rhs_id - blob - $(pop_id 1 $alpha_ids) - blob + $(pop_id 2 $alpha_ids) + blob - $(pop_idx 1 $alpha_ids) + blob + $(pop_idx 2 $alpha_ids) --- alpha +++ alpha @@ -1 +1 @@ @@ -294,15 +291,15 @@ test_diff_commit_keywords() fi # diff arbitrary commits with keywords - lhs_id=$(pop_id 5 $ids) - rhs_id=$(pop_id 8 $ids) + lhs_id=$(pop_idx 5 $ids) + rhs_id=$(pop_idx 8 $ids) cat <<-EOF >$testroot/view.expected [1/10] diff $lhs_id $rhs_id commit - $lhs_id commit + $rhs_id - blob - $(pop_id 5 $alpha_ids) - blob + $(pop_id 8 $alpha_ids) + blob - $(pop_idx 5 $alpha_ids) + blob + $(pop_idx 8 $alpha_ids) --- alpha +++ alpha @@ -1 +1 @@ @@ -334,9 +331,9 @@ test_diff_commit_keywords() fi # diff consecutive commits using keywords with -r repository - lhs_id=$(pop_id 8 $ids) - rhs_id=$(pop_id 9 $ids) - date=$(date -u -r $(pop_id 9 $dates) +"%a %b %e %X %Y UTC") + lhs_id=$(pop_idx 8 $ids) + rhs_id=$(pop_idx 9 $ids) + date=$(date -u -r $(pop_idx 9 $@) +"%a %b %e %X %Y UTC") cat <<-EOF >$testroot/view.expected [1/20] diff $lhs_id refs/heads/master @@ -352,8 +349,8 @@ test_diff_commit_keywords() commit - $lhs_id commit + $rhs_id - blob - $(pop_id 8 $alpha_ids) - blob + $(pop_id 9 $alpha_ids) + blob - $(pop_idx 8 $alpha_ids) + blob + $(pop_idx 9 $alpha_ids) --- alpha +++ alpha @@ -1 +1 @@ blob - a7c92801a63e2df3de71afd808cde146986b7efc blob + c9e0f9386c09837c4f369034ac78348d9c7f2abd --- regress/tog/log.sh +++ regress/tog/log.sh @@ -363,8 +363,7 @@ test_log_commit_keywords() local author_time=$(git_show_author_time "$repo") local ymd=$(date -u -r $author_time +"%G-%m-%d") - set -A ids "$id" - set -A short_ids "$(trim_obj_id 32 $id)" + set -- "$id" got checkout "$repo" "$wt" > /dev/null ret=$? @@ -390,10 +389,7 @@ test_log_commit_keywords() fi id=$(git_show_head "$repo") - set -- "$ids" "$id" - ids=$* - set -- "$short_ids" "$(trim_obj_id 32 $id)" - short_ids=$* + set -- "$@" "$id" done cat <<-EOF >$TOG_TEST_SCRIPT @@ -402,12 +398,12 @@ test_log_commit_keywords() EOF cat <<-EOF >$testroot/view.expected - commit $(pop_id 5 $ids) [1/5] - $ymd $(pop_id 5 $short_ids) flan_hacker commit 4 - $ymd $(pop_id 4 $short_ids) flan_hacker commit 3 - $ymd $(pop_id 3 $short_ids) flan_hacker commit 2 - $ymd $(pop_id 2 $short_ids) flan_hacker commit 1 - $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree + commit $(pop_idx 5 $@) [1/5] + $ymd $(trim_obj_id 32 $(pop_idx 5 $@)) flan_hacker commit 4 + $ymd $(trim_obj_id 32 $(pop_idx 4 $@)) flan_hacker commit 3 + $ymd $(trim_obj_id 32 $(pop_idx 3 $@)) flan_hacker commit 2 + $ymd $(trim_obj_id 32 $(pop_idx 2 $@)) flan_hacker commit 1 + $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree @@ -424,14 +420,14 @@ test_log_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 7 $ids) [1/7] - $ymd $(pop_id 7 $short_ids) flan_hacker commit 6 - $ymd $(pop_id 6 $short_ids) flan_hacker commit 5 - $ymd $(pop_id 5 $short_ids) flan_hacker commit 4 - $ymd $(pop_id 4 $short_ids) flan_hacker commit 3 - $ymd $(pop_id 3 $short_ids) flan_hacker commit 2 - $ymd $(pop_id 2 $short_ids) flan_hacker commit 1 - $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree + commit $(pop_idx 7 $@) [1/7] + $ymd $(trim_obj_id 32 $(pop_idx 7 $@)) flan_hacker commit 6 + $ymd $(trim_obj_id 32 $(pop_idx 6 $@)) flan_hacker commit 5 + $ymd $(trim_obj_id 32 $(pop_idx 5 $@)) flan_hacker commit 4 + $ymd $(trim_obj_id 32 $(pop_idx 4 $@)) flan_hacker commit 3 + $ymd $(trim_obj_id 32 $(pop_idx 3 $@)) flan_hacker commit 2 + $ymd $(trim_obj_id 32 $(pop_idx 2 $@)) flan_hacker commit 1 + $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree EOF @@ -446,12 +442,12 @@ test_log_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 5 $ids) [1/5] - $ymd $(pop_id 5 $short_ids) flan_hacker commit 4 - $ymd $(pop_id 4 $short_ids) flan_hacker commit 3 - $ymd $(pop_id 3 $short_ids) flan_hacker ~commit 2 - $ymd $(pop_id 2 $short_ids) flan_hacker commit 1 - $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree + commit $(pop_idx 5 $@) [1/5] + $ymd $(trim_obj_id 32 $(pop_idx 5 $@)) flan_hacker commit 4 + $ymd $(trim_obj_id 32 $(pop_idx 4 $@)) flan_hacker commit 3 + $ymd $(trim_obj_id 32 $(pop_idx 3 $@)) flan_hacker ~commit 2 + $ymd $(trim_obj_id 32 $(pop_idx 2 $@)) flan_hacker commit 1 + $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree @@ -476,8 +472,8 @@ test_log_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 1 $ids) [1/1] - $ymd $(pop_id 1 $short_ids) flan_hacker adding the test tree + commit $(pop_idx 1 $@) [1/1] + $ymd $(trim_obj_id 32 $(pop_idx 1 $@)) flan_hacker adding the test tree blob - ab5481d9ca9da400e86ac14e7511cf21b1e24863 blob + dde6b39fc273ac652a3183be4339de99d649addc --- regress/tog/tree.sh +++ regress/tog/tree.sh @@ -185,7 +185,7 @@ test_tree_commit_keywords() local wt="$testroot/wt" local id=$(git_show_head "$repo") - set -A ids "$id" + set -- "$id" got checkout "$repo" "$wt" > /dev/null ret=$? @@ -215,8 +215,7 @@ test_tree_commit_keywords() fi id=$(git_show_head "$repo") - set -- "$ids" "$id" - ids=$* + set -- "$@" "$id" done @@ -225,7 +224,7 @@ test_tree_commit_keywords() EOF cat <<-EOF >$testroot/view.expected - commit $(pop_id 8 $ids) + commit $(pop_idx 8 $@) [1/7] / alpha @@ -248,7 +247,7 @@ test_tree_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 6 $ids) + commit $(pop_idx 6 $@) [1/6] / alpha @@ -271,7 +270,7 @@ test_tree_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 9 $ids) + commit $(pop_idx 9 $@) [1/8] / alpha @@ -295,7 +294,7 @@ test_tree_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 4 $ids) + commit $(pop_idx 4 $@) [1/5] / alpha @@ -318,7 +317,7 @@ test_tree_commit_keywords() fi cat <<-EOF >$testroot/view.expected - commit $(pop_id 1 $ids) + commit $(pop_idx 1 $@) [1/4] / alpha