IsBare returns whether or not a repository is bare. It requires that the current working directory is a repository. If there was an error determining whether or not the repository is bare, it will be returned.
()
| 1115 | // If there was an error determining whether or not the repository is bare, it |
| 1116 | // will be returned. |
| 1117 | func IsBare() (bool, error) { |
| 1118 | s, err := subprocess.SimpleExec( |
| 1119 | "git", "rev-parse", "--is-bare-repository") |
| 1120 | |
| 1121 | if err != nil { |
| 1122 | return false, err |
| 1123 | } |
| 1124 | |
| 1125 | return strconv.ParseBool(s) |
| 1126 | } |
| 1127 | |
| 1128 | // For compatibility with git clone we must mirror all flags in CloneWithoutFilters |
| 1129 | type CloneFlags struct { |
no test coverage detected