@@ -984,17 +984,17 @@ static int stash_count_refs(const char *refname UNUSED,
984984 return 0 ;
985985}
986986
987- static int count_stash_entries (void )
987+ static int count_stash_entries (struct repository * r )
988988{
989989 int n = 0 ;
990- refs_for_each_reflog_ent (get_main_ref_store (the_repository ),
990+ refs_for_each_reflog_ent (get_main_ref_store (r ),
991991 "refs/stash" , stash_count_refs , & n );
992992 return n ;
993993}
994994
995995static void wt_longstatus_print_stash_summary (struct wt_status * s )
996996{
997- int stash_count = count_stash_entries ();
997+ int stash_count = count_stash_entries (s -> repo );
998998
999999 if (stash_count > 0 )
10001000 status_printf_ln (s , GIT_COLOR_NORMAL ,
@@ -1287,10 +1287,10 @@ static void show_am_in_progress(struct wt_status *s,
12871287 wt_longstatus_print_trailer (s );
12881288}
12891289
1290- static char * read_line_from_git_path (const char * filename )
1290+ static char * read_line_from_git_path (struct repository * r , const char * filename )
12911291{
12921292 struct strbuf buf = STRBUF_INIT ;
1293- FILE * fp = fopen_or_warn (repo_git_path_append (the_repository , & buf ,
1293+ FILE * fp = fopen_or_warn (repo_git_path_append (r , & buf ,
12941294 "%s" , filename ), "r" );
12951295
12961296 if (!fp ) {
@@ -1325,8 +1325,8 @@ static int split_commit_in_progress(struct wt_status *s)
13251325 if (head_flags & REF_ISSYMREF || orig_head_flags & REF_ISSYMREF )
13261326 return 0 ;
13271327
1328- rebase_amend = read_line_from_git_path ("rebase-merge/amend" );
1329- rebase_orig_head = read_line_from_git_path ("rebase-merge/orig-head" );
1328+ rebase_amend = read_line_from_git_path (s -> repo , "rebase-merge/amend" );
1329+ rebase_orig_head = read_line_from_git_path (s -> repo , "rebase-merge/orig-head" );
13301330
13311331 if (!rebase_amend || !rebase_orig_head )
13321332 ; /* fall through, no split in progress */
@@ -1350,7 +1350,7 @@ static int split_commit_in_progress(struct wt_status *s)
13501350 * The function assumes that the line does not contain useless spaces
13511351 * before or after the command.
13521352 */
1353- static void abbrev_oid_in_line (struct strbuf * line )
1353+ static void abbrev_oid_in_line (struct repository * r , struct strbuf * line )
13541354{
13551355 struct string_list split = STRING_LIST_INIT_DUP ;
13561356 struct object_id oid ;
@@ -1362,7 +1362,7 @@ static void abbrev_oid_in_line(struct strbuf *line)
13621362 return ;
13631363
13641364 if ((2 <= string_list_split (& split , line -> buf , " " , 2 )) &&
1365- !repo_get_oid (the_repository , split .items [1 ].string , & oid )) {
1365+ !repo_get_oid (r , split .items [1 ].string , & oid )) {
13661366 strbuf_reset (line );
13671367 strbuf_addf (line , "%s " , split .items [0 ].string );
13681368 strbuf_add_unique_abbrev (line , & oid , DEFAULT_ABBREV );
@@ -1372,10 +1372,10 @@ static void abbrev_oid_in_line(struct strbuf *line)
13721372 string_list_clear (& split , 0 );
13731373}
13741374
1375- static int read_rebase_todolist (const char * fname , struct string_list * lines )
1375+ static int read_rebase_todolist (struct repository * r , const char * fname , struct string_list * lines )
13761376{
13771377 struct strbuf buf = STRBUF_INIT ;
1378- FILE * f = fopen (repo_git_path_append (the_repository , & buf , "%s" , fname ), "r" );
1378+ FILE * f = fopen (repo_git_path_append (r , & buf , "%s" , fname ), "r" );
13791379 int ret ;
13801380
13811381 if (!f ) {
@@ -1384,15 +1384,15 @@ static int read_rebase_todolist(const char *fname, struct string_list *lines)
13841384 goto out ;
13851385 }
13861386 die_errno ("Could not open file %s for reading" ,
1387- repo_git_path_replace (the_repository , & buf , "%s" , fname ));
1387+ repo_git_path_replace (r , & buf , "%s" , fname ));
13881388 }
13891389 while (!strbuf_getline_lf (& buf , f )) {
13901390 if (starts_with (buf .buf , comment_line_str ))
13911391 continue ;
13921392 strbuf_trim (& buf );
13931393 if (!buf .len )
13941394 continue ;
1395- abbrev_oid_in_line (& buf );
1395+ abbrev_oid_in_line (r , & buf );
13961396 string_list_append (lines , buf .buf );
13971397 }
13981398 fclose (f );
@@ -1413,8 +1413,8 @@ static void show_rebase_information(struct wt_status *s,
14131413 struct string_list have_done = STRING_LIST_INIT_DUP ;
14141414 struct string_list yet_to_do = STRING_LIST_INIT_DUP ;
14151415
1416- read_rebase_todolist ("rebase-merge/done" , & have_done );
1417- if (read_rebase_todolist ("rebase-merge/git-rebase-todo" ,
1416+ read_rebase_todolist (s -> repo , "rebase-merge/done" , & have_done );
1417+ if (read_rebase_todolist (s -> repo , "rebase-merge/git-rebase-todo" ,
14181418 & yet_to_do ))
14191419 status_printf_ln (s , color ,
14201420 _ ("git-rebase-todo is missing." ));
@@ -2259,7 +2259,7 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
22592259 */
22602260static void wt_porcelain_v2_print_stash (struct wt_status * s )
22612261{
2262- int stash_count = count_stash_entries ();
2262+ int stash_count = count_stash_entries (s -> repo );
22632263 char eol = s -> null_termination ? '\0' : '\n' ;
22642264
22652265 if (stash_count > 0 )
0 commit comments