Commit b7dfe39
committed
find git-dir directly and look up work-tree
This enables mgitstatus to handle repositories with non-standard work
tree locations (such as those used by yadm). It can discover these, or
the user can explicitly list the path to the git-dir.
Two broad strokes to this:
1. Instead of checking every sub-directory for a .git directory in the
standard location, search directly for directories matching "*.git".
- Since *standard* .git directories will be one level deeper in the
tree, this adds 1 to DEPTH.
- Since we're looking for the .git directory itself, I think we can
use -prune to skip searching within those matching directories.
2. Use `git rev-parse --show-toplevel` to look up the work tree. As
far as I can tell, this will report the path of a non-standard
work tree. This will error (and print nothing) on a standard repo.
If that fails to produce output, fall back on the existing guess
that the work tree will be the parent directory of the git-dir.
Most of the diff is from computing this once (as PROJ_DIR) and
replacing instances of `$(dirname "$GIT_DIR")` with it.1 parent 852ee02 commit b7dfe39
1 file changed
Lines changed: 28 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
162 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
163 | 180 | | |
164 | 181 | | |
165 | 182 | | |
166 | | - | |
| 183 | + | |
167 | 184 | | |
168 | | - | |
169 | | - | |
170 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
171 | 188 | | |
172 | 189 | | |
173 | 190 | | |
| |||
201 | 218 | | |
202 | 219 | | |
203 | 220 | | |
204 | | - | |
| 221 | + | |
205 | 222 | | |
206 | 223 | | |
207 | 224 | | |
208 | | - | |
| 225 | + | |
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
| |||
269 | 286 | | |
270 | 287 | | |
271 | 288 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
278 | 293 | | |
279 | 294 | | |
280 | 295 | | |
| |||
0 commit comments