From b65ef3393668d1e4489e2024e87c8d769ab887c9 Mon Sep 17 00:00:00 2001 From: Philip Laine Date: Wed, 12 Oct 2022 12:14:20 +0200 Subject: [PATCH] Skip deleted files from symlink check --- pkg/bootstrap/git/gogit/gogit.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/bootstrap/git/gogit/gogit.go b/pkg/bootstrap/git/gogit/gogit.go index 1a22907b..916d7d87 100644 --- a/pkg/bootstrap/git/gogit/gogit.go +++ b/pkg/bootstrap/git/gogit/gogit.go @@ -172,7 +172,13 @@ func (g *GoGit) Commit(message git.Commit, opts ...git.Option) (string, error) { // modified. There's no circumstance in which we want to commit a // change to a broken symlink: so, detect and skip those. var changed bool - for file, _ := range status { + for file, fileStatus := range status { + if fileStatus.Staging == gogit.Deleted { + _, _ = wt.Add(file) + changed = true + continue + } + abspath := filepath.Join(g.path, file) info, err := os.Lstat(abspath) if err != nil {