66 * Copyright (C) Linus Torvalds, 2005
77 */
88
9- #define USE_THE_REPOSITORY_VARIABLE
109#define DISABLE_SIGN_COMPARE_WARNINGS
1110
1211#include "builtin.h"
@@ -234,7 +233,8 @@ static void show_submodule(struct repository *superproject,
234233{
235234 struct repository subrepo ;
236235
237- if (repo_submodule_init (& subrepo , superproject , path , null_oid (the_hash_algo )))
236+ if (repo_submodule_init (& subrepo , superproject , path ,
237+ null_oid (superproject -> hash_algo )))
238238 return ;
239239
240240 if (repo_read_index (& subrepo ) < 0 )
@@ -245,12 +245,13 @@ static void show_submodule(struct repository *superproject,
245245 repo_clear (& subrepo );
246246}
247247
248- static void expand_objectsize (struct strbuf * line , const struct object_id * oid ,
248+ static void expand_objectsize (struct repository * repo , struct strbuf * line ,
249+ const struct object_id * oid ,
249250 const enum object_type type , unsigned int padded )
250251{
251252 if (type == OBJ_BLOB ) {
252253 unsigned long size ;
253- if (oid_object_info (the_repository , oid , & size ) < 0 )
254+ if (oid_object_info (repo , oid , & size ) < 0 )
254255 die (_ ("could not get object info about '%s'" ),
255256 oid_to_hex (oid ));
256257 if (padded )
@@ -283,10 +284,10 @@ static void show_ce_fmt(struct repository *repo, const struct cache_entry *ce,
283284 else if (skip_prefix (format , "(objecttype)" , & format ))
284285 strbuf_addstr (& sb , type_name (object_type (ce -> ce_mode )));
285286 else if (skip_prefix (format , "(objectsize:padded)" , & format ))
286- expand_objectsize (& sb , & ce -> oid ,
287+ expand_objectsize (repo , & sb , & ce -> oid ,
287288 object_type (ce -> ce_mode ), 1 );
288289 else if (skip_prefix (format , "(objectsize)" , & format ))
289- expand_objectsize (& sb , & ce -> oid ,
290+ expand_objectsize (repo , & sb , & ce -> oid ,
290291 object_type (ce -> ce_mode ), 0 );
291292 else if (skip_prefix (format , "(stage)" , & format ))
292293 strbuf_addf (& sb , "%d" , ce_stage (ce ));
@@ -348,7 +349,7 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
348349 }
349350}
350351
351- static void show_ru_info (struct index_state * istate )
352+ static void show_ru_info (struct repository * repo , struct index_state * istate )
352353{
353354 struct string_list_item * item ;
354355
@@ -370,7 +371,7 @@ static void show_ru_info(struct index_state *istate)
370371 if (!ui -> mode [i ])
371372 continue ;
372373 printf ("%s%06o %s %d\t" , tag_resolve_undo , ui -> mode [i ],
373- repo_find_unique_abbrev (the_repository , & ui -> oid [i ], abbrev ),
374+ repo_find_unique_abbrev (repo , & ui -> oid [i ], abbrev ),
374375 i + 1 );
375376 write_name (path );
376377 }
@@ -567,7 +568,7 @@ static int option_parse_exclude_standard(const struct option *opt,
567568int cmd_ls_files (int argc ,
568569 const char * * argv ,
569570 const char * cmd_prefix ,
570- struct repository * repo UNUSED )
571+ struct repository * repo )
571572{
572573 int require_work_tree = 0 , show_tag = 0 , i ;
573574 char * max_prefix ;
@@ -647,15 +648,15 @@ int cmd_ls_files(int argc,
647648 show_usage_with_options_if_asked (argc , argv ,
648649 ls_files_usage , builtin_ls_files_options );
649650
650- prepare_repo_settings (the_repository );
651- the_repository -> settings .command_requires_full_index = 0 ;
651+ prepare_repo_settings (repo );
652+ repo -> settings .command_requires_full_index = 0 ;
652653
653654 prefix = cmd_prefix ;
654655 if (prefix )
655656 prefix_len = strlen (prefix );
656- git_config ( git_default_config , NULL );
657+ repo_config ( repo , git_default_config , NULL );
657658
658- if (repo_read_index (the_repository ) < 0 )
659+ if (repo_read_index (repo ) < 0 )
659660 die ("index file corrupt" );
660661
661662 argc = parse_options (argc , argv , prefix , builtin_ls_files_options ,
@@ -724,7 +725,7 @@ int cmd_ls_files(int argc,
724725 max_prefix = common_prefix (& pathspec );
725726 max_prefix_len = get_common_prefix_len (max_prefix );
726727
727- prune_index (the_repository -> index , max_prefix , max_prefix_len );
728+ prune_index (repo -> index , max_prefix , max_prefix_len );
728729
729730 /* Treat unmatching pathspec elements as errors */
730731 if (pathspec .nr && error_unmatch )
@@ -748,13 +749,13 @@ int cmd_ls_files(int argc,
748749 */
749750 if (show_stage || show_unmerged )
750751 die (_ ("options '%s' and '%s' cannot be used together" ), "ls-files --with-tree" , "-s/-u" );
751- overlay_tree_on_index (the_repository -> index , with_tree , max_prefix );
752+ overlay_tree_on_index (repo -> index , with_tree , max_prefix );
752753 }
753754
754- show_files (the_repository , & dir );
755+ show_files (repo , & dir );
755756
756757 if (show_resolve_undo )
757- show_ru_info (the_repository -> index );
758+ show_ru_info (repo , repo -> index );
758759
759760 if (ps_matched && report_path_error (ps_matched , & pathspec )) {
760761 fprintf (stderr , "Did you forget to 'git add'?\n" );
0 commit comments