6
6
* Copyright (C) Linus Torvalds, 2005
7
7
*/
8
8
9
- #define USE_THE_REPOSITORY_VARIABLE
10
9
#define DISABLE_SIGN_COMPARE_WARNINGS
11
10
12
11
#include "builtin.h"
@@ -245,12 +244,13 @@ static void show_submodule(struct repository *superproject,
245
244
repo_clear (& subrepo );
246
245
}
247
246
248
- static void expand_objectsize (struct strbuf * line , const struct object_id * oid ,
247
+ static void expand_objectsize (struct repository * repo , struct strbuf * line ,
248
+ const struct object_id * oid ,
249
249
const enum object_type type , unsigned int padded )
250
250
{
251
251
if (type == OBJ_BLOB ) {
252
252
unsigned long size ;
253
- if (oid_object_info (the_repository , oid , & size ) < 0 )
253
+ if (oid_object_info (repo , oid , & size ) < 0 )
254
254
die (_ ("could not get object info about '%s'" ),
255
255
oid_to_hex (oid ));
256
256
if (padded )
@@ -283,10 +283,10 @@ static void show_ce_fmt(struct repository *repo, const struct cache_entry *ce,
283
283
else if (skip_prefix (format , "(objecttype)" , & format ))
284
284
strbuf_addstr (& sb , type_name (object_type (ce -> ce_mode )));
285
285
else if (skip_prefix (format , "(objectsize:padded)" , & format ))
286
- expand_objectsize (& sb , & ce -> oid ,
286
+ expand_objectsize (repo , & sb , & ce -> oid ,
287
287
object_type (ce -> ce_mode ), 1 );
288
288
else if (skip_prefix (format , "(objectsize)" , & format ))
289
- expand_objectsize (& sb , & ce -> oid ,
289
+ expand_objectsize (repo , & sb , & ce -> oid ,
290
290
object_type (ce -> ce_mode ), 0 );
291
291
else if (skip_prefix (format , "(stage)" , & format ))
292
292
strbuf_addf (& sb , "%d" , ce_stage (ce ));
@@ -348,7 +348,7 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
348
348
}
349
349
}
350
350
351
- static void show_ru_info (struct index_state * istate )
351
+ static void show_ru_info (struct repository * repo , struct index_state * istate )
352
352
{
353
353
struct string_list_item * item ;
354
354
@@ -370,7 +370,7 @@ static void show_ru_info(struct index_state *istate)
370
370
if (!ui -> mode [i ])
371
371
continue ;
372
372
printf ("%s%06o %s %d\t" , tag_resolve_undo , ui -> mode [i ],
373
- repo_find_unique_abbrev (the_repository , & ui -> oid [i ], abbrev ),
373
+ repo_find_unique_abbrev (repo , & ui -> oid [i ], abbrev ),
374
374
i + 1 );
375
375
write_name (path );
376
376
}
@@ -567,7 +567,7 @@ static int option_parse_exclude_standard(const struct option *opt,
567
567
int cmd_ls_files (int argc ,
568
568
const char * * argv ,
569
569
const char * cmd_prefix ,
570
- struct repository * repo UNUSED )
570
+ struct repository * repo )
571
571
{
572
572
int require_work_tree = 0 , show_tag = 0 , i ;
573
573
char * max_prefix ;
@@ -647,15 +647,15 @@ int cmd_ls_files(int argc,
647
647
show_usage_with_options_if_asked (argc , argv ,
648
648
ls_files_usage , builtin_ls_files_options );
649
649
650
- prepare_repo_settings (the_repository );
651
- the_repository -> settings .command_requires_full_index = 0 ;
650
+ prepare_repo_settings (repo );
651
+ repo -> settings .command_requires_full_index = 0 ;
652
652
653
653
prefix = cmd_prefix ;
654
654
if (prefix )
655
655
prefix_len = strlen (prefix );
656
- git_config ( git_default_config , NULL );
656
+ repo_config ( repo , git_default_config , NULL );
657
657
658
- if (repo_read_index (the_repository ) < 0 )
658
+ if (repo_read_index (repo ) < 0 )
659
659
die ("index file corrupt" );
660
660
661
661
argc = parse_options (argc , argv , prefix , builtin_ls_files_options ,
@@ -724,7 +724,7 @@ int cmd_ls_files(int argc,
724
724
max_prefix = common_prefix (& pathspec );
725
725
max_prefix_len = get_common_prefix_len (max_prefix );
726
726
727
- prune_index (the_repository -> index , max_prefix , max_prefix_len );
727
+ prune_index (repo -> index , max_prefix , max_prefix_len );
728
728
729
729
/* Treat unmatching pathspec elements as errors */
730
730
if (pathspec .nr && error_unmatch )
@@ -748,13 +748,13 @@ int cmd_ls_files(int argc,
748
748
*/
749
749
if (show_stage || show_unmerged )
750
750
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 );
751
+ overlay_tree_on_index (repo -> index , with_tree , max_prefix );
752
752
}
753
753
754
- show_files (the_repository , & dir );
754
+ show_files (repo , & dir );
755
755
756
756
if (show_resolve_undo )
757
- show_ru_info (the_repository -> index );
757
+ show_ru_info (repo , repo -> index );
758
758
759
759
if (ps_matched && report_path_error (ps_matched , & pathspec )) {
760
760
fprintf (stderr , "Did you forget to 'git add'?\n" );
0 commit comments