Ignore broken symlink check when committing deleted files

Signed-off-by: Philip Laine <philip.laine@gmail.com>
pull/3289/head
Philip Laine 3 years ago
parent 22a8aa57ae
commit be9f5ecade

@ -22,7 +22,6 @@ import (
"os" "os"
"time" "time"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/spf13/cobra" "github.com/spf13/cobra"

@ -24,7 +24,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plumbing/transport"
"github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/go-git/go-git/v5/plumbing/transport/ssh" "github.com/go-git/go-git/v5/plumbing/transport/ssh"

@ -22,7 +22,6 @@ import (
"os" "os"
"time" "time"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/spf13/cobra" "github.com/spf13/cobra"

@ -24,7 +24,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/ProtonMail/go-crypto/openpgp"
"github.com/go-git/go-git/v5/plumbing/transport/http" "github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/spf13/cobra" "github.com/spf13/cobra"

@ -160,7 +160,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 // modified. There's no circumstance in which we want to commit a
// change to a broken symlink: so, detect and skip those. // change to a broken symlink: so, detect and skip those.
var changed bool var changed bool
for file, _ := range status { for file, fileStatus := range status {
if fileStatus.Worktree == gogit.Deleted {
_, _ = wt.Add(file)
changed = true
continue
}
abspath := filepath.Join(g.path, file) abspath := filepath.Join(g.path, file)
info, err := os.Lstat(abspath) info, err := os.Lstat(abspath)
if err != nil { if err != nil {

Loading…
Cancel
Save