Never list index.mf at the top of the tree in gen and freshen (closes #233)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
fetch saves the manifest as index.mf at the top of the tree and refuses a manifest that lists a file there. gen given --output, and freshen with its manifest outside the base directory, listed such a file, so they wrote manifests fetch would not take. gen now leaves out index.mf in each directory it is given, or beside each file it is given, the same way it leaves out the file it writes. freshen leaves out index.mf at the top of the base directory. index.mf in a subdirectory is still listed. The README says so for both commands. Model: opus-5-5
This commit is contained in:
@@ -413,6 +413,34 @@ func TestFreshenLeavesLeftoverTempFileOutOfListing(t *testing.T) {
|
||||
manifestPaths(t, fs, manifestPath))
|
||||
}
|
||||
|
||||
// TestFreshenLeavesTopIndexMFOutOfListing freshens a manifest kept outside
|
||||
// the directory --base names, after index.mf and sub/index.mf are added
|
||||
// there: index.mf at the top is not listed, since fetch saves the manifest
|
||||
// there, while sub/index.mf is listed. The file is recognized by file
|
||||
// identity, which needs the real filesystem.
|
||||
func TestFreshenLeavesTopIndexMFOutOfListing(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
root := t.TempDir()
|
||||
tree := filepath.Join(root, "tree")
|
||||
manifestPath := filepath.Join(root, "other.mf")
|
||||
|
||||
fs := afero.NewOsFs()
|
||||
require.NoError(t, fs.MkdirAll(filepath.Join(tree, testSubdir), 0o750))
|
||||
writeTestFile(t, fs, filepath.Join(tree, testFileTxt), "hello")
|
||||
|
||||
opts := testOpts([]string{testApp, cmdGenerate, "-q", "-o", manifestPath, tree}, fs)
|
||||
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||
|
||||
writeTestFile(t, fs, filepath.Join(tree, defaultManifestName), "an ordinary file")
|
||||
writeTestFile(t, fs, filepath.Join(tree, testSubdirManifest), "an ordinary file")
|
||||
|
||||
runFreshen(t, fs, tree, manifestPath)
|
||||
|
||||
assert.ElementsMatch(t, []string{testFileTxt, testSubdirManifest},
|
||||
manifestPaths(t, fs, manifestPath))
|
||||
}
|
||||
|
||||
// TestFreshenResolvesEntriesAgainstManifestDirectory adds sub/c.txt, then
|
||||
// runs freshen from the directory above sub, on the manifest in sub.
|
||||
// Without --base, the manifest then lists the files in sub, whether freshen
|
||||
|
||||
Reference in New Issue
Block a user