@@ -42,7 +42,7 @@ static void color_set(char *dst, const char *color_bytes)
4242 * We could let the compiler do this, but without C99 initializers
4343 * the code gets unwieldy and unreadable, so...
4444 */
45- void init_grep_defaults (void )
45+ void init_grep_defaults (struct repository * repo )
4646{
4747 struct grep_opt * opt = & grep_defaults ;
4848 static int run_once ;
@@ -52,6 +52,7 @@ void init_grep_defaults(void)
5252 run_once ++ ;
5353
5454 memset (opt , 0 , sizeof (* opt ));
55+ opt -> repo = repo ;
5556 opt -> relative = 1 ;
5657 opt -> pathname = 1 ;
5758 opt -> max_depth = -1 ;
@@ -149,12 +150,13 @@ int grep_config(const char *var, const char *value, void *cb)
149150 * default values from the template we read the configuration
150151 * information in an earlier call to git_config(grep_config).
151152 */
152- void grep_init (struct grep_opt * opt , const char * prefix )
153+ void grep_init (struct grep_opt * opt , struct repository * repo , const char * prefix )
153154{
154155 struct grep_opt * def = & grep_defaults ;
155156 int i ;
156157
157158 memset (opt , 0 , sizeof (* opt ));
159+ opt -> repo = repo ;
158160 opt -> prefix = prefix ;
159161 opt -> prefix_length = (prefix && * prefix ) ? strlen (prefix ) : 0 ;
160162 opt -> pattern_tail = & opt -> pattern_list ;
@@ -1708,7 +1710,8 @@ static int look_ahead(struct grep_opt *opt,
17081710 return 0 ;
17091711}
17101712
1711- static int fill_textconv_grep (struct userdiff_driver * driver ,
1713+ static int fill_textconv_grep (struct repository * r ,
1714+ struct userdiff_driver * driver ,
17121715 struct grep_source * gs )
17131716{
17141717 struct diff_filespec * df ;
@@ -1741,7 +1744,7 @@ static int fill_textconv_grep(struct userdiff_driver *driver,
17411744 * structure.
17421745 */
17431746 grep_read_lock ();
1744- size = fill_textconv (the_repository , driver , df , & buf );
1747+ size = fill_textconv (r , driver , df , & buf );
17451748 grep_read_unlock ();
17461749 free_filespec (df );
17471750
@@ -1837,7 +1840,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
18371840
18381841 try_lookahead = should_lookahead (opt );
18391842
1840- if (fill_textconv_grep (textconv , gs ) < 0 )
1843+ if (fill_textconv_grep (opt -> repo , textconv , gs ) < 0 )
18411844 return 0 ;
18421845
18431846 bol = gs -> buf ;
0 commit comments