Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: isolate fixture line endings from host Git defaults

[._.]/ Adam Eivy6be251496f2d
diff --git a/server/lib/gitTestRepo.js b/server/lib/gitTestRepo.js
index e70d1e5017..2050660ea4 100644
--- a/server/lib/gitTestRepo.js
+++ b/server/lib/gitTestRepo.js
@@ -90,6 +90,9 @@ async function buildTemplate() {
await execGit(['init', '-b', 'main', repo], scratch);
await keepMaintenanceAttached(repo);
await configureIdentity(repo);
+ // Fixture assertions compare authored bytes; host Git for Windows defaults
+ // must not rewrite them during checkout/rebase. This config stays temporary.
+ await execGit(['config', 'core.autocrlf', 'false'], repo);
await writeFile(join(repo, 'initial.txt'), 'initial');
await execGit(['add', '-A'], repo);
await execGit(['commit', '-m', 'initial'], repo);
diff --git a/server/lib/gitTestRepo.test.js b/server/lib/gitTestRepo.test.js
index cec3e1adb0..e50d6de0bf 100644
--- a/server/lib/gitTestRepo.test.js
+++ b/server/lib/gitTestRepo.test.js
@@ -39,6 +39,27 @@ afterEach(async () => {
});
describe('makeGitSandbox', () => {
+ it('preserves exact LF fixture bytes when the host enables automatic CRLF checkout', async () => {
+ const configRoot = await mkdtemp(join(tmpdir(), 'portos-git-fx-line-endings-'));
+ sandboxes.push(configRoot);
+ const globalConfig = join(configRoot, 'gitconfig');
+ await writeFile(globalConfig, '[core]\n\tautocrlf = true\n');
+ vi.stubEnv('GIT_CONFIG_GLOBAL', globalConfig);
+ // Build a new template under the inherited host setting rather than reuse
+ // the template that earlier tests initialized in another environment.
+ vi.resetModules();
+ const { makeGitSandbox: freshSandbox } = await import('./gitTestRepo.js');
+ const box = await freshSandbox({ prefix: 'portos-git-fx-lf-' });
+ sandboxes.push(box.scratch);
+ const file = join(box.repo, 'line-endings.txt');
+ await writeFile(file, 'exact fixture bytes\n');
+ await execGit(['add', 'line-endings.txt'], box.repo);
+ await execGit(['commit', '-m', 'Record LF fixture'], box.repo);
+ await rm(file);
+ await execGit(['checkout', '--', 'line-endings.txt'], box.repo);
+ expect(await readFile(file, 'utf8')).toBe('exact fixture bytes\n');
+ });
+
it('keeps automatic maintenance inside the awaited Git lifetime before fixture removal', async () => {
const box = await makeGitSandbox({ origin: true, prefix: 'portos-git-fx-maintenance-' });
sandboxes.push(box.scratch);