Commit 21985a1
git-gui: handle non-standard worktree locations
Don't rely on the git worktree being the updir of the gitdir, since it
might not be. Instead, define (and use) a new _gitworktree global
variable, setting it to $GIT_WORK_TREE if present, falling back to
core.worktree if defined, and finally to whatever we guess the correct
worktree is. Getting core.worktree requires the config from the alleged
git dir _gitdir to be loaded early.
Supporting non-standard worktree locations also breaks the git-gui
assumption (made when calling gitk) that the worktree was the dirname of
$_gitdir and that, by consequence, the git dir could be set to the tail
of $_gitdir once we changed to the worktree root directory. Therefore,
we need to export a GIT_DIR environment variable set to the full,
normalized path of $_gitdir instead. We also skip changing to the worktree
directory if it's empty (i.e. if we're working on a bare repository).
Signed-off-by: Giuseppe Bilotta <[email protected]>
Signed-off-by: Shawn O. Pearce <[email protected]>1 parent ff07c3b commit 21985a1
1 file changed
+28
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
1100 | 1101 | | |
1101 | 1102 | | |
1102 | 1103 | | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1103 | 1111 | | |
1104 | | - | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
1105 | 1117 | | |
1106 | 1118 | | |
1107 | 1119 | | |
1108 | 1120 | | |
1109 | 1121 | | |
| 1122 | + | |
1110 | 1123 | | |
1111 | 1124 | | |
1112 | 1125 | | |
1113 | 1126 | | |
1114 | 1127 | | |
1115 | 1128 | | |
1116 | 1129 | | |
1117 | | - | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1118 | 1134 | | |
1119 | | - | |
| 1135 | + | |
1120 | 1136 | | |
1121 | 1137 | | |
| 1138 | + | |
1122 | 1139 | | |
1123 | 1140 | | |
1124 | 1141 | | |
| |||
1935 | 1952 | | |
1936 | 1953 | | |
1937 | 1954 | | |
| 1955 | + | |
1938 | 1956 | | |
1939 | 1957 | | |
1940 | 1958 | | |
| |||
1955 | 1973 | | |
1956 | 1974 | | |
1957 | 1975 | | |
1958 | | - | |
1959 | | - | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1960 | 1980 | | |
1961 | 1981 | | |
1962 | 1982 | | |
| |||
2032 | 2052 | | |
2033 | 2053 | | |
2034 | 2054 | | |
| 2055 | + | |
2035 | 2056 | | |
2036 | 2057 | | |
2037 | 2058 | | |
| |||
2041 | 2062 | | |
2042 | 2063 | | |
2043 | 2064 | | |
2044 | | - | |
| 2065 | + | |
2045 | 2066 | | |
2046 | 2067 | | |
2047 | 2068 | | |
| |||
2405 | 2426 | | |
2406 | 2427 | | |
2407 | 2428 | | |
2408 | | - | |
2409 | | - | |
2410 | 2429 | | |
2411 | 2430 | | |
2412 | 2431 | | |
| |||
3492 | 3511 | | |
3493 | 3512 | | |
3494 | 3513 | | |
3495 | | - | |
| 3514 | + | |
3496 | 3515 | | |
3497 | 3516 | | |
3498 | 3517 | | |
| |||
0 commit comments