You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 46ffc0b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/COMPATIBILITY.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,7 @@ in [GIT-BEHAVIOUR.md](GIT-BEHAVIOUR.md).
76
76
| Repository ownership check | done when git finds the repository, not for `GIT_DIR`| done by `Discover`, not for an `Env` filled by hand | 1 (X5) |
77
77
| What is checked, and listed in `safe.directory`| depends on where git starts: a working tree, or a git directory | the same, from the path given to `Discover`| 1 — the caller should pass the working tree, which users list |
78
78
| Untrusted repository |`git config` silently skips the local scope; other commands fail |`Discover` fails with `ErrUntrusted`| a silently missing scope surprises; reading less is not safer than refusing — *safe default*|
79
+
|`Discover` given a directory that is not a repository | git searches the parent directories, and fails with "not a git repository" when there is none |`ErrNotRepository`: a git directory must hold a `HEAD` file, and its common directory `objects/` and `refs/` directories, as for git, which also requires `HEAD` to hold a ref or an object name |`Discover` does not search; reading any directory's `config` as the local scope would read and write a file that is not git's — *safe default*|
79
80
|`SUDO_UID` = `' 1000'`, `+1000`, or beyond 32 bits | accepted; a value beyond 32 bits wraps around (2³² + 1000 is 1000) | ignored: digits only, at most 32 bits | the wrap-around trusts a user nobody named — *safe default*|
80
81
| Administrators group on Windows | trusted for an administrator (Git for Windows commit messages, 2022 and 2025) | the same | 1 — not observed: no Windows git to run but CI's |
81
82
| UNC paths on Windows | must be listed in `safe.directory` since Git for Windows 2.54 (release notes) | owner checked like any path | the release note is not precise enough to follow; not observed |
Copy file name to clipboardExpand all lines: docs/GIT-BEHAVIOUR.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -300,3 +300,34 @@ tree; started in a git directory, it checks that directory alone, and
300
300
| the same, `/r/dots` owned by `bob`, `safe.directory=/r/dots` / `=/r/home`| accepted / refused, at `/r/dots`|
301
301
|`--separate-git-dir=/r/sep/x` for `/r/w`, `/r/w` owned by `bob`, `git -C /r/sep/x`| accepted |
302
302
| linked worktree `/r/lw` owned by `bob`, `git -C /r/w/.git/worktrees/lw` / `git -C /r/lw`| accepted / refused, at `/r/lw`|
303
+
304
+
## What is a repository
305
+
306
+
Observed with git 2.47.3, as `git rev-parse --git-dir` run in `/r/w` with
307
+
`GIT_CEILING_DIRECTORIES=/r`. "Refused" means `fatal: not a git repository`.
308
+
Unless stated, `/r/w/.git` holds `HEAD` (`ref: refs/heads/main`) and the
309
+
directories `objects` and `refs`.
310
+
311
+
|`/r/w/.git`| Result |
312
+
|---|---|
313
+
| as stated | accepted |
314
+
|`HEAD` alone | refused |
315
+
| no `objects`, or no `refs`| refused |
316
+
|`objects` or `refs` a regular file | refused |
317
+
|`objects` a symbolic link to a directory | accepted |
318
+
|`HEAD` a directory | refused |
319
+
|`HEAD` holding `garbage`| refused |
320
+
|`HEAD` holding an object name | accepted |
321
+
|`HEAD` a symbolic link to `refs/heads/main`, which does not exist | accepted |
322
+
|`HEAD` a symbolic link to a directory | accepted |
323
+
| created by `git init --ref-format=reftable`: `refs` is a directory holding a regular file `heads`, `HEAD` holds `ref: refs/heads/.invalid`| accepted |
324
+
325
+
A linked worktree's git directory, `/r/w/.git/worktrees/lw`, holds `HEAD`
326
+
and `commondir` (`../..`) but no `objects`:
327
+
328
+
| Linked worktree `/r/lw`| Result |
329
+
|---|---|
330
+
| as created by `git worktree add`| accepted |
331
+
| no `refs` in `worktrees/lw`| accepted |
332
+
| no `refs`, or no `objects`, in `/r/w/.git`| refused |
0 commit comments