diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-04-26 18:28:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 18:28:51 +0100 |
commit | 0542a302c2be7ed7de276411f7e20b87309734b9 (patch) | |
tree | ad051d5540425a2df69e5fdee07ddd32b6d64316 /options.go | |
parent | cd1fd6b5da926e8dedd776b319455e499e35618b (diff) | |
parent | 3aa7575a4d660a250edd06864d6401a302951fab (diff) | |
download | go-git-0542a302c2be7ed7de276411f7e20b87309734b9.tar.gz |
Merge pull request #728 from aymanbagabas/grep-bare
fix: git grep bare repositories
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -650,7 +650,13 @@ var ( ) // Validate validates the fields and sets the default values. +// +// TODO: deprecate in favor of Validate(r *Repository) in v6. func (o *GrepOptions) Validate(w *Worktree) error { + return o.validate(w.r) +} + +func (o *GrepOptions) validate(r *Repository) error { if !o.CommitHash.IsZero() && o.ReferenceName != "" { return ErrHashOrReference } @@ -658,7 +664,7 @@ func (o *GrepOptions) Validate(w *Worktree) error { // If none of CommitHash and ReferenceName are provided, set commit hash of // the repository's head. if o.CommitHash.IsZero() && o.ReferenceName == "" { - ref, err := w.r.Head() + ref, err := r.Head() if err != nil { return err } |