stash.go

 1package git
 2
 3import "github.com/aymanbagabas/git-module"
 4
 5// StashDiff returns the diff of the given stash index.
 6func (r *Repository) StashDiff(index int) (*Diff, error) {
 7	diff, err := r.Repository.StashDiff(index, DiffMaxFiles, DiffMaxFileLines, DiffMaxLineChars, git.DiffOptions{
 8		CommandOptions: git.CommandOptions{
 9			Envs: []string{"GIT_CONFIG_GLOBAL=/dev/null"},
10		},
11	})
12	if err != nil {
13		return nil, err //nolint:wrapcheck
14	}
15	return toDiff(diff), nil
16}