@@ -115,7 +115,12 @@ static void remove_redundant_pack(const char *dir_name, const char *base_name)
115
115
116
116
int cmd_repack (int argc , const char * * argv , const char * prefix )
117
117
{
118
- const char * exts [] = {".pack" , ".idx" };
118
+ struct {
119
+ const char * name ;
120
+ } exts [] = {
121
+ {".pack" },
122
+ {".idx" },
123
+ };
119
124
struct child_process cmd ;
120
125
struct string_list_item * item ;
121
126
struct argv_array cmd_args = ARGV_ARRAY_INIT ;
@@ -261,14 +266,14 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
261
266
for (ext = 0 ; ext < ARRAY_SIZE (exts ); ext ++ ) {
262
267
char * fname , * fname_old ;
263
268
fname = mkpathdup ("%s/%s%s" , packdir ,
264
- item -> string , exts [ext ]);
269
+ item -> string , exts [ext ]. name );
265
270
if (!file_exists (fname )) {
266
271
free (fname );
267
272
continue ;
268
273
}
269
274
270
275
fname_old = mkpath ("%s/old-%s%s" , packdir ,
271
- item -> string , exts [ext ]);
276
+ item -> string , exts [ext ]. name );
272
277
if (file_exists (fname_old ))
273
278
if (unlink (fname_old ))
274
279
failed = 1 ;
@@ -319,9 +324,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
319
324
char * fname , * fname_old ;
320
325
struct stat statbuffer ;
321
326
fname = mkpathdup ("%s/pack-%s%s" ,
322
- packdir , item -> string , exts [ext ]);
327
+ packdir , item -> string , exts [ext ]. name );
323
328
fname_old = mkpathdup ("%s-%s%s" ,
324
- packtmp , item -> string , exts [ext ]);
329
+ packtmp , item -> string , exts [ext ]. name );
325
330
if (!stat (fname_old , & statbuffer )) {
326
331
statbuffer .st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH );
327
332
chmod (fname_old , statbuffer .st_mode );
@@ -340,7 +345,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
340
345
fname = mkpath ("%s/old-pack-%s%s" ,
341
346
packdir ,
342
347
item -> string ,
343
- exts [ext ]);
348
+ exts [ext ]. name );
344
349
if (remove_path (fname ))
345
350
warning (_ ("removing '%s' failed" ), fname );
346
351
}
0 commit comments