| ... | @@ -750,6 +750,17 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( | ... | @@ -750,6 +750,17 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( |
| 750 | return path.isAbsolute(gitCommonDir) ? gitCommonDir : path.resolve(cwd, gitCommonDir); | 750 | return path.isAbsolute(gitCommonDir) ? gitCommonDir : path.resolve(cwd, gitCommonDir); |
| 751 | }); | 751 | }); |
| 752 | | 752 | |
| | 753 | // Git renames loose objects and refs into place without fsync by default, so |
| | 754 | // an unclean restart can leave 0-byte files under refs/t3/** that break every |
| | 755 | // later fetch and push. Checkpoint writes flush before they are published; |
| | 756 | // macOS defaults to writeout-only, which does not reach the disk either. |
| | 757 | const durableWrite = [ |
| | 758 | "-c", |
| | 759 | "core.fsync=objects,reference", |
| | 760 | "-c", |
| | 761 | "core.fsyncMethod=fsync", |
| | 762 | ] as const; |
| | 763 | |
| 753 | const checkpoints: VcsDriver.VcsCheckpointOps = { | 764 | const checkpoints: VcsDriver.VcsCheckpointOps = { |
| 754 | captureCheckpoint: Effect.fn("GitVcsDriver.checkpoints.captureCheckpoint")(function* (input) { | 765 | captureCheckpoint: Effect.fn("GitVcsDriver.checkpoints.captureCheckpoint")(function* (input) { |
| 755 | const operation = "GitVcsDriver.checkpoints.captureCheckpoint"; | 766 | const operation = "GitVcsDriver.checkpoints.captureCheckpoint"; |
| ... | @@ -907,14 +918,22 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( | ... | @@ -907,14 +918,22 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( |
| 907 | operation, | 918 | operation, |
| 908 | cwd: input.cwd, | 919 | cwd: input.cwd, |
| 909 | // Preserve absent skipped entries, but capture present nonignored files outside the cone. | 920 | // Preserve absent skipped entries, but capture present nonignored files outside the cone. |
| 910 | args: [...indexConfig, "add", ...(sparseCheckout ? ["--sparse"] : []), "-A", "--", "."], | 921 | args: [ |
| | 922 | ...indexConfig, |
| | 923 | ...durableWrite, |
| | 924 | "add", |
| | 925 | ...(sparseCheckout ? ["--sparse"] : []), |
| | 926 | "-A", |
| | 927 | "--", |
| | 928 | ".", |
| | 929 | ], |
| 911 | env: commitEnv, | 930 | env: commitEnv, |
| 912 | }); | 931 | }); |
| 913 | | 932 | |
| 914 | const writeTreeResult = yield* execute({ | 933 | const writeTreeResult = yield* execute({ |
| 915 | operation, | 934 | operation, |
| 916 | cwd: input.cwd, | 935 | cwd: input.cwd, |
| 917 | args: [...indexConfig, "write-tree"], | 936 | args: [...indexConfig, ...durableWrite, "write-tree"], |
| 918 | env: commitEnv, | 937 | env: commitEnv, |
| 919 | }); | 938 | }); |
| 920 | const treeOid = writeTreeResult.stdout.trim(); | 939 | const treeOid = writeTreeResult.stdout.trim(); |
| ... | @@ -932,7 +951,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( | ... | @@ -932,7 +951,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( |
| 932 | const commitTreeResult = yield* execute({ | 951 | const commitTreeResult = yield* execute({ |
| 933 | operation, | 952 | operation, |
| 934 | cwd: input.cwd, | 953 | cwd: input.cwd, |
| 935 | args: ["commit-tree", treeOid, "-m", message], | 954 | args: [...durableWrite, "commit-tree", treeOid, "-m", message], |
| 936 | env: commitEnv, | 955 | env: commitEnv, |
| 937 | }); | 956 | }); |
| 938 | const commitOid = commitTreeResult.stdout.trim(); | 957 | const commitOid = commitTreeResult.stdout.trim(); |
| ... | @@ -949,7 +968,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( | ... | @@ -949,7 +968,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( |
| 949 | yield* execute({ | 968 | yield* execute({ |
| 950 | operation, | 969 | operation, |
| 951 | cwd: input.cwd, | 970 | cwd: input.cwd, |
| 952 | args: ["update-ref", input.checkpointRef, commitOid], | 971 | args: [...durableWrite, "update-ref", input.checkpointRef, commitOid], |
| 953 | }); | 972 | }); |
| 954 | }).pipe(Effect.ensuring(cleanupTempIndex)); | 973 | }).pipe(Effect.ensuring(cleanupTempIndex)); |
| 955 | }), | 974 | }), |