mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Fix the "Add to .git/info/exclude" command in submodules or worktrees
This commit is contained in:
parent
de52a68b53
commit
93251db67e
2 changed files with 4 additions and 7 deletions
|
@ -3,6 +3,7 @@ package git_commands
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
"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
|
||||
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
|
||||
|
|
|
@ -34,13 +34,8 @@ var ExcludeFileInWorktree = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
Tap(func() {
|
||||
t.ExpectPopup().Menu().Title(Equals("Ignore or exclude file")).Select(Contains("Add to .git/info/exclude")).Confirm()
|
||||
}).
|
||||
/* EXPECTED:
|
||||
IsEmpty()
|
||||
|
||||
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"))
|
||||
})
|
||||
t.FileSystem().FileContent("../repo/.git/info/exclude", Contains("toExclude"))
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue