@@ -1224,33 +1224,6 @@ func (r *Repository) createNewObjectPack(cfg *RepackConfig) (h plumbing.Hash, er
12241224 return h , err
12251225}
12261226
1227- type DescribeOptions struct {
1228- // Contains find the tag that comes after the commit
1229- //Contains bool
1230- // Debug search strategy on stderr
1231- //Debug bool
1232- // All Use any reference
1233- //All bool
1234- // Tags use any tag, even unannotated
1235- //Tags bool
1236- // FirstParent only follow first parent
1237- //FirstParent bool
1238- // Use <Abbrev> digits to display SHA-1s
1239- // By default is 8
1240- //Abbrev int
1241- // Only output exact matches
1242- //ExactMatch bool
1243- // Consider <Candidates> most recent tags
1244- // By default is 10
1245- //Candidates int
1246- // Only consider tags matching <Match> pattern
1247- //Match string
1248- // Show abbreviated commit object as fallback
1249- //Always bool
1250- // Append <mark> on dirty working tree (default: "-dirty")
1251- Dirty string
1252- }
1253-
12541227type Describe struct {
12551228 // Reference being described
12561229 Reference * plumbing.Reference
@@ -1272,7 +1245,10 @@ func (d *Describe) String() string {
12721245
12731246// Describe just like the `git describe` command will return a Describe struct for the hash passed.
12741247// Describe struct implements String interface so it can be easily printed out.
1275- func (r * Repository ) Describe (ref * plumbing.Reference , options * DescribeOptions ) (* Describe , error ) {
1248+ func (r * Repository ) Describe (ref * plumbing.Reference , opts * DescribeOptions ) (* Describe , error ) {
1249+ if err := opts .Validate (); err != nil {
1250+ return nil , err
1251+ }
12761252
12771253 // Fetch the reference log
12781254 commitIterator , err := r .Log (& LogOptions {
@@ -1313,7 +1289,7 @@ func (r *Repository) Describe(ref *plumbing.Reference, options *DescribeOptions)
13131289 ref ,
13141290 tag ,
13151291 count ,
1316- options .Dirty ,
1292+ opts .Dirty ,
13171293 }, nil
13181294
13191295}
0 commit comments