Adding support for removing file from git index
Signed-off-by: manuel.falcon <manuel.falcon@glovoapp.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-common': minor
|
||||
---
|
||||
|
||||
Adding support for removing file from git index
|
||||
@@ -63,6 +63,22 @@ describe('Git', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('remove', () => {
|
||||
it('should call isomorphic-git remove with the correct arguments', async () => {
|
||||
const git = Git.fromAuth({});
|
||||
const dir = 'mockdirectory';
|
||||
const filepath = 'mockfile/path';
|
||||
|
||||
await git.remove({ dir, filepath });
|
||||
|
||||
expect(isomorphic.remove).toHaveBeenCalledWith({
|
||||
fs,
|
||||
dir,
|
||||
filepath,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('deleteRemote', () => {
|
||||
it('should call isomorphic-git with the correct arguments', async () => {
|
||||
const git = Git.fromAuth({});
|
||||
|
||||
@@ -300,6 +300,15 @@ export class Git {
|
||||
return git.readCommit({ fs, dir, oid: sha });
|
||||
}
|
||||
|
||||
/** https://isomorphic-git.org/docs/en/remove */
|
||||
async remove(options: { dir: string; filepath: string }): Promise<void> {
|
||||
const { dir, filepath } = options;
|
||||
this.config.logger?.info(
|
||||
`Removing file from git index {dir=${dir},filepath=${filepath}}`,
|
||||
);
|
||||
return git.remove({ fs, dir, filepath });
|
||||
}
|
||||
|
||||
/** https://isomorphic-git.org/docs/en/resolveRef */
|
||||
async resolveRef(options: { dir: string; ref: string }): Promise<string> {
|
||||
const { dir, ref } = options;
|
||||
|
||||
Reference in New Issue
Block a user