mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Fix the "Add to .git/info/exclude" command in submodules or worktrees
This commit is contained in:
@ -3,6 +3,7 @@ package git_commands
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
|
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
@ -232,7 +233,8 @@ func (self *WorkingTreeCommands) Ignore(filename string) error {
|
|||||||
|
|
||||||
// Exclude adds a file to the .git/info/exclude for the repo
|
// Exclude adds a file to the .git/info/exclude for the repo
|
||||||
func (self *WorkingTreeCommands) Exclude(filename string) error {
|
func (self *WorkingTreeCommands) Exclude(filename string) error {
|
||||||
return self.os.AppendLineToFile(".git/info/exclude", filename)
|
excludeFile := path.Join(self.repoPaths.repoGitDirPath, "info", "exclude")
|
||||||
|
return self.os.AppendLineToFile(excludeFile, filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WorktreeFileDiff returns the diff of a file
|
// WorktreeFileDiff returns the diff of a file
|
||||||
|
@ -34,13 +34,8 @@ var ExcludeFileInWorktree = NewIntegrationTest(NewIntegrationTestArgs{
|
|||||||
Tap(func() {
|
Tap(func() {
|
||||||
t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm()
|
t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm()
|
||||||
}).
|
}).
|
||||||
/* EXPECTED:
|
|
||||||
IsEmpty()
|
IsEmpty()
|
||||||
|
|
||||||
t.FileSystem().FileContent("../repo/.git/info/exclude", Contains("toExclude"))
|
t.FileSystem().FileContent("../repo/.git/info/exclude", Contains("toExclude"))
|
||||||
ACTUAL: */
|
|
||||||
Tap(func() {
|
|
||||||
t.ExpectPopup().Alert().Title(Equals("Error")).Content(Contains("open .git/info/exclude: not a directory"))
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user