Changes since RFC v3: * Cleaner split of tests so patch1 will not break if called under sudo and will be less likely to break any CI by restricting its runs to IKNOWWHATIAMDOING=YES * Simplified patch3 with all requested enhancements, except that it is still keeping the (currently unused) possibility to override the shell used in run_with_sudo with an optional first parameter. Carlo Marcelo Arenas Belón (3): t: document regression git safe.directory when using sudo git-compat-util: avoid failing dir ownership checks if running privileged t0034: enhance framework to allow testing more commands under sudo Documentation/config/safe.txt | 9 +++ git-compat-util.h | 40 +++++++++++- t/lib-sudo.sh | 13 ++++ t/t0034-root-safe-directory.sh | 115 +++++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 t/lib-sudo.sh create mode 100755 t/t0034-root-safe-directory.sh A range-diff against RFC v3 shown below to easy review: 1: 51d0d485b5f ! 1: 27192634476 t: document regression git safe.directory when using sudo @@ t/t0034-root-safe-directory.sh (new) + +. ./test-lib.sh + ++if [ "$IKNOWWHATIAMDOING" != "YES" ] ++then ++ skip_all="You must set env var IKNOWWHATIAMDOING=YES in order to run this test" ++ test_done ++fi ++ +# this prerequisite should be added to all the tests, it not only prevents +# the test from failing but also warms up any authentication cache sudo +# might need to avoid asking for a password @@ t/t0034-root-safe-directory.sh (new) + ) +' + -+# this MUST be always the last test ++# this MUST be always the last test, if used more than once, the next ++# test should do a full setup again. +test_expect_success SUDO 'cleanup' ' + sudo rm -rf root +' 2: 4928ad698e2 = 2: 58b4671b9ef git-compat-util: avoid failing dir ownership checks if running privileged 3: 98aae872efd < -: ----------- t0034: enhance framework to allow testing more commands under sudo -: ----------- > 3: 7c029c66666 t0034: enhance framework to allow testing more commands under sudo Albeit not ideal, if needef patches 1 and 2 could be fastracked to close the regression while patch 3 goes through further iterations. Carlo -- 2.36.0.352.g0cd7feaf86f