func (r *RepositoryRevisions) ExpandedRevSpecs(ctx context.Context) ([]string, error) {
	listRefs := r.ListRefs
	if listRefs == nil {
		listRefs = git.ListRefs
	}

	var (
		revSpecs = map[string]struct{}{}
		globs    []git.RefGlob
	)
	for _, rev := range r.Revs {
		switch {
		case rev.RefGlob != "":
			globs = append(globs, git.RefGlob{Include: rev.RefGlob})
		case rev.ExcludeRefGlob != "":
			globs = append(globs, git.RefGlob{Exclude: rev.ExcludeRefGlob})
		default:
			revSpecs[rev.RevSpec] = struct{}{}
		}
	}
	if len(globs) > 0 {
		allRefs, err := listRefs(ctx, r.GitserverRepo())
		if err != nil {
			return nil, err
		}

		rg, err := git.CompileRefGlobs(globs)
		if err != nil {
			return nil, err
		}

		for _, ref := range allRefs {
			if rg.Match(ref.Name) {
				revSpecs[strings.TrimPrefix(ref.Name, "refs/heads/")] = struct{}{}
			}
		}
	}

	revSpecsList := make([]string, 0, len(revSpecs))
	for revSpec := range revSpecs {
		revSpecsList = append(revSpecsList, revSpec)
	}
	return revSpecsList, nil
}
// ExpandedRevSpecs evaluates all of r's ref glob expressions and returns the full, current list of
// refs matched or resolved by them, plus the explicitly listed Git revspecs. See
// git.CompileRefGlobs for information on how ref include/exclude globs are handled.
//
// Note that not all callers need to expand these. If a caller is passing the ref globs as
// command-line args to `git` directly (e.g., to `git log --glob ... --exclude ...`), it does not
// need to use this function.
ExpandedRevSpecs evaluates all of r's ref glob expressions and returns the full, current list of
refs matched or resolved by them, plus the explicitly listed Git revspecs. See
git.CompileRefGlobs for information on how ref include/exclude globs are handled.

Note that not all callers need to expand these. If a caller is passing the ref globs as
command-line args to `git` directly , it does not
need to use this function.
// ExpandedRevSpecs evaluates all of r ' s ref glob expressions and returns the full current list of // refs matched or resolved by them plus the explicitly listed Git revspecs . See // git . CompileRefGlobs for information on how ref include / exclude globs are handled . // // Note that not all callers need to expand these . If a caller is passing the ref globs as // command - line args to ` git ` directly ( e . g . to ` git log -- glob ... -- exclude ... ` ) it does not // need to use this function .
func (r *RepositoryRevisions) ExpandedRevSpecs(ctx context.Context) ([]string, error) {
	listRefs := r.ListRefs
	if listRefs == nil {
		listRefs = git.ListRefs
	}
	var (
		revSpecs = map[string]struct{}{}
		globs    []git.RefGlob
	)
	for _, rev := range r.Revs {
		switch {
		case rev.RefGlob != "":
			globs = append(globs, git.RefGlob{Include: rev.RefGlob})
		case rev.ExcludeRefGlob != "":
			globs = append(globs, git.RefGlob{Exclude: rev.ExcludeRefGlob})
		default:
			revSpecs[rev.RevSpec] = struct{}{}
		}
	}
	if len(globs) > 0 {
		allRefs, err := listRefs(ctx, r.GitserverRepo())
		if err != nil {
			return nil, err
		}
		rg, err := git.CompileRefGlobs(globs)
		if err != nil {
			return nil, err
		}
		for _, ref := range allRefs {
			if rg.Match(ref.Name) {
				revSpecs[strings.TrimPrefix(ref.Name, "refs/heads/")] = struct{}{}
			}
		}
	}
	revSpecsList := make([]string, 0, len(revSpecs))
	for revSpec := range revSpecs {
		revSpecsList = append(revSpecsList, revSpec)
	}
	return revSpecsList, nil
}
func ( r * RepositoryRevisions ) ExpandedRevSpecs ( ctx context . Context ) ( [ ] string , error ) { listRefs := r . ListRefs if listRefs == nil { listRefs = git . ListRefs } var ( revSpecs = map [ string ] struct { } { } globs [ ] git . RefGlob ) for _ , rev := range r . Revs { switch { case rev . RefGlob != " " : globs = append ( globs , git . RefGlob { Include : rev . RefGlob } ) case rev . ExcludeRefGlob != " " : globs = append ( globs , git . RefGlob { Exclude : rev . ExcludeRefGlob } ) default : revSpecs [ rev . RevSpec ] = struct { } { } } } if len ( globs ) > 0 { allRefs , err := listRefs ( ctx , r . GitserverRepo ( ) ) if err != nil { return nil , err } rg , err := git . CompileRefGlobs ( globs ) if err != nil { return nil , err } for _ , ref := range allRefs { if rg . Match ( ref . Name ) { revSpecs [ strings . TrimPrefix ( ref . Name , " " ) ] = struct { } { } } } } revSpecsList := make ( [ ] string , 0 , len ( revSpecs ) ) for revSpec := range revSpecs { revSpecsList = append ( revSpecsList , revSpec ) } return revSpecsList , nil }
ExpandedRevSpecs evaluates all of r's ref glob expressions and returns the full, current list of
refs matched or resolved by them, plus the explicitly listed Git revspecs.
ExpandedRevSpecs evaluates all of r ' s ref glob expressions and returns the full current list of refs matched or resolved by them plus the explicitly listed Git revspecs .