commit f73bf5bd9e54af999a744c731dfb492e1c9b2b6d from: Christian Weisgerber date: Sun Oct 01 22:50:43 2023 UTC replace "(cd path && git cmd)" with "git -C path cmd" This matches the existing use of "got -r path cmd" and "git_commit path args". commit - 107723488a685ddd492f1539cfc13a88a4c34ca1 commit + f73bf5bd9e54af999a744c731dfb492e1c9b2b6d blob - 31567d2fc90dcccd8d23c81bc042414e05d514b1 blob + 55a49c904e9d8a41678453f55fcedc15a081516f --- regress/cmdline/add.sh +++ regress/cmdline/add.sh @@ -377,9 +377,9 @@ test_add_clashes_with_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' got checkout $testroot/repo $testroot/wt > /dev/null blob - 76bc77fd0afea94f3494da3f05e3f617d0019853 blob + 1da1bae6d4b501b17d00e4ab519191174f617fcf --- regress/cmdline/backout.sh +++ regress/cmdline/backout.sh @@ -252,13 +252,13 @@ test_backout_logmsg_ref() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "commit changes on newbranch" local commit_time=`git_show_author_time $testroot/repo` @@ -368,12 +368,12 @@ test_backout_logmsg_ref() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch2) + git -C $testroot/repo checkout -q -b newbranch2 echo "modified delta on branch2" > $testroot/repo/gamma/delta echo "modified alpha on branch2" > $testroot/repo/alpha echo "new file on branch2" > $testroot/repo/epsilon/new2 - (cd $testroot/repo && git add epsilon/new2) + git -C $testroot/repo add epsilon/new2 git_commit $testroot/repo -m "commit changes on newbranch2" local b2_commit_time=`git_show_author_time $testroot/repo` blob - 709d4ccef8fe3657aabd7178ce86cd34b6abd820 blob + 58bd8cfd19c7fe4497faed3ae1bc31b8c288fc98 --- regress/cmdline/blame.sh +++ regress/cmdline/blame.sh @@ -23,9 +23,9 @@ blame_cmp() { (cd $testroot/wt && got blame "$file" | cut -d ' ' -f 2 \ > $testroot/${file}.blame.got) - (cd $testroot/repo && git reset --hard master > /dev/null) - (cd $testroot/repo && git blame "$file" | cut -d ' ' -f 1 \ - > $testroot/${file}.blame.git) + git -C $testroot/repo reset --hard master > /dev/null + git -C $testroot/repo blame "$file" | cut -d ' ' -f 1 \ + > $testroot/${file}.blame.git cmp -s $testroot/${file}.blame.git $testroot/${file}.blame.got ret=$? @@ -101,7 +101,7 @@ test_blame_tag() { (cd $testroot/wt && got commit -m "change 2" > /dev/null) local commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git tag -a -m "test" $tag) + git -C $testroot/repo tag -a -m "test" $tag echo 3 >> $testroot/wt/alpha (cd $testroot/wt && got commit -m "change 3" > /dev/null) @@ -744,9 +744,9 @@ test_blame_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' # Attempt a (nonsensical) blame of a submodule. got blame -r $testroot/repo repo2 \ @@ -779,7 +779,7 @@ test_blame_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` blob - 32ca2931e3071c10d03c698a6c1fbac3f2513eeb blob + 6b14508b86ae76b06c4b422f9dddcb726e665798 --- regress/cmdline/branch.sh +++ regress/cmdline/branch.sh @@ -30,7 +30,7 @@ test_branch_create() { fi # Ensure that Git recognizes the branch Got has created - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -66,7 +66,7 @@ test_branch_create() { return 1 fi - (cd $testroot/repo && git checkout -q anotherbranch) + git -C $testroot/repo checkout -q anotherbranch ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -82,7 +82,7 @@ test_branch_create() { return 1 fi - (cd $testroot/repo && git checkout -q yetanotherbranch) + git -C $testroot/repo checkout -q yetanotherbranch ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -100,7 +100,7 @@ test_branch_create() { return 1 fi - (cd $testroot/repo && git checkout -q commitbranch) + git -C $testroot/repo checkout -q commitbranch ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -394,7 +394,7 @@ test_branch_delete_packed() { fi done - (cd $testroot/repo && git pack-refs --all) + git -C $testroot/repo pack-refs --all got branch -d refs/heads/branch2 -r $testroot/repo > $testroot/stdout ret=$? blob - 5a8e3fca28fe70ffe66034d95186576fce8f8100 blob + 9d71d8d52004f89383a535be68110b0dbb61be97 --- regress/cmdline/cat.sh +++ regress/cmdline/cat.sh @@ -207,9 +207,9 @@ test_cat_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' got cat -r $testroot/repo repo2 > $testroot/stdout \ > $testroot/stdout 2> $testroot/stderr @@ -237,10 +237,10 @@ test_cat_submodule_of_same_repo() { local author_time=`git_show_author_time $testroot/repo` local gmtoff=`date +%z` - (cd $testroot && git clone -q repo repo2 >/dev/null) - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot clone -q repo repo2 >/dev/null + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' # 'got cat' shows the commit object which the submodule points to # because a commit with the same ID exists in the outer repository @@ -272,7 +272,7 @@ test_cat_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local alpha_link_id=`got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | cut -d' ' -f 1` blob - 95f34afe31e5991bc2dfc22ad99e44cdd23832cc blob + f5b8de097637f7d3a470a2430dce513a1cc859f8 --- regress/cmdline/checkout.sh +++ regress/cmdline/checkout.sh @@ -219,7 +219,7 @@ test_checkout_sets_xbit() { touch $testroot/repo/xfile chmod +x $testroot/repo/xfile - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding executable file" local commit_id=`git_show_head $testroot/repo` @@ -255,7 +255,7 @@ test_checkout_sets_xbit() { test_checkout_commit_from_wrong_branch() { local testroot=`test_init checkout_commit_from_wrong_branch` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on new branch" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha on new branch" @@ -301,7 +301,7 @@ test_checkout_tag() { local commit_id=`git_show_head $testroot/repo` local tag="1.0.0" - (cd $testroot/repo && git tag -a -m "test" $tag) + git -C $testroot/repo tag -a -m "test" $tag echo "A $testroot/wt/alpha" > $testroot/stdout.expected echo "A $testroot/wt/beta" >> $testroot/stdout.expected @@ -346,9 +346,9 @@ test_checkout_ignores_submodules() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' local commit_id=`git_show_head $testroot/repo` echo "A $testroot/wt/.gitmodules" > $testroot/stdout.expected @@ -614,7 +614,7 @@ test_checkout_symlink() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -s .got/foo dotgotfoo.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id=`git_show_head $testroot/repo` @@ -762,7 +762,7 @@ test_checkout_symlink_relative_wtpath() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -s .got/foo dotgotfoo.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" (cd $testroot && got checkout $testroot/repo wt > /dev/null) @@ -863,10 +863,8 @@ test_checkout_symlink_relative_wtpath() { test_checkout_repo_with_unknown_extension() { local testroot=`test_init checkout_repo_with_unknown_extension` - (cd $testroot/repo && - git config --add extensions.badExtension foobar) - (cd $testroot/repo && - git config --add extensions.otherBadExtension 0) + git -C $testroot/repo config --add extensions.badExtension foobar + git -C $testroot/repo config --add extensions.otherBadExtension 0 echo "got: badExtension: unsupported repository format extension" \ > $testroot/stderr.expected blob - 01c492937e9b0b533e2d98b5ab40a43cf5e03129 blob + 009d3307e4bb52ea5a0921669a3507a59bc86a19 --- regress/cmdline/cherrypick.sh +++ regress/cmdline/cherrypick.sh @@ -26,14 +26,14 @@ test_cherrypick_basic() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local branch_rev=`git_show_head $testroot/repo` @@ -134,14 +134,14 @@ test_cherrypick_root_commit() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git rm -q alpha) - (cd $testroot/repo && git rm -q beta) - (cd $testroot/repo && git rm -q epsilon/zeta) - (cd $testroot/repo && git rm -q gamma/delta) + git -C $testroot/repo checkout -q -b newbranch + git -C $testroot/repo rm -q alpha + git -C $testroot/repo rm -q beta + git -C $testroot/repo rm -q epsilon/zeta + git -C $testroot/repo rm -q gamma/delta mkdir -p $testroot/repo/epsilon echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing on newbranch" echo "modified new file on branch" >> $testroot/repo/epsilon/new @@ -196,14 +196,14 @@ test_cherrypick_into_work_tree_with_conflicts() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local branch_rev=`git_show_head $testroot/repo` @@ -280,13 +280,13 @@ test_cherrypick_into_work_tree_with_mixed_commits() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local branch_rev=`git_show_head $testroot/repo` @@ -330,19 +330,19 @@ test_cherrypick_modified_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' got checkout $testroot/repo $testroot/wt > /dev/null echo "modified foo" > $testroot/repo2/foo - (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule') + git -C $testroot/repo2 commit -q -a -m 'modified a submodule' - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch # Update the repo/repo2 submodule link on newbranch - (cd $testroot/repo && git -C repo2 pull -q) - (cd $testroot/repo && git add repo2) + git -C $testroot/repo/repo2 pull -q + git -C $testroot/repo add repo2 git_commit $testroot/repo -m "modified submodule link" local commit_id=`git_show_head $testroot/repo` @@ -367,10 +367,10 @@ test_cherrypick_added_submodule() { make_single_file_repo $testroot/repo2 foo # Add the repo/repo2 submodule on newbranch - (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo checkout -q -b newbranch + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' local commit_id=`git_show_head $testroot/repo` (cd $testroot/wt && got cherrypick $commit_id > $testroot/stdout) @@ -404,10 +404,10 @@ test_cherrypick_conflict_wt_file_vs_repo_submodule() { make_single_file_repo $testroot/repo2 foo # Add the repo/repo2 submodule on newbranch - (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo checkout -q -b newbranch + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' local commit_id=`git_show_head $testroot/repo` # Modify the clashing file such that any modifications brought @@ -447,7 +447,7 @@ test_cherrypick_modified_symlinks() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` @@ -482,9 +482,9 @@ EOF (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link) (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) (cd $testroot/repo && ln -sf .got/foo $testroot/repo/dotgotfoo.link) - (cd $testroot/repo && git rm -q nonexistent.link) + git -C $testroot/repo rm -q nonexistent.link (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "change symlinks" local commit_id2=`git_show_head $testroot/repo` @@ -651,7 +651,7 @@ test_cherrypick_symlink_conflicts() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` @@ -661,10 +661,10 @@ test_cherrypick_symlink_conflicts() { (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link (cd $testroot/repo && ln -sf .got/bar dotgotbar.link) - (cd $testroot/repo && git rm -q nonexistent.link) + git -C $testroot/repo rm -q nonexistent.link (cd $testroot/repo && ln -sf gamma/delta zeta.link) (cd $testroot/repo && ln -sf alpha new.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "change symlinks" local commit_id2=`git_show_head $testroot/repo` @@ -927,14 +927,14 @@ test_cherrypick_symlink_conflicts() { test_cherrypick_with_path_prefix_and_empty_tree() { local testroot=`test_init cherrypick_with_path_prefix_and_empty_tree 1` - (cd $testroot/repo && git commit --allow-empty \ - -m "initial empty commit" >/dev/null) + git -C $testroot/repo commit --allow-empty \ + -m "initial empty commit" >/dev/null (cd $testroot/repo && got br bar >/dev/null) mkdir -p $testroot/repo/epsilon echo "file foo" > $testroot/repo/epsilon/foo - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add file foo" local commit_id=`git_show_head $testroot/repo` @@ -978,7 +978,7 @@ test_cherrypick_conflict_no_eol() { local content_c="aaa\naaa\nccc\naaa\naaa\naaa\naaa" printf "$content_a" > $testroot/repo/a - (cd $testroot/repo && git add a) + git -C $testroot/repo add a git_commit $testroot/repo -m "initial commit" (cd $testroot/repo && got branch newbranch) @@ -1018,7 +1018,7 @@ test_cherrypick_conflict_no_eol2() { local content_c="aaa\naaa\nbbb\naaa\naaa\naaa\n" printf "$content_a" > $testroot/repo/a - (cd $testroot/repo && git add a) + git -C $testroot/repo add a git_commit $testroot/repo -m "initial commit" (cd $testroot/repo && got branch newbranch) @@ -1314,7 +1314,7 @@ got_ref_list_free(struct got_reflist_head *refs) } } EOF - (cd $testroot/repo && git add reference.c) + git -C $testroot/repo add reference.c git_commit $testroot/repo -m "added reference.c file" local base_commit=`git_show_head $testroot/repo` @@ -1325,7 +1325,7 @@ EOF return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch ed -s $testroot/repo/reference.c < $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local branch_rev=`git_show_head $testroot/repo` @@ -1438,7 +1438,7 @@ test_cherrypick_dot_on_a_line_by_itself() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch printf "modified\n:delta\n.\non\n:branch\n" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" local branch_rev=`git_show_head $testroot/repo` @@ -1736,13 +1736,13 @@ test_cherrypick_logmsg_ref() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "commit changes on newbranch" local commit_time=`git_show_author_time $testroot/repo` @@ -1852,12 +1852,12 @@ test_cherrypick_logmsg_ref() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch2) + git -C $testroot/repo checkout -q -b newbranch2 echo "modified delta on branch2" > $testroot/repo/gamma/delta echo "modified alpha on branch2" > $testroot/repo/alpha echo "new file on branch2" > $testroot/repo/epsilon/new2 - (cd $testroot/repo && git add epsilon/new2) + git -C $testroot/repo add epsilon/new2 git_commit $testroot/repo -m "commit changes on newbranch2" local b2_commit_time=`git_show_author_time $testroot/repo` @@ -2033,7 +2033,7 @@ test_cherrypick_commit_keywords() { set -- "$(git_show_head $testroot/repo)" - (cd $testroot/repo && git checkout -q -b branch-1) + git -C $testroot/repo checkout -q -b branch-1 got checkout $testroot/repo $testroot/wt > /dev/null ret=$? blob - f4a50c06198ba6fd2e8397c44a51a8aaa92817d3 blob + 0e7cf31f819a9e93d3c0add3720b63ae6d10314b --- regress/cmdline/cleanup.sh +++ regress/cmdline/cleanup.sh @@ -267,11 +267,11 @@ test_cleanup_redundant_pack_files() { gotadmin pack -a -r "$testroot/repo" >/dev/null # create another one with unreachable objects - (cd "$testroot/repo" && git checkout -q -b tempbranch) + git -C "$testroot/repo" checkout -q -b tempbranch echo "modified alpha on tempbranch" >$testroot/repo/alpha git_commit "$testroot/repo" -m "edit alpha on tempbranch" gotadmin pack -a -r "$testroot/repo" >/dev/null - (cd "$testroot/repo" && git checkout -q master) + git -C "$testroot/repo" checkout -q master (cd "$testroot/repo" && got branch -d tempbranch) >/dev/null gotadmin cleanup -a -q -r "$testroot/repo" @@ -314,7 +314,7 @@ test_cleanup_redundant_pack_files() { rm "${kpack%.pack}.keep" # create some commits on a separate branch - (cd "$testroot/repo" && git checkout -q -b newbranch) + git -C "$testroot/repo" checkout -q -b newbranch for i in `jot 5`; do echo "alpha $i" > $testroot/repo/alpha @@ -339,7 +339,7 @@ test_cleanup_precious_objects() { local testroot=`test_init cleanup_precious_objects` # enable Git's preciousObjects extension - (cd $testroot/repo && git config extensions.preciousObjects true) + git -C $testroot/repo config extensions.preciousObjects true # cleanup should now refuse to purge objects gotadmin cleanup -a -q -r $testroot/repo > $testroot/stdout \ blob - 69a9a2773510acc956e60ec5b87ae8aad43b8d8c blob + 5f92bc4c5f41eaab6b2619e4a75bc863402edc0c --- regress/cmdline/commit.sh +++ regress/cmdline/commit.sh @@ -818,8 +818,8 @@ test_commit_tree_entry_sorting() { (cd $testroot/wt && got commit -m 'test' > /dev/null) # Let git-fsck verify the newly written tree to make sure Git is happy - (cd $testroot/repo && git fsck --strict \ - > $testroot/fsck.stdout 2> $testroot/fsck.stderr) + git -C $testroot/repo fsck --strict \ + > $testroot/fsck.stdout 2> $testroot/fsck.stderr ret=$? test_done "$testroot" "$ret" } @@ -949,8 +949,8 @@ test_commit_gitconfig_author() { return 1 fi - (cd $testroot/repo && git config user.name 'Flan Luck') - (cd $testroot/repo && git config user.email 'flan_luck@openbsd.org') + git -C $testroot/repo config user.name 'Flan Luck' + git -C $testroot/repo config user.email 'flan_luck@openbsd.org' echo "modified alpha" > $testroot/wt/alpha @@ -1208,9 +1208,9 @@ test_commit_with_unrelated_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' got checkout $testroot/repo $testroot/wt > /dev/null ret=$? @@ -1826,7 +1826,7 @@ test_commit_logmsg_ref() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch local bo_logmsg_prefix="log message of backed-out commit" local cy_logmsg_prefix="log message of cherrypicked commit" @@ -1835,9 +1835,9 @@ test_commit_logmsg_ref() { echo "modified delta on branch" > $testroot/repo/gamma/delta echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "$branch_rev_logmsg" local branch_rev=`git_show_head $testroot/repo` blob - b8a5e77c0f11c353602927ca67ecfe4a36b243d0 blob + 71ea0ee33dae3502cf4dfa1bea98349ce6c16039 --- regress/cmdline/common.sh +++ regress/cmdline/common.sh @@ -66,7 +66,7 @@ git_commit() { local repo="$1" shift - (cd $repo && git commit --author="$GOT_AUTHOR" -q -a "$@") + git -C $repo commit --author="$GOT_AUTHOR" -q -a "$@" maybe_pack_repo $repo } @@ -74,27 +74,27 @@ git_rm() { local repo="$1" shift - (cd $repo && git rm -q "$@") + git -C $repo rm -q "$@" } git_rmdir() { local repo="$1" shift - (cd $repo && git rm -q -r "$@") + git -C $repo rm -q -r "$@" } git_show_head() { local repo="$1" - (cd $repo && git show --no-patch --pretty='format:%H') + git -C $repo show --no-patch --pretty='format:%H' } git_show_branch_head() { local repo="$1" local branch="$2" - (cd $repo && git show --no-patch --pretty='format:%H' $branch) + git -C $repo show --no-patch --pretty='format:%H' $branch } @@ -102,28 +102,28 @@ git_show_author_time() { local repo="$1" local object="$2" - (cd $repo && git show --no-patch --pretty='format:%at' $object) + git -C $repo show --no-patch --pretty='format:%at' $object } git_show_tagger_time() { local repo="$1" local tag="$2" - (cd $repo && git cat-file tag $tag | grep ^tagger | \ - sed -e "s/^tagger $GOT_AUTHOR//" | cut -d' ' -f2) + git -C $repo cat-file tag $tag | grep ^tagger | \ + sed -e "s/^tagger $GOT_AUTHOR//" | cut -d' ' -f2 } git_show_parent_commit() { local repo="$1" local commit="$2" - (cd $repo && git show --no-patch --pretty='format:%P' $commit) + git -C $repo show --no-patch --pretty='format:%P' $commit } git_show_tree() { local repo="$1" - (cd $repo && git show --no-patch --pretty='format:%T') + git -C $repo show --no-patch --pretty='format:%T' } trim_obj_id() @@ -151,7 +151,7 @@ git_commit_tree() local repo="$1" local msg="$2" local tree="$3" - (cd $repo && git commit-tree -m "$msg" "$tree") + git -C $repo commit-tree -m "$msg" "$tree" } git_fsck() @@ -159,8 +159,8 @@ git_fsck() local testroot="$1" local repo="$2" - (cd $repo && git fsck --strict \ - > $testroot/fsck.stdout 2> $testroot/fsck.stderr) + git -C $repo fsck --strict \ + > $testroot/fsck.stdout 2> $testroot/fsck.stderr ret=$? if [ $ret -ne 0 ]; then echo -n "git fsck: " @@ -192,7 +192,7 @@ make_single_file_repo() mkdir $repo git_init $repo echo "this is file $file" > $repo/$file - (cd $repo && git add .) + git -C $repo add . git_commit $repo -m "intialize $repo with file $file" } @@ -229,7 +229,7 @@ test_init() git_init $testroot/repo if [ -z "$no_tree" ]; then make_test_tree $testroot/repo - (cd $repo && git add .) + git -C $repo add . git_commit $testroot/repo -m "adding the test tree" fi touch $testroot/repo/.git/git-daemon-export-ok blob - f24be2ec6def2b1c4206a2f88553c21f47ae2eb9 blob + 59243b5c07792da8486b3128282d07cd79ae5bbe --- regress/cmdline/diff.sh +++ regress/cmdline/diff.sh @@ -432,7 +432,7 @@ test_diff_shows_conflict() { echo "6" >> $testroot/repo/numbers echo "7" >> $testroot/repo/numbers echo "8" >> $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local base_commit=`git_show_head $testroot/repo` @@ -529,14 +529,14 @@ test_diff_tag() { git_commit $testroot/repo -m "changed alpha" local commit_id1=`git_show_head $testroot/repo` - (cd $testroot/repo && git tag -m "test" $tag1) + git -C $testroot/repo tag -m "test" $tag1 echo "new file" > $testroot/repo/new - (cd $testroot/repo && git add new) + git -C $testroot/repo add new git_commit $testroot/repo -m "new file" local commit_id2=`git_show_head $testroot/repo` - (cd $testroot/repo && git tag -m "test" $tag2) + git -C $testroot/repo tag -m "test" $tag2 echo "diff $commit_id0 refs/tags/$tag1" > $testroot/stdout.expected echo "commit - $commit_id0" >> $testroot/stdout.expected @@ -594,14 +594,14 @@ test_diff_lightweight_tag() { git_commit $testroot/repo -m "changed alpha" local commit_id1=`git_show_head $testroot/repo` - (cd $testroot/repo && git tag $tag1) + git -C $testroot/repo tag $tag1 echo "new file" > $testroot/repo/new - (cd $testroot/repo && git add new) + git -C $testroot/repo add new git_commit $testroot/repo -m "new file" local commit_id2=`git_show_head $testroot/repo` - (cd $testroot/repo && git tag $tag2) + git -C $testroot/repo tag $tag2 echo "diff $commit_id0 refs/tags/$tag1" > $testroot/stdout.expected echo "commit - $commit_id0" >> $testroot/stdout.expected @@ -683,10 +683,10 @@ test_diff_ignore_whitespace() { test_diff_submodule_of_same_repo() { local testroot=`test_init diff_submodule_of_same_repo` - (cd $testroot && git clone -q repo repo2 >/dev/null) - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot clone -q repo repo2 >/dev/null + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' epsilon_id=$(got tree -r $testroot/repo -i | grep 'epsilon/$' | \ cut -d ' ' -f 1) @@ -723,7 +723,7 @@ test_diff_symlinks_in_work_tree() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -s .got/foo dotgotfoo.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` @@ -829,7 +829,7 @@ test_diff_symlinks_in_repo() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -s .got/foo dotgotfoo.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` @@ -837,9 +837,9 @@ test_diff_symlinks_in_repo() { (cd $testroot/repo && rm epsilon.link && ln -s gamma epsilon.link) (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) (cd $testroot/repo && ln -sf .got/bar $testroot/repo/dotgotfoo.link) - (cd $testroot/repo && git rm -q nonexistent.link) + git -C $testroot/repo rm -q nonexistent.link (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "change symlinks" local commit_id2=`git_show_head $testroot/repo` @@ -1810,7 +1810,7 @@ test_diff_file_to_dir() { git_rm $testroot/repo alpha mkdir $testroot/repo/alpha echo eta > $testroot/repo/alpha/eta - (cd $testroot/repo && git add alpha/eta) + git -C $testroot/repo add alpha/eta git_commit $testroot/repo -m "changed alpha into directory" local commit_id1=`git_show_head $testroot/repo` local alpha_eta_blobid=`get_blob_id $testroot/repo alpha eta` @@ -1893,7 +1893,7 @@ test_diff_dir_to_file() { git_rmdir $testroot/repo epsilon echo epsilon > $testroot/repo/epsilon - (cd $testroot/repo && git add epsilon) + git -C $testroot/repo add epsilon git_commit $testroot/repo -m "changed epsilon into file" local commit_id1=`git_show_head $testroot/repo` local epsilon_blobid=`get_blob_id $testroot/repo "" epsilon` blob - f7c13d273418faebbf6a5954344c0c7ced9da08c blob + 4f75fc02d6a40ac31f5851218e869d2b5526e031 --- regress/cmdline/dump.sh +++ regress/cmdline/dump.sh @@ -32,7 +32,7 @@ test_dump_bundle() { return 1 fi - if ! (cd "$testroot" && git clone -b master -q r.bundle); then + if ! git -C "$testroot" clone -b master -q r.bundle; then echo "failed to git clone from the generated bundle" >&2 test_done "$testroot" 1 return 1 @@ -51,7 +51,7 @@ test_dump_bundle() { return 1 fi - (cd "$testroot/repo" && git checkout -q -b newbranch) + git -C "$testroot/repo" checkout -q -b newbranch # commit some changes in the repo for i in `seq 5`; do @@ -67,8 +67,8 @@ test_dump_bundle() { return 1 fi - (cd "$testroot/r" && git checkout -q -b newbranch && \ - git pull -q "$testroot/r.bundle" newbranch) + git -C "$testroot/r" checkout -q -b newbranch && \ + git -C "$testroot/r" pull -q "$testroot/r.bundle" newbranch if [ $? -ne 0 ]; then echo "git pull failed unexpectedly" >&2 test_done "$testroot" 1 blob - 43b93382975fd45e5fa0e500f6a776d9343347c1 blob + bc9c071363d678f9caf6ad6317ddab429ffee389 --- regress/cmdline/fetch.sh +++ regress/cmdline/fetch.sh @@ -183,7 +183,7 @@ test_fetch_branch() { git_commit $testroot/repo -m "modified alpha" local commit_id2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q foo) + git -C $testroot/repo checkout -q foo echo "modified alpha on foo" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha" local commit_id3=`git_show_head $testroot/repo` @@ -315,7 +315,7 @@ test_fetch_branch() { local commit_id4=`git_show_head $testroot/repo` # set the default HEAD branch back to master - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master got checkout -b foo $testroot/repo-clone $testroot/wt > /dev/null @@ -366,11 +366,11 @@ test_fetch_branch() { EOF # make another change on 'foo' and fetch it without got.conf - (cd $testroot/repo && git checkout -q foo) + git -C $testroot/repo checkout -q foo echo "modified beta on foo agan" > $testroot/repo/beta git_commit $testroot/repo -m "modified beta" local commit_id5=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master # fetch new commits on branch 'foo', implicitly obtaining the # branch name from a work tree @@ -475,13 +475,13 @@ test_fetch_all() { diff -u $testroot/stdout.expected $testroot/stdout fi - (cd $testroot/repo && git checkout -q foo) + git -C $testroot/repo checkout -q foo echo "modified beta on foo" > $testroot/repo/beta git_commit $testroot/repo -m "modified beta" local commit_id2=`git_show_head $testroot/repo` # set the default HEAD branch back to master - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master # remove default branch from got.conf, fetch all branches ed -s $testroot/repo-clone/got.conf <<-EOF @@ -980,11 +980,11 @@ test_fetch_reference() { git_commit $testroot/repo -m "modified alpha" local commit_id2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q foo) + git -C $testroot/repo checkout -q foo echo "modified alpha on foo" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha" local commit_id3=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master got fetch -q -r $testroot/repo-clone -R refs/remotes/origin/main \ > $testroot/stdout 2> $testroot/stderr @@ -1486,18 +1486,18 @@ test_fetch_honor_wt_conf_bflag() { local commit_id=`git_show_head $testroot/repo` got branch -r $testroot/repo -c $commit_id boo - (cd $testroot/repo && git checkout -q boo) + git -C $testroot/repo checkout -q boo echo "modified beta on boo" > $testroot/repo/beta git_commit $testroot/repo -m "modified beta" local commit_id2=`git_show_head $testroot/repo` got branch -r $testroot/repo -c $commit_id2 hoo - (cd $testroot/repo && git checkout -q hoo) + git -C $testroot/repo checkout -q hoo echo "modified delta on hoo" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "modified delta" local commit_id3=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master got clone -q $testurl/repo $testroot/repo-clone ret=$? if [ $ret -ne 0 ]; then @@ -1547,7 +1547,7 @@ test_fetch_honor_wt_conf_bflag() { return 1 fi - (cd $testroot/repo && git checkout -q boo) + git -C $testroot/repo checkout -q boo # clone has remote/origin/HEAD symref with "master" as its target # but the repo has changed HEAD to "boo", so we should fetch "boo" echo "HEAD: refs/heads/master" > $testroot/stdout.expected @@ -1709,7 +1709,7 @@ test_fetch_honor_wt_conf_bflag() { git_commit $testroot/repo -m "modified delta" local commit_id4=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master got checkout -b boo $testroot/repo-clone $testroot/wt > /dev/null (cd $testroot/wt && got fetch -q > $testroot/stdout) @@ -1764,12 +1764,12 @@ test_fetch_honor_wt_conf_bflag() { git_commit $testroot/repo -m "modified delta on master" local commit_id5=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q boo) + git -C $testroot/repo checkout -q boo echo "modified alpha on boo" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha on boo" local commit_id6=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q hoo) + git -C $testroot/repo checkout -q hoo echo "modified beta on hoo" > $testroot/repo/beta git_commit $testroot/repo -m "modified beta on hoo" local commit_id7=`git_show_head $testroot/repo` @@ -1815,7 +1815,7 @@ test_fetch_honor_wt_conf_bflag() { # from wt: fetch -b hoo not got.conf "master" or wt "boo" or # repo HEAD "boo" - (cd $testroot/repo && git checkout -q boo) + git -C $testroot/repo checkout -q boo echo "modified alpha again on boo" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha again on boo" local commit_id8=`git_show_head $testroot/repo` blob - 5ef42917a9efb422c5a96479122b03533f9019bc blob + a8c20c791a546fc257c69e471cb4ff9e59cd4d66 --- regress/cmdline/histedit.sh +++ regress/cmdline/histedit.sh @@ -23,9 +23,9 @@ test_histedit_no_op() { local orig_author_time=`git_show_author_time $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` local old_author_time1=`git_show_author_time $testroot/repo` @@ -238,9 +238,9 @@ test_histedit_swap() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -360,9 +360,9 @@ test_histedit_drop() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -470,9 +470,9 @@ test_histedit_fold() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -585,9 +585,9 @@ test_histedit_edit() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -730,9 +730,9 @@ test_histedit_fold_last_commit() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -777,9 +777,9 @@ test_histedit_missing_commit() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -824,9 +824,9 @@ test_histedit_abort() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -1227,9 +1227,9 @@ test_histedit_fold_last_commit_swap() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -1292,9 +1292,9 @@ test_histedit_split_commit() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes 1" local old_commit1=`git_show_head $testroot/repo` local short_old_commit1=`trim_obj_id 28 $old_commit1` @@ -1398,9 +1398,9 @@ test_histedit_duplicate_commit_in_script() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes 1" local old_commit1=`git_show_head $testroot/repo` @@ -1451,7 +1451,7 @@ test_histedit_fold_add_delete() { local orig_commit=`git_show_head $testroot/repo` echo "added new file epsilon/psi" > $testroot/repo/epsilon/psi - (cd $testroot/repo && git add epsilon/psi) + git -C $testroot/repo add epsilon/psi git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -1459,7 +1459,7 @@ test_histedit_fold_add_delete() { git_commit $testroot/repo -m "editing psi" local old_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git rm -q epsilon/psi) + git -C $testroot/repo rm -q epsilon/psi git_commit $testroot/repo -m "removing psi" local old_commit3=`git_show_head $testroot/repo` @@ -1550,7 +1550,7 @@ test_histedit_fold_edit_delete() { local orig_commit=`git_show_head $testroot/repo` echo "modify alpha" > $testroot/repo/alpha - (cd $testroot/repo && git add alpha) + git -C $testroot/repo add alpha git_commit $testroot/repo -m "modified alpha" local old_commit1=`git_show_head $testroot/repo` @@ -1629,12 +1629,12 @@ test_histedit_fold_delete_add() { local orig_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git rm -q alpha) + git -C $testroot/repo rm -q alpha git_commit $testroot/repo -m "removing alpha" local old_commit1=`git_show_head $testroot/repo` echo "modified alpha" >$testroot/repo/alpha - (cd $testroot/repo && git add alpha) + git -C $testroot/repo add alpha git_commit $testroot/repo -m "add back modified alpha" local old_commit2=`git_show_head $testroot/repo` @@ -1699,9 +1699,9 @@ test_histedit_fold_only() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -1818,9 +1818,9 @@ test_histedit_fold_only_empty_logmsg() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -1939,9 +1939,9 @@ test_histedit_edit_only() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -2148,9 +2148,9 @@ test_histedit_mesg_invalid() { local orig_commit=`git_show_head $testroot/repo` echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m 'committing changes' local old_commit1=`git_show_head $testroot/repo` @@ -2489,9 +2489,9 @@ test_histedit_drop_only() { local dropmsg="commit changes to drop" echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "$dropmsg 1" local drop_commit1=`git_show_head $testroot/repo` blob - 614c0254175714f853d026e00d9c0330ef34b33a blob + 3deea57b8d4424f745a81ebe3900dbf4632bd8d7 --- regress/cmdline/import.sh +++ regress/cmdline/import.sh @@ -277,7 +277,7 @@ test_import_detached_head() { local testroot=`test_init import_detached_head` # mute verbose 'detached HEAD' warning - (cd $testroot/repo && git config --local advice.detachedHead false) + git -C $testroot/repo config --local advice.detachedHead false ret=$? if [ $ret -ne 0 ]; then test_done "$testroot" "$ret" @@ -286,8 +286,8 @@ test_import_detached_head() { # enter detached HEAD state local head_commit=`git_show_head $testroot/repo | cut -c1-7` - (cd $testroot/repo && \ - git checkout $head_commit > $testroot/stdout 2> $testroot/stderr) + git -C $testroot/repo checkout $head_commit \ + > $testroot/stdout 2> $testroot/stderr ret=$? if [ $ret -ne 0 ]; then test_done "$testroot" "$ret" @@ -317,8 +317,8 @@ test_import_detached_head() { return 1 fi - local main_commit=`(cd $testroot/repo && \ - git show-ref main | cut -d ' ' -f 1)` + local main_commit=`git -C $testroot/repo show-ref main | \ + cut -d ' ' -f 1` echo "A $testroot/import/gamma/delta" > $testroot/stdout.expected echo "A $testroot/import/epsilon/zeta" >> $testroot/stdout.expected echo "A $testroot/import/alpha" >> $testroot/stdout.expected blob - 22184fffc887851e4b8c369a306088ffc4bf4686 blob + ccba2603a3aa69bd7de8eff0d30822576810bc01 --- regress/cmdline/init.sh +++ regress/cmdline/init.sh @@ -24,7 +24,7 @@ test_init_basic() { gotadmin init $testroot/repo - local git_head=`(cd $testroot/repo && git symbolic-ref HEAD)` + local git_head=`git -C $testroot/repo symbolic-ref HEAD` echo $git_head > $testroot/content echo refs/heads/$headref > $testroot/content.expected cmp -s $testroot/content.expected $testroot/content @@ -44,7 +44,7 @@ test_init_specified_head() { gotadmin init -b $headref $testroot/repo - local git_head=`(cd $testroot/repo && git symbolic-ref HEAD)` + local git_head=`git -C $testroot/repo symbolic-ref HEAD` echo refs/heads/$headref > $testroot/content.expected echo $git_head > $testroot/content cmp -s $testroot/content.expected $testroot/content blob - fea0fbd0c0b880d3f283fc17453e349290b0a480 blob + c57691ca2631de000f749d2c7fcb80c7ba746eec --- regress/cmdline/integrate.sh +++ regress/cmdline/integrate.sh @@ -19,20 +19,20 @@ test_integrate_basic() { local testroot=`test_init integrate_basic` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -52,7 +52,7 @@ test_integrate_basic() { return 1 fi - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` @@ -154,25 +154,25 @@ test_integrate_requires_rebase_first() { local testroot=`test_init integrate_requires_rebase_first` local init_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` @@ -258,20 +258,20 @@ test_integrate_requires_rebase_first() { test_integrate_path_prefix() { local testroot=`test_init integrate_path_prefix` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -291,7 +291,7 @@ test_integrate_path_prefix() { return 1 fi - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` @@ -321,20 +321,20 @@ test_integrate_path_prefix() { test_integrate_backwards_in_time() { local testroot=`test_init integrate_backwards_in_time` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -354,7 +354,7 @@ test_integrate_backwards_in_time() { return 1 fi - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` blob - 70bf269325f1dc66d6be29ef5f6b010108cfb01a blob + 50222a69eaa0c608bf4501525a4ccd51cfe0aa70 --- regress/cmdline/load.sh +++ regress/cmdline/load.sh @@ -20,7 +20,7 @@ test_load_bundle() { local testroot=`test_init test_load_bundle` # generate a bundle with all the history of the repository - (cd "$testroot/repo" && git bundle create -q "$testroot/bundle" master) + git -C "$testroot/repo" bundle create -q "$testroot/bundle" master # then load it in an empty repository (cd "$testroot/" && gotadmin init -b master repo2) >/dev/null @@ -45,8 +45,8 @@ test_load_bundle() { echo "modified alpha in master" >$testroot/repo/alpha git_commit "$testroot/repo" -m "edit alpha in master" - (cd "$testroot/repo" && git bundle create -q \ - "$testroot/bundle" "$base..master") + git -C "$testroot/repo" bundle create -q \ + "$testroot/bundle" "$base..master" (cd "$testroot/repo2" && gotadmin load < "$testroot/bundle") >/dev/null if [ $? -ne 0 ]; then @@ -74,7 +74,7 @@ test_load_branch_from_bundle() { master_commit="$(git_show_head "$testroot/repo")" - (cd "$testroot/repo" && git checkout -q -b newbranch) + git -C "$testroot/repo" checkout -q -b newbranch for i in `seq 1`; do echo "alpha edit #$i" > $testroot/repo/alpha blob - 853ae57628cf6cdee057c1be172a74f5600d337e blob + 4721d314c761fef6ff7f1dfe3ff55d52e6d39216 --- regress/cmdline/log.sh +++ regress/cmdline/log.sh @@ -76,7 +76,7 @@ test_log_in_worktree() { make_test_tree $testroot/repo mkdir -p $testroot/repo/epsilon/d echo foo > $testroot/repo/epsilon/d/foo - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding the test tree" local head_commit=`git_show_head $testroot/repo` @@ -191,7 +191,7 @@ test_log_tag() { return 1 fi - (cd $testroot/repo && git tag -a -m "test" $tag) + git -C $testroot/repo tag -a -m "test" $tag echo "commit $commit_id (master, tags/$tag)" > $testroot/stdout.expected (cd $testroot/wt && got log -l1 -c $tag | grep ^commit \ @@ -205,7 +205,7 @@ test_log_tag() { fi # test a "lightweight" tag - (cd $testroot/repo && git tag $tag2) + git -C $testroot/repo tag $tag2 echo "commit $commit_id (master, tags/$tag, tags/$tag2)" \ > $testroot/stdout.expected @@ -666,7 +666,7 @@ test_log_in_worktree_different_repo() { make_test_tree $testroot/repo mkdir -p $testroot/repo/epsilon/d echo foo > $testroot/repo/epsilon/d/foo - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding the test tree" local head_commit=`git_show_head $testroot/repo` @@ -774,9 +774,9 @@ test_log_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' local head_commit=`git_show_head $testroot/repo` echo "commit $head_commit (master)" > $testroot/stdout.expected @@ -823,11 +823,11 @@ test_log_submodule() { fi echo "modified foo" > $testroot/repo2/foo - (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule') + git -C $testroot/repo2 commit -q -a -m 'modified a submodule' # Update the repo/repo2 submodule link - (cd $testroot/repo && git -C repo2 pull -q) - (cd $testroot/repo && git add repo2) + git -C $testroot/repo/repo2 pull -q + git -C $testroot/repo add repo2 git_commit $testroot/repo -m "changed submodule link" # log -P does not show the changed submodule path blob - a7908e3851266c3fe538eb4321c3fab455fc0d8d blob + dbe3024c2ef524f9153d2084c07158bbf936910e --- regress/cmdline/merge.sh +++ regress/cmdline/merge.sh @@ -21,7 +21,7 @@ test_merge_basic() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" local branch_commit0=`git_show_branch_head $testroot/repo newbranch` @@ -29,18 +29,19 @@ test_merge_basic() { echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit1=`git_show_branch_head $testroot/repo newbranch` - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing beta on newbranch" local branch_commit2=`git_show_branch_head $testroot/repo newbranch` echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "adding new file on newbranch" local branch_commit3=`git_show_branch_head $testroot/repo newbranch` - (cd $testroot/repo && ln -s alpha symlink && git add symlink) + (cd $testroot/repo && ln -s alpha symlink) + git -C $testroot/repo add symlink git_commit $testroot/repo -m "adding symlink on newbranch" local branch_commit4=`git_show_branch_head $testroot/repo newbranch` (cd $testroot/repo && ln -sf .got/bar dotgotbar.link) - (cd $testroot/repo && git add dotgotbar.link) + git -C $testroot/repo add dotgotbar.link git_commit $testroot/repo -m "adding a bad symlink on newbranch" local branch_commit5=`git_show_branch_head $testroot/repo newbranch` @@ -53,7 +54,7 @@ test_merge_basic() { fi # create a divergent commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -357,7 +358,7 @@ test_merge_forward() { git_commit $testroot/repo -m "common commit" local commit1=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified beta on branch" > $testroot/repo/beta git_commit $testroot/repo -m "committing to beta on newbranch" local commit2=`git_show_head $testroot/repo` @@ -474,7 +475,7 @@ test_merge_forward_commit() { local testroot=`test_init merge_forward_commit` local commit0=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local commit1=`git_show_head $testroot/repo` @@ -530,7 +531,7 @@ test_merge_forward_interrupt() { local testroot=`test_init merge_forward_commit` local commit0=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local commit1=`git_show_head $testroot/repo` @@ -602,8 +603,8 @@ test_merge_backward() { local testroot=`test_init merge_backward` local commit0=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q -b newbranch + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" @@ -639,7 +640,7 @@ test_merge_continue() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" local branch_commit0=`git_show_branch_head $testroot/repo newbranch` @@ -647,11 +648,11 @@ test_merge_continue() { echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit1=`git_show_branch_head $testroot/repo newbranch` - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing beta on newbranch" local branch_commit2=`git_show_branch_head $testroot/repo newbranch` echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "adding new file on newbranch" local branch_commit3=`git_show_branch_head $testroot/repo newbranch` @@ -664,7 +665,7 @@ test_merge_continue() { fi # create a conflicting commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -858,11 +859,11 @@ test_merge_continue_new_commit() { # changed since the merge was started, to avoid clobbering the changes. local testroot=`test_init merge_continue_new_commit` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" @@ -919,7 +920,7 @@ test_merge_abort() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" local branch_commit0=`git_show_branch_head $testroot/repo newbranch` @@ -927,14 +928,15 @@ test_merge_abort() { echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit1=`git_show_branch_head $testroot/repo newbranch` - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing beta on newbranch" local branch_commit2=`git_show_branch_head $testroot/repo newbranch` echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "adding new file on newbranch" local branch_commit3=`git_show_branch_head $testroot/repo newbranch` - (cd $testroot/repo && ln -s alpha symlink && git add symlink) + (cd $testroot/repo && ln -s alpha symlink) + git -C $testroot/repo add symlink git_commit $testroot/repo -m "adding symlink on newbranch" local branch_commit4=`git_show_branch_head $testroot/repo newbranch` @@ -950,7 +952,7 @@ test_merge_abort() { touch $testroot/wt/unversioned-file # create a conflicting commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -1125,7 +1127,7 @@ test_merge_in_progress() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit0=`git_show_branch_head $testroot/repo newbranch` @@ -1139,7 +1141,7 @@ test_merge_in_progress() { fi # create a conflicting commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -1234,7 +1236,7 @@ test_merge_path_prefix() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit0=`git_show_branch_head $testroot/repo newbranch` @@ -1249,7 +1251,7 @@ test_merge_path_prefix() { fi # create a conflicting commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -1288,7 +1290,7 @@ test_merge_missing_file() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to alpha and delta" @@ -1303,8 +1305,8 @@ test_merge_missing_file() { fi # create a conflicting commit which renames alpha - (cd $testroot/repo && git checkout -q master) - (cd $testroot/repo && git mv alpha epsilon/alpha-moved) + git -C $testroot/repo checkout -q master + git -C $testroot/repo mv alpha epsilon/alpha-moved git_commit $testroot/repo -m "moving alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -1372,7 +1374,7 @@ test_merge_no_op() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit=`git_show_branch_head $testroot/repo newbranch` @@ -1386,7 +1388,7 @@ test_merge_no_op() { fi # create a conflicting commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -1569,10 +1571,10 @@ EOF fi # update the 'files' branch - (cd $testroot/repo && git reset -q --hard master) - (cd $testroot/repo && git checkout -q files) + git -C $testroot/repo reset -q --hard master + git -C $testroot/repo checkout -q files echo "indeed" > $testroot/repo/indeed - (cd $testroot/repo && git add indeed) + git -C $testroot/repo add indeed git_commit $testroot/repo -m "adding another file indeed" echo "be lots and lots of" > $testroot/repo/be/lots/of git_commit $testroot/repo -m "lots of changes" @@ -1614,7 +1616,7 @@ test_merge_interrupt() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local branch_commit0=`git_show_branch_head $testroot/repo newbranch` @@ -1628,7 +1630,7 @@ test_merge_interrupt() { fi # create a non-conflicting commit - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified beta on master" > $testroot/repo/beta git_commit $testroot/repo -m "committing to beta on master" local master_commit=`git_show_head $testroot/repo` @@ -1759,14 +1761,14 @@ test_merge_interrupt() { test_merge_umask() { local testroot=`test_init merge_umask` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" >$testroot/repo/alpha git_commit "$testroot/repo" -m "committing alpha on newbranch" echo "modified delta on branch" >$testroot/repo/gamma/delta git_commit "$testroot/repo" -m "committing delta on newbranch" # diverge from newbranch - (cd "$testroot/repo" && git checkout -q master) + git -C "$testroot/repo" checkout -q master echo "modified beta on master" >$testroot/repo/beta git_commit "$testroot/repo" -m "committing zeto no master" @@ -1790,17 +1792,17 @@ test_merge_umask() { test_merge_gitconfig_author() { local testroot=`test_init merge_gitconfig_author` - (cd $testroot/repo && git config user.name 'Flan Luck') - (cd $testroot/repo && git config user.email 'flan_luck@openbsd.org') + git -C $testroot/repo config user.name 'Flan Luck' + git -C $testroot/repo config user.email 'flan_luck@openbsd.org' - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" >$testroot/repo/alpha git_commit "$testroot/repo" -m "committing alpha on newbranch" echo "modified delta on branch" >$testroot/repo/gamma/delta git_commit "$testroot/repo" -m "committing delta on newbranch" # diverge from newbranch - (cd "$testroot/repo" && git checkout -q master) + git -C "$testroot/repo" checkout -q master echo "modified beta on master" >$testroot/repo/beta git_commit "$testroot/repo" -m "committing zeto no master" blob - f95aac7980de13e20863266dcd1ae971cb702364 blob + d4500f1b7676ed3946c82efc8e8d7f50755569bc --- regress/cmdline/patch.sh +++ regress/cmdline/patch.sh @@ -1365,8 +1365,8 @@ test_patch_merge_gitdiff() { local testroot=`test_init patch_merge_gitdiff` jot 10 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers && \ - git_commit $testroot/repo -m "nums") + git -C $testroot/repo add numbers && \ + git_commit $testroot/repo -m "nums" ret=$? if [ $ret -ne 0 ]; then test_done $testroot $ret @@ -1374,7 +1374,7 @@ test_patch_merge_gitdiff() { fi jot 10 | sed 's/4/four/g' > $testroot/repo/numbers - (cd $testroot/repo && git diff > $testroot/old.diff) + git -C $testroot/repo diff > $testroot/old.diff ret=$? if [ $ret -ne 0 ]; then test_done $testroot $ret @@ -1385,8 +1385,8 @@ test_patch_merge_gitdiff() { jot 10 > $testroot/repo/numbers jot 10 | sed 's/6/six/g' > $testroot/repo/numbers - (cd $testroot/repo && git add numbers && \ - git_commit $testroot/repo -m "edit") + git -C $testroot/repo add numbers && \ + git_commit $testroot/repo -m "edit" ret=$? if [ $ret -ne 0 ]; then test_done $testroot $ret @@ -1921,7 +1921,7 @@ test_patch_remove_binary_file() { # try again using a git produced diff (cd $testroot/wt && got revert x) >/dev/null - (cd $testroot/repo && git show demo) >$testroot/wt/patch + git -C $testroot/repo show demo >$testroot/wt/patch (cd $testroot/wt && got patch $testroot/stdout if [ $? -ne 0 ]; then blob - 1d339f654c90ee75c99eac9cc5a7f39e8b6275ce blob + bec03a3f9a01f0d363aee654100fd1f0280b1d9d --- regress/cmdline/rebase.sh +++ regress/cmdline/rebase.sh @@ -21,21 +21,21 @@ test_rebase_basic() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` local orig_author_time2=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -49,7 +49,7 @@ test_rebase_basic() { (cd $testroot/wt && got rebase newbranch > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` local new_author_time2=`git_show_author_time $testroot/repo` @@ -240,7 +240,7 @@ test_rebase_ancestry_check() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" local newbranch_id=`git_show_head $testroot/repo` @@ -276,13 +276,13 @@ test_rebase_continue() { local testroot=`test_init rebase_continue` local init_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local orig_commit1=`git_show_head $testroot/repo` local short_orig_commit1=`trim_obj_id 28 $orig_commit1` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -377,7 +377,7 @@ test_rebase_continue() { (cd $testroot/wt && got unstage alpha > /dev/null) (cd $testroot/wt && got rebase -c > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_head $testroot/repo` local short_new_commit1=`trim_obj_id 28 $new_commit1` @@ -412,7 +412,7 @@ test_rebase_abort() { local init_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified beta on branch" > $testroot/repo/beta git_commit $testroot/repo -m "committing to beta on newbranch" local orig_commit1=`git_show_head $testroot/repo` @@ -420,13 +420,13 @@ test_rebase_abort() { echo "modified alpha on branch" > $testroot/repo/alpha echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo \ -m "changing alpha and adding new on newbranch" local orig_commit2=`git_show_head $testroot/repo` local short_orig_commit2=`trim_obj_id 28 $orig_commit2` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -515,7 +515,7 @@ test_rebase_abort() { (cd $testroot/wt && got rebase -a > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch echo "Switching work tree to refs/heads/master" \ > $testroot/stdout.expected @@ -605,13 +605,13 @@ test_rebase_no_op_change() { local testroot=`test_init rebase_no_op_change` local init_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local orig_commit1=`git_show_head $testroot/repo` local short_orig_commit1=`trim_obj_id 28 $orig_commit1` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -683,7 +683,7 @@ test_rebase_no_op_change() { (cd $testroot/wt && got rebase -c > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_head $testroot/repo` echo -n "$short_orig_commit1 -> no-op change" \ @@ -717,13 +717,13 @@ test_rebase_in_progress() { local testroot=`test_init rebase_in_progress` local init_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on branch" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on newbranch" local orig_commit1=`git_show_head $testroot/repo` local short_orig_commit1=`trim_obj_id 28 $orig_commit1` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -822,14 +822,14 @@ test_rebase_in_progress() { test_rebase_path_prefix() { local testroot=`test_init rebase_path_prefix` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -875,7 +875,7 @@ test_rebase_path_prefix() { (cd $testroot/wt2 && got rebase newbranch \ > $testroot/stdout 2> $testroot/stderr) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` @@ -920,7 +920,7 @@ test_rebase_path_prefix() { test_rebase_preserves_logmsg() { local testroot=`test_init rebase_preserves_logmsg` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "modified delta on newbranch" @@ -933,7 +933,7 @@ test_rebase_preserves_logmsg() { local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -948,7 +948,7 @@ test_rebase_preserves_logmsg() { (cd $testroot/wt && got rebase newbranch > /dev/null \ 2> $testroot/stderr) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` @@ -1242,25 +1242,25 @@ test_rebase_out_of_date() { local testroot=`test_init rebase_out_of_date` local initial_commit=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit1=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified beta on master" > $testroot/repo/beta git_commit $testroot/repo -m "committing to beta on master" local master_commit2=`git_show_head $testroot/repo` @@ -1311,17 +1311,17 @@ test_rebase_out_of_date() { test_rebase_trims_empty_dir() { local testroot=`test_init rebase_trims_empty_dir` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" - (cd $testroot/repo && git rm -q epsilon/zeta) + git -C $testroot/repo rm -q epsilon/zeta git_commit $testroot/repo -m "removing zeta on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified alpha on master" > $testroot/repo/alpha git_commit $testroot/repo -m "committing to alpha on master" local master_commit=`git_show_head $testroot/repo` @@ -1335,7 +1335,7 @@ test_rebase_trims_empty_dir() { (cd $testroot/wt && got rebase newbranch > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` @@ -1418,7 +1418,7 @@ test_rebase_delete_missing_file() { mkdir -p $testroot/repo/d/f/g echo "new file" > $testroot/repo/d/f/g/new - (cd $testroot/repo && git add d/f/g/new) + git -C $testroot/repo add d/f/g/new git_commit $testroot/repo -m "adding a subdir" local commit0=`git_show_head $testroot/repo` @@ -1434,7 +1434,7 @@ test_rebase_delete_missing_file() { (cd $testroot/wt && got commit \ -m "removing beta and d/f/g/new on newbranch" > /dev/null) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` @@ -1446,7 +1446,7 @@ test_rebase_delete_missing_file() { (cd $testroot/wt && got commit \ -m "removing beta and d/f/g/new on master" > /dev/null) - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master local master_commit=`git_show_head $testroot/repo` (cd $testroot/wt && got update -b master > /dev/null) @@ -1545,7 +1545,7 @@ test_rebase_delete_missing_file() { return 1 fi - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_head $testroot/repo` local short_new_commit1=`trim_obj_id 28 $new_commit1` @@ -1564,21 +1564,21 @@ test_rebase_delete_missing_file() { test_rebase_rm_add_rm_file() { local testroot=`test_init rebase_rm_add_rm_file` - (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo checkout -q -b newbranch + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing beta from newbranch" local orig_commit1=`git_show_head $testroot/repo` echo 'restored beta' > $testroot/repo/beta - (cd $testroot/repo && git add beta) + git -C $testroot/repo add beta git_commit $testroot/repo -m "restoring beta on newbranch" local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing beta from newbranch again" local orig_commit3=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -1601,12 +1601,12 @@ test_rebase_rm_add_rm_file() { return 1 fi - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit3=`git_show_head $testroot/repo` local new_commit2=`git_show_parent_commit $testroot/repo` local new_commit1=`git_show_parent_commit $testroot/repo $new_commit2` - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local short_orig_commit1=`trim_obj_id 28 $orig_commit1` local short_orig_commit2=`trim_obj_id 28 $orig_commit2` @@ -1674,7 +1674,7 @@ test_rebase_resets_committer() { local commit0_author_time=`git_show_author_time $testroot/repo` local committer="Flan Luck " - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" @@ -1685,7 +1685,7 @@ test_rebase_resets_committer() { local orig_commit2=`git_show_head $testroot/repo` local orig_author_time2=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -1700,7 +1700,7 @@ test_rebase_resets_committer() { (cd $testroot/wt && env GOT_AUTHOR="$committer" \ got rebase newbranch > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` local new_author_time2=`git_show_author_time $testroot/repo` @@ -1762,7 +1762,7 @@ test_rebase_no_author_info() { local commit0_author_time=`git_show_author_time $testroot/repo` local committer="$GOT_AUTHOR" - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" @@ -1773,7 +1773,7 @@ test_rebase_no_author_info() { local orig_commit2=`git_show_head $testroot/repo` local orig_author_time2=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -1789,7 +1789,7 @@ test_rebase_no_author_info() { (unset GOT_AUTHOR && cd $testroot/wt && \ got rebase newbranch > $testroot/stdout) - (cd $testroot/repo && git checkout -q newbranch) + git -C $testroot/repo checkout -q newbranch local new_commit1=`git_show_parent_commit $testroot/repo` local new_commit2=`git_show_head $testroot/repo` local new_author_time2=`git_show_author_time $testroot/repo` @@ -1920,7 +1920,7 @@ test_rebase_out_of_date2() { local commit0=`git_show_head $testroot/repo` local commit0_author_time=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" @@ -1928,7 +1928,7 @@ test_rebase_out_of_date2() { local orig_commit2=`git_show_head $testroot/repo` local orig_author_time2=`git_show_author_time $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` blob - 0dcbb993cdc019b50ced407fa75909e73e435526 blob + f19cabc30854c8e77db6d827d2b8ed078c8362f5 --- regress/cmdline/ref.sh +++ regress/cmdline/ref.sh @@ -39,7 +39,7 @@ test_ref_create() { fi # Ensure that Git recognizes the ref Got has created - (cd $testroot/repo && git checkout -q newref) + git -C $testroot/repo checkout -q newref ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -64,7 +64,7 @@ test_ref_create() { return 1 fi - (cd $testroot/repo && git checkout -q anotherref) + git -C $testroot/repo checkout -q anotherref ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -80,7 +80,7 @@ test_ref_create() { return 1 fi - (cd $testroot/repo && git checkout -q symbolicref) + git -C $testroot/repo checkout -q symbolicref ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -154,7 +154,7 @@ test_ref_create() { fi # Ensure that Git recognizes the ref Got has created - (cd $testroot/repo && git checkout -q HEAD) + git -C $testroot/repo checkout -q HEAD ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -251,7 +251,7 @@ test_ref_delete() { return 1 fi - (cd $testroot/repo && git pack-refs --all) + git -C $testroot/repo pack-refs --all echo "modified alpha" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha" blob - dcea98961cf673717907f69c3761b59218c16e1a blob + 9d0663c277f81746a0e748dfa34bab74a5ac65b5 --- regress/cmdline/revert.sh +++ regress/cmdline/revert.sh @@ -408,7 +408,7 @@ test_revert_patch() { local testroot=`test_init revert_patch` jot 16 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local commit_id=`git_show_head $testroot/repo` @@ -893,7 +893,7 @@ test_revert_patch_one_change() { local testroot=`test_init revert_patch_one_change` jot 16 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local commit_id=`git_show_head $testroot/repo` @@ -1112,7 +1112,7 @@ test_revert_symlink() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` @@ -1286,7 +1286,7 @@ test_revert_patch_symlink() { (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta2.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` blob - 420392d1edc3385a27c85335dea42848d6627aa0 blob + 8ee0c9db46392914b731af78dcd15c1cc3684308 --- regress/cmdline/rm.sh +++ regress/cmdline/rm.sh @@ -515,7 +515,7 @@ test_rm_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" got checkout $testroot/repo $testroot/wt > /dev/null blob - 95122a61da8bdfe16b530a54988fda3e5870a4ee blob + 522e20e74edf14f00ee8062462c8e07e0fa3a63c --- regress/cmdline/send.sh +++ regress/cmdline/send.sh @@ -40,10 +40,11 @@ EOF | tr -d ' ' | cut -d: -f2` echo "modified alpha" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) - (cd $testroot/repo && ln -s epsilon/zeta symlink && git add symlink) + git -C $testroot/repo rm -q beta + (cd $testroot/repo && ln -s epsilon/zeta symlink) + git -C $testroot/repo add symlink echo "new file alpha" > $testroot/repo/new - (cd $testroot/repo && git add new) + git -C $testroot/repo add new git_commit $testroot/repo -m "modified alpha" local commit_id2=`git_show_head $testroot/repo` @@ -349,7 +350,7 @@ test_send_merge_commit() { return 1 fi - (cd $testroot/repo && git config receive.denyCurrentBranch ignore) + git -C $testroot/repo config receive.denyCurrentBranch ignore got send -q -r $testroot/repo-clone ret=$? @@ -549,7 +550,7 @@ test_send_clone_and_send() { local testurl=ssh://127.0.0.1/$testroot local commit_id=`git_show_head $testroot/repo` - (cd $testroot/repo && git config receive.denyCurrentBranch ignore) + git -C $testroot/repo config receive.denyCurrentBranch ignore got clone -q $testurl/repo $testroot/repo-clone ret=$? @@ -1012,7 +1013,7 @@ test_send_new_branch() { local testurl=ssh://127.0.0.1/$testroot local commit_id=`git_show_head $testroot/repo` - (cd $testroot/repo && git config receive.denyCurrentBranch ignore) + git -C $testroot/repo config receive.denyCurrentBranch ignore got clone -q $testurl/repo $testroot/repo-clone ret=$? @@ -1105,7 +1106,7 @@ test_send_all_branches() { local testurl=ssh://127.0.0.1/$testroot local commit_id=`git_show_head $testroot/repo` - (cd $testroot/repo && git config receive.denyCurrentBranch ignore) + git -C $testroot/repo config receive.denyCurrentBranch ignore got clone -q $testurl/repo $testroot/repo-clone ret=$? blob - 76716f5e5237ac2f3426c566633ec858be31881e blob + 7152f7a681f0e4db92a9a9a549bf0079ed7b9f59 --- regress/cmdline/stage.sh +++ regress/cmdline/stage.sh @@ -1022,9 +1022,9 @@ test_stage_histedit() { (cd $testroot/wt && got stage alpha > /dev/null) echo "modified alpha on master" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on master" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` @@ -1066,20 +1066,20 @@ test_stage_histedit() { test_stage_rebase() { local testroot=`test_init stage_rebase` - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified delta on branch" > $testroot/repo/gamma/delta git_commit $testroot/repo -m "committing to delta on newbranch" echo "modified alpha on branch" > $testroot/repo/alpha - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta echo "new file on branch" > $testroot/repo/epsilon/new - (cd $testroot/repo && git add epsilon/new) + git -C $testroot/repo add epsilon/new git_commit $testroot/repo -m "committing more changes on newbranch" local orig_commit1=`git_show_parent_commit $testroot/repo` local orig_commit2=`git_show_head $testroot/repo` - (cd $testroot/repo && git checkout -q master) + git -C $testroot/repo checkout -q master echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" local master_commit=`git_show_head $testroot/repo` @@ -1441,7 +1441,7 @@ test_stage_patch() { local testroot=`test_init stage_patch` jot 16 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local commit_id=`git_show_head $testroot/repo` @@ -1731,7 +1731,7 @@ test_stage_patch_twice() { local testroot=`test_init stage_patch_twice` jot 16 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local commit_id=`git_show_head $testroot/repo` @@ -2230,7 +2230,7 @@ test_stage_patch_quit() { jot 16 > $testroot/repo/numbers echo zzz > $testroot/repo/zzz - (cd $testroot/repo && git add numbers zzz) + git -C $testroot/repo add numbers zzz git_commit $testroot/repo -m "added files" local commit_id=`git_show_head $testroot/repo` @@ -2342,7 +2342,7 @@ test_stage_patch_incomplete_script() { jot 16 > $testroot/repo/numbers echo zzz > $testroot/repo/zzz - (cd $testroot/repo && git add numbers zzz) + git -C $testroot/repo add numbers zzz git_commit $testroot/repo -m "added files" local commit_id=`git_show_head $testroot/repo` @@ -2442,7 +2442,7 @@ test_stage_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local head_commit=`git_show_head $testroot/repo` @@ -2755,7 +2755,7 @@ test_stage_patch_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local head_commit=`git_show_head $testroot/repo` blob - 28da1dacd8934b690da5ceef71b0f51b9bcb8c87 blob + 13623342bf573588e2acc70fdd73ada54e46965e --- regress/cmdline/status.sh +++ regress/cmdline/status.sh @@ -61,7 +61,7 @@ test_status_subdir_no_mods() { touch $testroot/repo/Basic/Targets/AArch64.cpp touch $testroot/repo/Basic/Targets.cpp touch $testroot/repo/Basic/Targets.h - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add subdir with files" got checkout $testroot/repo $testroot/wt > /dev/null @@ -101,7 +101,7 @@ test_status_subdir_no_mods2() { mkdir $testroot/repo/FrontendTool touch $testroot/repo/FrontendTool/CMakeLists.txt touch $testroot/repo/FrontendTool/ExecuteCompilerInvocation.cpp - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add subdir with files" got checkout $testroot/repo $testroot/wt > /dev/null @@ -177,7 +177,7 @@ test_status_shows_local_mods_after_update() { echo "6" >> $testroot/repo/numbers echo "7" >> $testroot/repo/numbers echo "8" >> $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" got checkout $testroot/repo $testroot/wt > /dev/null @@ -241,7 +241,7 @@ test_status_unversioned_subdirs() { mkdir $testroot/repo/ramdisk_cd/ touch $testroot/repo/ramdisk_cd/Makefile touch $testroot/repo/ramdisk_cd/list.local - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "first commit" got checkout $testroot/repo $testroot/wt > /dev/null @@ -282,7 +282,7 @@ test_status_symlink() { (cd $testroot/repo && ln -s alpha alpha.link) (cd $testroot/repo && ln -s epsilon epsilon.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "first commit" got checkout $testroot/repo $testroot/wt > /dev/null @@ -338,7 +338,7 @@ test_status_shows_no_mods_after_complete_merge() { # make this file larger than the usual blob buffer size of 8192 jot 16384 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" got checkout $testroot/repo $testroot/wt > /dev/null @@ -398,7 +398,7 @@ test_status_shows_conflict() { echo "6" >> $testroot/repo/numbers echo "7" >> $testroot/repo/numbers echo "8" >> $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" got checkout $testroot/repo $testroot/wt > /dev/null blob - 58cc28c89680ed685a25bf71155506a5c55715a3 blob + 005a6304020f8cb434ecb6fb450d1b44d9bcc66e --- regress/cmdline/tag.sh +++ regress/cmdline/tag.sh @@ -43,7 +43,7 @@ test_tag_create() { fi # Ensure that Git recognizes the tag Got has created - (cd $testroot/repo && git checkout -q $tag) + git -C $testroot/repo checkout -q $tag ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -91,7 +91,7 @@ test_tag_create() { return 1 fi - (cd $testroot/repo && git checkout -q $tag2) + git -C $testroot/repo checkout -q $tag2 ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" @@ -144,7 +144,7 @@ test_tag_list() { local tag2=2.0.0 # create tag with Git - (cd $testroot/repo && git tag -a -m 'test' $tag) + git -C $testroot/repo tag -a -m 'test' $tag # create tag with Got (cd $testroot/repo && got tag -m 'test' $tag2 > /dev/null) @@ -230,8 +230,8 @@ test_tag_list_lightweight() { local tag2=2.0.0 # create "lightweight" tag with Git - (cd $testroot/repo && git tag $tag) - (cd $testroot/repo && git tag $tag2) + git -C $testroot/repo tag $tag + git -C $testroot/repo tag $tag2 tag_id=`got ref -r $testroot/repo -l \ | grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2` @@ -364,16 +364,16 @@ test_tag_create_ssh_signed() { echo -n > $testroot/revoked_signers # Ensure that Git recognizes and verifies the tag Got has created - (cd $testroot/repo && git checkout -q $tag) + git -C $testroot/repo checkout -q $tag ret=$? if [ $ret -ne 0 ]; then echo "git checkout command failed unexpectedly" test_done "$testroot" "$ret" return 1 fi - (cd $testroot/repo && git config --local gpg.ssh.allowedSignersFile \ - $testroot/allowed_signers) - GIT_STDERR=$(cd $testroot/repo && git tag -v $tag 2>&1 1>/dev/null) + git -C $testroot/repo config --local gpg.ssh.allowedSignersFile \ + $testroot/allowed_signers + GIT_STDERR=$(git -C $testroot/repo tag -v $tag 2>&1 1>/dev/null) if ! echo "$GIT_STDERR" | grep -q "^$GOOD_SIG"; then echo "git tag command failed to validate signature" test_done "$testroot" "1" blob - 62eb987ba62876f4026cd0d830472dd2a3060c20 blob + 1b2025992be4d03420f106db1af5777b5bb84907 --- regress/cmdline/tree.sh +++ regress/cmdline/tree.sh @@ -84,9 +84,9 @@ test_tree_submodule() { local testroot=`test_init tree_submodule` make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' local submodule_id=$(got tree -r $testroot/repo -i | \ grep 'repo2\$$' | cut -d ' ' -f1) @@ -115,10 +115,10 @@ test_tree_submodule() { test_tree_submodule_of_same_repo() { local testroot=`test_init tree_submodule_of_same_repo` - (cd $testroot && git clone -q repo repo2 >/dev/null) - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot clone -q repo repo2 >/dev/null + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' # Currently fails with "bad object data" got tree -r $testroot/repo repo2 > $testroot/stdout 2> $testroot/stderr blob - f5ebd5bc9adac2a53e2651879adde02156aa7f10 blob + f3dca3415655e74d6079b22ae72d395f55d890eb --- regress/cmdline/unstage.sh +++ regress/cmdline/unstage.sh @@ -187,7 +187,7 @@ test_unstage_patch() { local testroot=`test_init unstage_patch` jot 16 > $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local commit_id=`git_show_head $testroot/repo` @@ -821,7 +821,7 @@ test_unstage_patch_quit() { jot 16 > $testroot/repo/numbers echo zzz > $testroot/repo/zzz - (cd $testroot/repo && git add numbers zzz) + git -C $testroot/repo add numbers zzz git_commit $testroot/repo -m "added files" local commit_id=`git_show_head $testroot/repo` @@ -981,7 +981,7 @@ test_unstage_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local head_commit=`git_show_head $testroot/repo` @@ -1165,7 +1165,7 @@ test_unstage_patch_symlink() { (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta2.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` blob - 812f69b2eacd6f0c5c490042706348d24de55019 blob + 29f71c104f547b33dd50e328e706ea79dd710fba --- regress/cmdline/update.sh +++ regress/cmdline/update.sh @@ -66,7 +66,7 @@ test_update_adds_file() { fi echo "new" > $testroot/repo/gamma/new - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding a new file" echo "A gamma/new" > $testroot/stdout.expected @@ -180,7 +180,7 @@ test_update_deletes_dir_with_path_prefix() { mkdir $testroot/repo/epsilon/psi echo mu > $testroot/repo/epsilon/psi/mu - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding a sub-directory beneath epsilon" # check out the epsilon/ sub-tree @@ -223,7 +223,7 @@ test_update_deletes_dir_recursively() { echo mu > $testroot/repo/epsilon/psi/mu mkdir $testroot/repo/epsilon/psi/chi echo tau > $testroot/repo/epsilon/psi/chi/tau - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding a sub-directory beneath epsilon" # check out the epsilon/ sub-tree @@ -271,7 +271,7 @@ test_update_sibling_dirs_with_common_prefix() { mkdir $testroot/repo/epsilon2 echo mu > $testroot/repo/epsilon2/mu - (cd $testroot/repo && git add epsilon2/mu) + git -C $testroot/repo add epsilon2/mu git_commit $testroot/repo -m "adding sibling of epsilon" echo change > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "changing epsilon/zeta" @@ -333,7 +333,7 @@ test_update_dir_with_dot_sibling() { fi echo text > $testroot/repo/epsilon.txt - (cd $testroot/repo && git add epsilon.txt) + git -C $testroot/repo add epsilon.txt git_commit $testroot/repo -m "adding sibling of epsilon" echo change > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "changing epsilon/zeta" @@ -387,7 +387,7 @@ test_update_moves_files_upwards() { echo mu > $testroot/repo/epsilon/psi/mu mkdir $testroot/repo/epsilon/psi/chi echo tau > $testroot/repo/epsilon/psi/chi/tau - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding a sub-directory beneath epsilon" got checkout $testroot/repo $testroot/wt > /dev/null @@ -397,8 +397,8 @@ test_update_moves_files_upwards() { return 1 fi - (cd $testroot/repo && git mv epsilon/psi/mu epsilon/mu) - (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon/psi/tau) + git -C $testroot/repo mv epsilon/psi/mu epsilon/mu + git -C $testroot/repo mv epsilon/psi/chi/tau epsilon/psi/tau git_commit $testroot/repo -m "moving files upwards" echo "A epsilon/mu" > $testroot/stdout.expected @@ -441,7 +441,7 @@ test_update_moves_files_to_new_dir() { echo mu > $testroot/repo/epsilon/psi/mu mkdir $testroot/repo/epsilon/psi/chi echo tau > $testroot/repo/epsilon/psi/chi/tau - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding a sub-directory beneath epsilon" got checkout $testroot/repo $testroot/wt > /dev/null @@ -452,8 +452,8 @@ test_update_moves_files_to_new_dir() { fi mkdir -p $testroot/repo/epsilon-new/psi - (cd $testroot/repo && git mv epsilon/psi/mu epsilon-new/mu) - (cd $testroot/repo && git mv epsilon/psi/chi/tau epsilon-new/psi/tau) + git -C $testroot/repo mv epsilon/psi/mu epsilon-new/mu + git -C $testroot/repo mv epsilon/psi/chi/tau epsilon-new/psi/tau git_commit $testroot/repo -m "moving files upwards" echo "D epsilon/psi/chi/tau" > $testroot/stdout.expected @@ -495,7 +495,7 @@ test_update_creates_missing_parent() { touch $testroot/repo/Makefile touch $testroot/repo/snake.6 touch $testroot/repo/snake.c - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding initial snake tree" got checkout $testroot/repo $testroot/wt > /dev/null @@ -506,14 +506,14 @@ test_update_creates_missing_parent() { fi mkdir -p $testroot/repo/snake - (cd $testroot/repo && git mv Makefile snake.6 snake.c snake) + git -C $testroot/repo mv Makefile snake.6 snake.c snake touch $testroot/repo/snake/move.c touch $testroot/repo/snake/pathnames.h touch $testroot/repo/snake/snake.h mkdir -p $testroot/repo/snscore touch $testroot/repo/snscore/Makefile touch $testroot/repo/snscore/snscore.c - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "restructuring snake tree" echo "D Makefile" > $testroot/stdout.expected @@ -547,7 +547,7 @@ test_update_creates_missing_parent_with_subdir() { touch $testroot/repo/Makefile touch $testroot/repo/snake.6 touch $testroot/repo/snake.c - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding initial snake tree" got checkout $testroot/repo $testroot/wt > /dev/null @@ -558,14 +558,14 @@ test_update_creates_missing_parent_with_subdir() { fi mkdir -p $testroot/repo/sss/snake - (cd $testroot/repo && git mv Makefile snake.6 snake.c sss/snake) + git -C $testroot/repo mv Makefile snake.6 snake.c sss/snake touch $testroot/repo/sss/snake/move.c touch $testroot/repo/sss/snake/pathnames.h touch $testroot/repo/sss/snake/snake.h mkdir -p $testroot/repo/snscore touch $testroot/repo/snscore/Makefile touch $testroot/repo/snscore/snscore.c - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "restructuring snake tree" echo "D Makefile" > $testroot/stdout.expected @@ -604,7 +604,7 @@ test_update_file_in_subsubdir() { touch $testroot/repo/altq/if_altq.h mkdir -p $testroot/repo/arch/alpha touch $testroot/repo/arch/alpha/Makefile - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding initial tree" got checkout $testroot/repo $testroot/wt > /dev/null @@ -615,7 +615,7 @@ test_update_file_in_subsubdir() { fi echo change > $testroot/repo/arch/alpha/Makefile - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "changed a file" echo "U arch/alpha/Makefile" > $testroot/stdout.expected @@ -649,7 +649,7 @@ test_update_changes_file_to_dir() { git_rm $testroot/repo alpha mkdir $testroot/repo/alpha echo eta > $testroot/repo/alpha/eta - (cd $testroot/repo && git add alpha/eta) + git -C $testroot/repo add alpha/eta git_commit $testroot/repo -m "changed alpha into directory" (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr) @@ -687,7 +687,7 @@ test_update_changes_dir_to_file() { git_rmdir $testroot/repo epsilon echo epsilon > $testroot/repo/epsilon cp $testroot/repo/epsilon $testroot/content.expected - (cd $testroot/repo && git add epsilon) + git -C $testroot/repo add epsilon git_commit $testroot/repo -m "changed epsilon into file" (cd $testroot/wt && got update > $testroot/stdout 2> $testroot/stderr) @@ -759,7 +759,7 @@ test_update_changes_modified_file_to_dir() { git_rm $testroot/repo alpha mkdir $testroot/repo/alpha echo eta > $testroot/repo/alpha/eta - (cd $testroot/repo && git add alpha/eta) + git -C $testroot/repo add alpha/eta git_commit $testroot/repo -m "changed alpha into directory" echo "modified alpha" >> $testroot/wt/alpha @@ -801,7 +801,7 @@ test_update_merges_file_edits() { echo "6" >> $testroot/repo/numbers echo "7" >> $testroot/repo/numbers echo "8" >> $testroot/repo/numbers - (cd $testroot/repo && git add numbers) + git -C $testroot/repo add numbers git_commit $testroot/repo -m "added numbers file" local base_commit=`git_show_head $testroot/repo` @@ -882,7 +882,7 @@ test_update_keeps_xbit() { touch $testroot/repo/xfile chmod +x $testroot/repo/xfile - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding executable file" got checkout $testroot/repo $testroot/wt > $testroot/stdout @@ -929,7 +929,7 @@ test_update_clears_xbit() { touch $testroot/repo/xfile chmod +x $testroot/repo/xfile - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding executable file" got checkout $testroot/repo $testroot/wt > $testroot/stdout @@ -1031,7 +1031,7 @@ test_update_conflict_wt_add_vs_repo_add() { fi echo "new" > $testroot/repo/gamma/new - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding a new file" echo "also new" > $testroot/wt/gamma/new @@ -1093,7 +1093,7 @@ test_update_conflict_wt_edit_vs_repo_rm() { return 1 fi - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing a file" echo "modified beta" > $testroot/wt/beta @@ -1208,7 +1208,7 @@ test_update_conflict_wt_rm_vs_repo_rm() { return 1 fi - (cd $testroot/repo && git rm -q beta) + git -C $testroot/repo rm -q beta git_commit $testroot/repo -m "removing a file" (cd $testroot/wt && got rm beta > /dev/null) @@ -1340,7 +1340,7 @@ test_update_partial_add() { echo "new" > $testroot/repo/new echo "epsilon/new2" > $testroot/repo/epsilon/new2 - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "added two files" echo "A epsilon/new2" > $testroot/stdout.expected @@ -1382,7 +1382,7 @@ test_update_partial_rm() { return 1 fi - (cd $testroot/repo && git rm -q alpha epsilon/zeta) + git -C $testroot/repo rm -q alpha epsilon/zeta git_commit $testroot/repo -m "removed two files" echo "got: /alpha: no such entry found in tree" \ @@ -1469,7 +1469,7 @@ test_update_moved_branch_ref() { (cd $testroot/wt && got commit -m "modified alpha with got" > /dev/null) # + xxxxxxx...yyyyyyy master -> master (forced update) - (cd $testroot/repo2 && git fetch -q --all) + git -C $testroot/repo2 fetch -q --all echo -n > $testroot/stdout.expected echo -n "got: work tree's head reference now points to a different " \ @@ -1515,7 +1515,7 @@ test_update_to_another_branch() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on new branch" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha on new branch" @@ -1581,7 +1581,7 @@ test_update_to_commit_on_wrong_branch() { return 1 fi - (cd $testroot/repo && git checkout -q -b newbranch) + git -C $testroot/repo checkout -q -b newbranch echo "modified alpha on new branch" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha on new branch" @@ -1616,7 +1616,7 @@ test_update_bumps_base_commit_id() { local testroot=`test_init update_bumps_base_commit_id` echo "psi" > $testroot/repo/epsilon/psi - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding another file" got checkout $testroot/repo $testroot/wt > /dev/null @@ -1641,7 +1641,7 @@ test_update_bumps_base_commit_id() { fi echo "changed zeta with git" > $testroot/repo/epsilon/zeta - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "changing zeta with git" echo "modified zeta" > $testroot/wt/epsilon/zeta @@ -1707,7 +1707,7 @@ test_update_tag() { echo "modified alpha" > $testroot/repo/alpha git_commit $testroot/repo -m "modified alpha" - (cd $testroot/repo && git tag -m "test" -a $tag) + git -C $testroot/repo tag -m "test" -a $tag echo "U alpha" > $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected @@ -1740,7 +1740,7 @@ test_update_toggles_xbit() { touch $testroot/repo/xfile chmod +x $testroot/repo/xfile - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding executable file" local commit_id1=`git_show_head $testroot/repo` @@ -1885,18 +1885,18 @@ test_update_modified_submodules() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' got checkout $testroot/repo $testroot/wt > /dev/null echo "modified foo" > $testroot/repo2/foo - (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule') + git -C $testroot/repo2 commit -q -a -m 'modified a submodule' # Update the repo/repo2 submodule link - (cd $testroot/repo && git -C repo2 pull -q) - (cd $testroot/repo && git add repo2) + git -C $testroot/repo/repo2 pull -q + git -C $testroot/repo add repo2 git_commit $testroot/repo -m "modified submodule link" echo "Already up-to-date" > $testroot/stdout.expected @@ -1918,11 +1918,11 @@ test_update_adds_submodule() { make_single_file_repo $testroot/repo2 foo echo "modified foo" > $testroot/repo2/foo - (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule') + git -C $testroot/repo2 commit -q -a -m 'modified a submodule' - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' echo "A .gitmodules" > $testroot/stdout.expected echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected @@ -1957,9 +1957,9 @@ test_update_conflict_wt_file_vs_repo_submodule() { return 1 fi - (cd $testroot/repo && git -c protocol.file.allow=always \ - submodule -q add ../repo2) - (cd $testroot/repo && git commit -q -m 'adding submodule') + git -C $testroot/repo -c protocol.file.allow=always \ + submodule -q add ../repo2 + git -C $testroot/repo commit -q -m 'adding submodule' # Modify the clashing file such that any modifications brought # in by 'got update' would require a merge. @@ -2009,7 +2009,7 @@ test_update_adds_symlink() { (cd $testroot/repo && ln -s /etc/passwd passwd.link) (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" echo "A alpha.link" > $testroot/stdout.expected @@ -2116,7 +2116,7 @@ test_update_deletes_symlink() { local testroot=`test_init update_deletes_symlink` (cd $testroot/repo && ln -s alpha alpha.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlink" got checkout $testroot/repo $testroot/wt > /dev/null @@ -2127,7 +2127,7 @@ test_update_deletes_symlink() { return 1 fi - (cd $testroot/repo && git rm -q alpha.link) + git -C $testroot/repo rm -q alpha.link git_commit $testroot/repo -m "delete symlink" echo "D alpha.link" > $testroot/stdout.expected @@ -2163,7 +2163,7 @@ test_update_symlink_conflicts() { (cd $testroot/repo && ln -s ../beta epsilon/beta.link) (cd $testroot/repo && ln -s nonexistent nonexistent.link) (cd $testroot/repo && ln -sf epsilon/zeta zeta.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add symlinks" local commit_id1=`git_show_head $testroot/repo` @@ -2180,10 +2180,10 @@ test_update_symlink_conflicts() { (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link (cd $testroot/repo && ln -sf .got/bar dotgotbar.link) - (cd $testroot/repo && git rm -q nonexistent.link) + git -C $testroot/repo rm -q nonexistent.link (cd $testroot/repo && ln -sf gamma/delta zeta.link) (cd $testroot/repo && ln -sf alpha new.link) - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "change symlinks" local commit_id2=`git_show_head $testroot/repo` @@ -2439,18 +2439,18 @@ test_update_single_file() { local testroot=`test_init update_single_file 1` echo c1 > $testroot/repo/c - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "adding file c" local commit_id1=`git_show_head $testroot/repo` echo a > $testroot/repo/a echo b > $testroot/repo/b echo c2 > $testroot/repo/c - (cd $testroot/repo && git add .) + git -C $testroot/repo add . git_commit $testroot/repo -m "add files a and b, change c" local commit_id2=`git_show_head $testroot/repo` - (cd $testroot/repo && git rm -qf c) + git -C $testroot/repo rm -qf c git_commit $testroot/repo -m "remove file c" local commit_id3=`git_show_head $testroot/repo` @@ -2751,7 +2751,7 @@ test_update_file_skipped_due_to_obstruction() { echo "changed beta" > $testroot/repo/beta echo "new file" > $testroot/repo/new - (cd $testroot/repo && git add new) + git -C $testroot/repo add new git_commit $testroot/repo -m "changed beta" local commit_id1=`git_show_head $testroot/repo` blob_id1=`get_blob_id $testroot/repo "" beta`