Commit9b25a0b
config: add include directive
It can be useful to split your ~/.gitconfig across multiplefiles. For example, you might have a "main" file which isused on many machines, but a small set of per-machinetweaks. Or you may want to make some of your config public(e.g., clever aliases) while keeping other data back (e.g.,your name or other identifying information). Or you may wantto include a number of config options in some subset of yourrepos without copying and pasting (e.g., you want toreference them from the .git/config of participating repos).This patch introduces an include directive for config files.It looks like: [include] path = /path/to/fileThis is syntactically backwards-compatible with existing gitconfig parsers (i.e., they will see it as another configentry and ignore it unless you are looking up include.path).The implementation provides a "git_config_include" callbackwhich wraps regular config callbacks. Callers can pass it togit_config_from_file, and it will transparently follow anyinclude directives, passing all of the discovered options tothe real callback.Include directives are turned on automatically for "regular"git config parsing. This includes calls to git_config, aswell as calls to the "git config" program that do notspecify a single file (e.g., using "-f", "--global", etc).They are not turned on in other cases, including: 1. Parsing of other config-like files, like .gitmodules. There isn't a real need, and I'd rather be conservative and avoid unnecessary incompatibility or confusion. 2. Reading single files via "git config". This is for two reasons: a. backwards compatibility with scripts looking at config-like files. b. inspection of a specific file probably means you care about just what's in that file, not a general lookup for "do we have this value anywhere at all". If that is not the case, the caller can always specify "--includes". 3. Writing files via "git config"; we want to treat include.* variables as literal items to be copied (or modified), and not expand them. So "git config --unset-all foo.bar" would operate _only_ on .git/config, not any of its included files (just as it also does not operate on ~/.gitconfig).Signed-off-by: Jeff King <peff@peff.net>Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent4a7bb5b commit9b25a0b
File tree
7 files changed
+292
-14
lines changed- Documentation
- technical
- builtin
- t
7 files changed
+292
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
87 | 98 | | |
88 | 99 | | |
89 | 100 | | |
| |||
106 | 117 | | |
107 | 118 | | |
108 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
109 | 124 | | |
110 | 125 | | |
111 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
111 | 137 | | |
112 | 138 | | |
113 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
164 | 169 | | |
165 | 170 | | |
166 | 171 | | |
| |||
213 | 218 | | |
214 | 219 | | |
215 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
216 | 230 | | |
217 | | - | |
| 231 | + | |
218 | 232 | | |
219 | | - | |
| 233 | + | |
220 | 234 | | |
221 | | - | |
222 | | - | |
| 235 | + | |
| 236 | + | |
223 | 237 | | |
224 | | - | |
| 238 | + | |
225 | 239 | | |
226 | | - | |
| 240 | + | |
227 | 241 | | |
228 | | - | |
| 242 | + | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| |||
302 | 316 | | |
303 | 317 | | |
304 | 318 | | |
305 | | - | |
| 319 | + | |
306 | 320 | | |
307 | 321 | | |
308 | 322 | | |
| |||
330 | 344 | | |
331 | 345 | | |
332 | 346 | | |
333 | | - | |
| 347 | + | |
334 | 348 | | |
335 | 349 | | |
336 | 350 | | |
| |||
387 | 401 | | |
388 | 402 | | |
389 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
390 | 407 | | |
391 | 408 | | |
392 | 409 | | |
| |||
424 | 441 | | |
425 | 442 | | |
426 | 443 | | |
427 | | - | |
| 444 | + | |
| 445 | + | |
428 | 446 | | |
429 | 447 | | |
430 | 448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1113 | 1113 | | |
1114 | 1114 | | |
1115 | 1115 | | |
1116 | | - | |
| 1116 | + | |
| 1117 | + | |
1117 | 1118 | | |
1118 | 1119 | | |
1119 | 1120 | | |
| |||
1140 | 1141 | | |
1141 | 1142 | | |
1142 | 1143 | | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1143 | 1152 | | |
1144 | 1153 | | |
1145 | 1154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
29 | 92 | | |
30 | 93 | | |
31 | 94 | | |
| |||
913 | 976 | | |
914 | 977 | | |
915 | 978 | | |
916 | | - | |
| 979 | + | |
917 | 980 | | |
918 | 981 | | |
919 | 982 | | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
920 | 991 | | |
921 | 992 | | |
922 | 993 | | |
| |||
934 | 1005 | | |
935 | 1006 | | |
936 | 1007 | | |
937 | | - | |
| 1008 | + | |
938 | 1009 | | |
939 | 1010 | | |
940 | 1011 | | |
| |||
0 commit comments
Comments
(0)