Elffuss BraidHub

utopia-ia/elffuss-braid public

Tests and bench: what every git says in a workspace, and its .git guard

Newer git prints "not a git repository: (null)" for the workspace's .git
file instead of repeating its text, so the test checks only the refusal,
which is what the guides promise. The quick benchmark counts a workspace's
files less its own .braid file and the .git guard.
Changeset93048831ca8a632d758da75caab56bf281a60e5aacbb6e77b5621e08508864c5
AuthorKikoCis <KikoCis@users.noreply.github.com> · 2026-10-17 13:58 +02:00
CommitterKikoCis <KikoCis@users.noreply.github.com> · 2026-10-17 13:58 +02:00
Parents35a553d5143e

Browse the files at this changeset

2 files changed

modified bench/run.py +4 −1
@@ -776,7 +776,10 @@
776776 fsck = tools.braid_run(repo, "fsck", "--json", capture=True).json()
777777 if not fsck["clean"]:
778778 raise Failure(f"braid fsck after the import: {fsck['problems'][:3]}")
779- files = count_files(ws) - 1 # less the workspace's .braid file
779+ # less the workspace's own .braid file and its .git guard
780+ files = count_files(ws) - sum(
781+ os.path.lexists(os.path.join(ws, name)) for name in (".braid", ".git")
782+ )
780783 if files != info["files"]:
781784 raise Failure(f"the workspace has {files} files, git's tree {info['files']}")
782785 configure_git(tools, made["git-bare"])
modified crates/cli/tests/sessions.rs +2 −1
@@ -136,8 +136,9 @@
136136 let out = git(&workspace, args);
137137 assert!(!out.status.success(), "git {args:?} worked in a workspace");
138138 let err = String::from_utf8_lossy(&out.stderr);
139+ // Only the refusal is the same in every git: older versions repeat
140+ // the guard's text, which names braid, and newer ones say "(null)".
139141 assert!(err.contains("not a git repository"), "git {args:?}: {err}");
140- assert!(err.contains("braid workspace"), "git {args:?}: {err}");
141142 }
142143 assert_eq!(
143144 fs::read_to_string(dir.join("notes.txt")).unwrap(),