diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-11-23 11:22:23 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-11-23 11:22:24 +0900 |
commit | 56a64fcdc32568cfe1db34c44767a740d25d6d21 (patch) | |
tree | 072273952b87aef51b45af6afae2f57df47f6a4b /t | |
parent | 3b041ea5f7a3700a82cae479dc7f6d37e59569d2 (diff) | |
parent | 03744bbdc4284fbb358abd5347c8bb157f301243 (diff) | |
download | git-56a64fcdc32568cfe1db34c44767a740d25d6d21.tar.gz |
Merge branch 'rp/maintenance-qol'
'git maintenance register' is taught to write configuration to an
arbitrary path, and 'git for-each-repo' is taught to expand tilde
characters in paths.
* rp/maintenance-qol:
builtin/gc.c: fix use-after-free in maintenance_unregister()
maintenance --unregister: fix uninit'd data use & -Wdeclaration-after-statement
maintenance: add option to register in a specific config
for-each-repo: interpolate repo path arguments
Diffstat (limited to 't')
-rwxr-xr-x | t/t0068-for-each-repo.sh | 6 | ||||
-rwxr-xr-x | t/t7900-maintenance.sh | 21 |
2 files changed, 26 insertions, 1 deletions
diff --git a/t/t0068-for-each-repo.sh b/t/t0068-for-each-repo.sh index 4675e85251..c6e0d65563 100755 --- a/t/t0068-for-each-repo.sh +++ b/t/t0068-for-each-repo.sh @@ -8,9 +8,11 @@ test_expect_success 'run based on configured value' ' git init one && git init two && git init three && + git init ~/four && git -C two commit --allow-empty -m "DID NOT RUN" && git config run.key "$TRASH_DIRECTORY/one" && git config --add run.key "$TRASH_DIRECTORY/three" && + git config --add run.key "~/four" && git for-each-repo --config=run.key commit --allow-empty -m "ran" && git -C one log -1 --pretty=format:%s >message && grep ran message && @@ -18,12 +20,16 @@ test_expect_success 'run based on configured value' ' ! grep ran message && git -C three log -1 --pretty=format:%s >message && grep ran message && + git -C ~/four log -1 --pretty=format:%s >message && + grep ran message && git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" && git -C one log -1 --pretty=format:%s >message && grep again message && git -C two log -1 --pretty=format:%s >message && ! grep again message && git -C three log -1 --pretty=format:%s >message && + grep again message && + git -C ~/four log -1 --pretty=format:%s >message && grep again message ' diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 96bdd42045..823331e44a 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -500,9 +500,28 @@ test_expect_success 'register and unregister' ' git config --global --get-all maintenance.repo >actual && test_cmp before actual && + git config --file ./other --add maintenance.repo /existing1 && + git config --file ./other --add maintenance.repo /existing2 && + git config --file ./other --get-all maintenance.repo >before && + + git maintenance register --config-file ./other && + test_cmp_config false maintenance.auto && + git config --file ./other --get-all maintenance.repo >between && + cp before expect && + pwd >>expect && + test_cmp expect between && + + git maintenance unregister --config-file ./other && + git config --file ./other --get-all maintenance.repo >actual && + test_cmp before actual && + test_must_fail git maintenance unregister 2>err && grep "is not registered" err && - git maintenance unregister --force + git maintenance unregister --force && + + test_must_fail git maintenance unregister --config-file ./other 2>err && + grep "is not registered" err && + git maintenance unregister --config-file ./other --force ' test_expect_success !MINGW 'register and unregister with regex metacharacters' ' |