MCPcopy Create free account
hub / github.com/go-git/go-git / String

Method String

submodule.go:377–398  ·  view source on GitHub ↗

String is equivalent to `git submodule status ` This will print the SHA-1 of the currently checked out commit for a submodule, along with the submodule path and the output of git describe fo the SHA-1. Each SHA-1 will be prefixed with - if the submodule is not initialized, + if the curre

()

Source from the content-addressed store, hash-verified

375// initialized, + if the currently checked out submodule commit does not match
376// the SHA-1 found in the index of the containing repository.
377func (s *SubmoduleStatus) String() string {
378 var extra string
379 var status = ' '
380
381 if s.Current.IsZero() {
382 status = '-'
383 } else if !s.IsClean() {
384 status = '+'
385 }
386
387 if len(s.Branch) != 0 {
388 extra = string(s.Branch[5:])
389 } else if !s.Current.IsZero() {
390 extra = s.Current.String()[:7]
391 }
392
393 if extra != "" {
394 extra = fmt.Sprintf(" (%s)", extra)
395 }
396
397 return fmt.Sprintf("%c%s %s%s", status, s.Expected, s.Path, extra)
398}

Callers

nothing calls this directly

Calls 3

IsCleanMethod · 0.95
IsZeroMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected