mirror of
https://github.com/TheLocehiliosan/yadm
synced 2025-12-05 06:02:20 +00:00
Merge e43a68e4c6 into bbb58e6625
This commit is contained in:
commit
4e92f8e8f8
@ -248,7 +248,7 @@ def test_auto_alt(runner, yadm_cmd, paths, autoalt):
|
|||||||
os.system(" ".join(yadm_cmd("config", "yadm.auto-alt", autoalt)))
|
os.system(" ".join(yadm_cmd("config", "yadm.auto-alt", autoalt)))
|
||||||
|
|
||||||
utils.create_alt_files(paths, "##default")
|
utils.create_alt_files(paths, "##default")
|
||||||
run = runner(yadm_cmd("status"))
|
run = runner(yadm_cmd("reset"))
|
||||||
assert run.success
|
assert run.success
|
||||||
assert run.err == ""
|
assert run.err == ""
|
||||||
linked = utils.parse_alt_output(run.out)
|
linked = utils.parse_alt_output(run.out)
|
||||||
|
|||||||
@ -29,11 +29,10 @@ def test_pdirs_missing(runner, yadm_cmd, paths, home):
|
|||||||
if home:
|
if home:
|
||||||
env["HOME"] = paths.work
|
env["HOME"] = paths.work
|
||||||
|
|
||||||
# run status
|
# run reset
|
||||||
run = runner(command=yadm_cmd("status"), env=env)
|
run = runner(command=yadm_cmd("reset"), env=env)
|
||||||
assert run.success
|
assert run.success
|
||||||
assert run.err == ""
|
assert run.err == ""
|
||||||
assert "On branch master" in run.out
|
|
||||||
|
|
||||||
# confirm directories are created
|
# confirm directories are created
|
||||||
# and are protected
|
# and are protected
|
||||||
@ -48,7 +47,7 @@ def test_pdirs_missing(runner, yadm_cmd, paths, home):
|
|||||||
# confirm directories are created before command is run:
|
# confirm directories are created before command is run:
|
||||||
if home:
|
if home:
|
||||||
assert re.search(
|
assert re.search(
|
||||||
r"Creating.+\.(gnupg|ssh).+Creating.+\.(gnupg|ssh).+Running git command git status", run.out, re.DOTALL
|
r"Creating.+\.(gnupg|ssh).+Creating.+\.(gnupg|ssh).+Running git command git reset", run.out, re.DOTALL
|
||||||
), "directories created before command is run"
|
), "directories created before command is run"
|
||||||
|
|
||||||
|
|
||||||
@ -71,11 +70,11 @@ def test_pdirs_missing_apd_false(runner, yadm_cmd, paths):
|
|||||||
# set configuration
|
# set configuration
|
||||||
os.system(" ".join(yadm_cmd("config", "--bool", "yadm.auto-private-dirs", "false")))
|
os.system(" ".join(yadm_cmd("config", "--bool", "yadm.auto-private-dirs", "false")))
|
||||||
|
|
||||||
# run status
|
# run reset
|
||||||
run = runner(command=yadm_cmd("status"))
|
run = runner(command=yadm_cmd("reset"))
|
||||||
assert run.success
|
assert run.success
|
||||||
assert run.err == ""
|
assert run.err == ""
|
||||||
assert "On branch master" in run.out
|
assert run.out == ""
|
||||||
|
|
||||||
# confirm directories are STILL missing
|
# confirm directories are STILL missing
|
||||||
for pdir in PRIVATE_DIRS:
|
for pdir in PRIVATE_DIRS:
|
||||||
@ -102,11 +101,11 @@ def test_pdirs_exist_apd_false(runner, yadm_cmd, paths):
|
|||||||
# set configuration
|
# set configuration
|
||||||
os.system(" ".join(yadm_cmd("config", "--bool", "yadm.auto-perms", "false")))
|
os.system(" ".join(yadm_cmd("config", "--bool", "yadm.auto-perms", "false")))
|
||||||
|
|
||||||
# run status
|
# run reset
|
||||||
run = runner(command=yadm_cmd("status"))
|
run = runner(command=yadm_cmd("reset"))
|
||||||
assert run.success
|
assert run.success
|
||||||
assert run.err == ""
|
assert run.err == ""
|
||||||
assert "On branch master" in run.out
|
assert run.out == ""
|
||||||
|
|
||||||
# created directories are STILL permissive
|
# created directories are STILL permissive
|
||||||
for pdir in PRIVATE_DIRS:
|
for pdir in PRIVATE_DIRS:
|
||||||
|
|||||||
@ -37,7 +37,7 @@ def test_perms(runner, yadm_cmd, paths, ds1, autoperms):
|
|||||||
|
|
||||||
cmd = "perms"
|
cmd = "perms"
|
||||||
if autoperms != "notest":
|
if autoperms != "notest":
|
||||||
cmd = "status"
|
cmd = "reset"
|
||||||
run = runner(yadm_cmd(cmd), env={"HOME": paths.work})
|
run = runner(yadm_cmd(cmd), env={"HOME": paths.work})
|
||||||
assert run.success
|
assert run.success
|
||||||
assert run.err == ""
|
assert run.err == ""
|
||||||
|
|||||||
23
yadm
23
yadm
@ -1143,18 +1143,23 @@ function git_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ensure private .ssh and .gnupg directories exist first
|
# ensure private .ssh and .gnupg directories exist first
|
||||||
# TODO: consider restricting this to only commands which modify the work-tree
|
declare -A non_modify
|
||||||
|
for nm_command in bisect blame bugreport cat-file check-attr check-ignore check-mailmap check-ref-format cherry column count-objects cvsexportcommit csvserver daemon describe diff-files diff-index diff difftool diff-tree fast-export fetch for-each-ref fsck get-tar-commit-id grep hash-object help http-backend http-fetch http-push imap-send instaweb log ls-files ls-remote ls-tree mailinfo name-rev push range-diff reflog remote request-pull rev-list rev-parse send-mail send-pack shortlog show-branch show-index show-ref show status var verify-commit verify-pack version whatchanged; do
|
||||||
|
non_modify["$nm_command"]=1
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$YADM_WORK" = "$HOME" ]; then
|
if [ -z "${non_modify["$1"]}" ]; then
|
||||||
auto_private_dirs=$(config --bool yadm.auto-private-dirs)
|
if [ "$YADM_WORK" = "$HOME" ]; then
|
||||||
if [ "$auto_private_dirs" != "false" ]; then
|
auto_private_dirs=$(config --bool yadm.auto-private-dirs)
|
||||||
for pdir in $(private_dirs all); do
|
if [ "$auto_private_dirs" != "false" ]; then
|
||||||
assert_private_dirs "$pdir"
|
for pdir in $(private_dirs all); do
|
||||||
done
|
assert_private_dirs "$pdir"
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
CHANGES_POSSIBLE=1
|
CHANGES_POSSIBLE=1
|
||||||
|
fi
|
||||||
|
|
||||||
# pass commands through to git
|
# pass commands through to git
|
||||||
debug "Running git command $GIT_PROGRAM $*"
|
debug "Running git command $GIT_PROGRAM $*"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user