Closed ddgenome closed 7 years ago
I can't reproduce this at the artifact-source level nor the rug level. Deleting a file will result in a new ArtifactSource being returned without the file and will contain a FileDeletionDelta. Perhaps rather than deleting the file, replace the contents instead, which I think your workaround is doing
I can't reproduce it either with the current released versions or latest master of artifact-source, rug, and rug-cli. Hopefully it was fixed.
Here is the Rug I created to test it, running it it in local mode on itself.
import { File, Project } from "@atomist/rug/model/Core";
import { Editor, Parameter, Tags } from "@atomist/rug/operations/Decorators";
import { EditProject } from "@atomist/rug/operations/ProjectEditor";
import { Pattern } from "@atomist/rug/operations/RugOperation";
/**
* Sample TypeScript editor used by AddNoOp.
*/
@Editor("NoOp", "does nothing")
@Tags("documentation")
export class NoOp implements EditProject {
public edit(project: Project) {
const path = "README.md";
project.deleteFile(path);
project.copyEditorBackingFileOrFail(path);
}
}
export const noOp = new NoOp();
A typical pattern for adding a file from a Rug archive is
This no longer works. It seems marking the file as deleted at any point results in it being deleted in the resulting change set. So the resulting commit/PR deletes the settings file rather than have it changed to the contents of the settings file from the editor's archive.