Commit 924aaf3
config.c: Make git_config() work correctly when called recursively
On Cygwin, this fixes a test failure in t3301-notes.sh (test 98,
"git notes copy --for-rewrite (disabled)").
The test failure is caused by a recursive call to git_config() which
has the effect of skipping to the end-of-file while processing the
"notes.rewriteref" config variable. Thus, any config variables that
appear after "notes.rewriteref" are simply ignored by git_config().
Also, we note that the original FILE handle is leaked as a result
of the recursive call.
The recursive call to git_config() is due to the "schizophrenic stat"
functions on cygwin, where one of two different implementations of
the l/stat functions is selected lazily, depending on some config
variables.
In this case, the init_copy_notes_for_rewrite() function calls
git_config() with the notes_rewrite_config() callback function.
This callback, while processing the "notes.rewriteref" variable,
in turn calls string_list_add_refs_by_glob() to process the
associated ref value. This eventually leads to a call to the
get_ref_dir() function, which in turn calls stat(). On cygwin,
the stat() macro leads to an indirect call to cygwin_stat_stub()
which, via init_stat(), then calls git_config() in order to
determine which l/stat implementation to bind to.
In order to solve this problem, we modify git_config() so that the
global state variables used by the config reading code is packaged
up and managed on a local state stack.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 452993c commit 924aaf3
1 file changed
+50
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
| |||
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
102 | | - | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
113 | | - | |
| 121 | + | |
114 | 122 | | |
115 | | - | |
| 123 | + | |
116 | 124 | | |
117 | 125 | | |
118 | 126 | | |
| |||
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
124 | | - | |
125 | 132 | | |
126 | 133 | | |
127 | | - | |
| 134 | + | |
128 | 135 | | |
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
133 | | - | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
138 | | - | |
| 145 | + | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
| |||
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
149 | | - | |
| 156 | + | |
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
| |||
168 | 175 | | |
169 | 176 | | |
170 | 177 | | |
171 | | - | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
176 | 183 | | |
177 | 184 | | |
178 | | - | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| |||
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
195 | | - | |
| 202 | + | |
196 | 203 | | |
197 | 204 | | |
198 | 205 | | |
| |||
256 | 263 | | |
257 | 264 | | |
258 | 265 | | |
259 | | - | |
| 266 | + | |
260 | 267 | | |
261 | 268 | | |
262 | 269 | | |
| |||
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
277 | | - | |
| 284 | + | |
278 | 285 | | |
279 | 286 | | |
280 | 287 | | |
| |||
298 | 305 | | |
299 | 306 | | |
300 | 307 | | |
301 | | - | |
| 308 | + | |
302 | 309 | | |
303 | 310 | | |
304 | 311 | | |
| |||
323 | 330 | | |
324 | 331 | | |
325 | 332 | | |
326 | | - | |
| 333 | + | |
327 | 334 | | |
328 | 335 | | |
329 | 336 | | |
| |||
374 | 381 | | |
375 | 382 | | |
376 | 383 | | |
377 | | - | |
378 | | - | |
| 384 | + | |
| 385 | + | |
379 | 386 | | |
380 | 387 | | |
381 | 388 | | |
| |||
795 | 802 | | |
796 | 803 | | |
797 | 804 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
802 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
803 | 822 | | |
804 | | - | |
805 | 823 | | |
806 | 824 | | |
807 | 825 | | |
| |||
909 | 927 | | |
910 | 928 | | |
911 | 929 | | |
| 930 | + | |
912 | 931 | | |
913 | 932 | | |
914 | 933 | | |
| |||
920 | 939 | | |
921 | 940 | | |
922 | 941 | | |
923 | | - | |
| 942 | + | |
924 | 943 | | |
925 | 944 | | |
926 | 945 | | |
| |||
947 | 966 | | |
948 | 967 | | |
949 | 968 | | |
950 | | - | |
| 969 | + | |
951 | 970 | | |
952 | 971 | | |
953 | 972 | | |
954 | 973 | | |
955 | | - | |
| 974 | + | |
956 | 975 | | |
957 | 976 | | |
958 | 977 | | |
959 | 978 | | |
960 | 979 | | |
961 | 980 | | |
962 | | - | |
| 981 | + | |
963 | 982 | | |
964 | 983 | | |
965 | 984 | | |
| |||
1415 | 1434 | | |
1416 | 1435 | | |
1417 | 1436 | | |
| 1437 | + | |
1418 | 1438 | | |
1419 | 1439 | | |
1420 | 1440 | | |
| |||
0 commit comments