Skip to content

Commit

Permalink
fix: remove whole directory on sbom-removal
Browse files Browse the repository at this point in the history
close #8

Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de>
  • Loading branch information
ckotzbauer committed Jan 21, 2022
1 parent 8199174 commit 891dfc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/daemon/daemon.go
Expand Up @@ -109,7 +109,8 @@ func deleteObsoleteFiles(workPath string, ignoreDirs, processedSbomFiles []strin

if !found {
rel, _ := filepath.Rel(workPath, p)
gitAccount.RemoveFile(workPath, rel)
dir := filepath.Dir(rel)
gitAccount.Remove(workPath, dir)
if err != nil {
logrus.WithError(err).Errorf("File could not be deleted %s", p)
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/git/git.go
Expand Up @@ -128,7 +128,7 @@ func (g *GitAccount) CommitAll(path, message string) {
g.commitAndPush(w, r, message)
}

func (g *GitAccount) RemoveFile(workTree, path string) {
func (g *GitAccount) Remove(workTree, path string) {
r, w := g.openExistingRepo(workTree)

if r == nil && w == nil {
Expand Down

0 comments on commit 891dfc7

Please sign in to comment.