@@ -37,7 +37,7 @@ static void update_callback(struct diff_queue_struct *q,
37
37
const char * path = p -> one -> path ;
38
38
switch (p -> status ) {
39
39
default :
40
- die ("unexpected diff status %c" , p -> status );
40
+ die (_ ( "unexpected diff status %c" ) , p -> status );
41
41
case DIFF_STATUS_UNMERGED :
42
42
/*
43
43
* ADD_CACHE_IGNORE_REMOVAL is unset if "git
@@ -63,7 +63,7 @@ static void update_callback(struct diff_queue_struct *q,
63
63
case DIFF_STATUS_TYPE_CHANGED :
64
64
if (add_file_to_index (& the_index , path , data -> flags )) {
65
65
if (!(data -> flags & ADD_CACHE_IGNORE_ERRORS ))
66
- die ("updating files failed" );
66
+ die (_ ( "updating files failed" ) );
67
67
data -> add_errors ++ ;
68
68
}
69
69
break ;
@@ -73,7 +73,7 @@ static void update_callback(struct diff_queue_struct *q,
73
73
if (!(data -> flags & ADD_CACHE_PRETEND ))
74
74
remove_file_from_index (& the_index , path );
75
75
if (data -> flags & (ADD_CACHE_PRETEND |ADD_CACHE_VERBOSE ))
76
- printf ("remove '%s'\n" , path );
76
+ printf (_ ( "remove '%s'\n" ) , path );
77
77
break ;
78
78
}
79
79
}
@@ -171,7 +171,7 @@ static void treat_gitlinks(const char **pathspec)
171
171
/* strip trailing slash */
172
172
pathspec [j ] = xstrndup (ce -> name , len );
173
173
else
174
- die ("Path '%s' is in submodule '%.*s'" ,
174
+ die (_ ( "Path '%s' is in submodule '%.*s'" ) ,
175
175
pathspec [j ], len , ce -> name );
176
176
}
177
177
}
@@ -187,10 +187,10 @@ static void refresh(int verbose, const char **pathspec)
187
187
/* nothing */ ;
188
188
seen = xcalloc (specs , 1 );
189
189
refresh_index (& the_index , verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET ,
190
- pathspec , seen , "Unstaged changes after refreshing the index:" );
190
+ pathspec , seen , _ ( "Unstaged changes after refreshing the index:" ) );
191
191
for (i = 0 ; i < specs ; i ++ ) {
192
192
if (!seen [i ])
193
- die ("pathspec '%s' did not match any files" , pathspec [i ]);
193
+ die (_ ( "pathspec '%s' did not match any files" ) , pathspec [i ]);
194
194
}
195
195
free (seen );
196
196
}
@@ -204,7 +204,7 @@ static const char **validate_pathspec(int argc, const char **argv, const char *p
204
204
for (p = pathspec ; * p ; p ++ ) {
205
205
if (has_symlink_leading_path (* p , strlen (* p ))) {
206
206
int len = prefix ? strlen (prefix ) : 0 ;
207
- die ("'%s' is beyond a symbolic link" , * p + len );
207
+ die (_ ( "'%s' is beyond a symbolic link" ) , * p + len );
208
208
}
209
209
}
210
210
}
@@ -271,7 +271,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
271
271
git_config (git_diff_basic_config , NULL ); /* no "diff" UI options */
272
272
273
273
if (read_cache () < 0 )
274
- die ("Could not read the index" );
274
+ die (_ ( "Could not read the index" ) );
275
275
276
276
init_revisions (& rev , prefix );
277
277
rev .diffopt .context = 7 ;
@@ -280,24 +280,24 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
280
280
rev .diffopt .output_format = DIFF_FORMAT_PATCH ;
281
281
out = open (file , O_CREAT | O_WRONLY , 0644 );
282
282
if (out < 0 )
283
- die ("Could not open '%s' for writing." , file );
283
+ die (_ ( "Could not open '%s' for writing." ) , file );
284
284
rev .diffopt .file = xfdopen (out , "w" );
285
285
rev .diffopt .close_file = 1 ;
286
286
if (run_diff_files (& rev , 0 ))
287
- die ("Could not write patch" );
287
+ die (_ ( "Could not write patch" ) );
288
288
289
289
launch_editor (file , NULL , NULL );
290
290
291
291
if (stat (file , & st ))
292
- die_errno ("Could not stat '%s'" , file );
292
+ die_errno (_ ( "Could not stat '%s'" ) , file );
293
293
if (!st .st_size )
294
- die ("Empty patch. Aborted." );
294
+ die (_ ( "Empty patch. Aborted." ) );
295
295
296
296
memset (& child , 0 , sizeof (child ));
297
297
child .git_cmd = 1 ;
298
298
child .argv = apply_argv ;
299
299
if (run_command (& child ))
300
- die ("Could not apply '%s'" , file );
300
+ die (_ ( "Could not apply '%s'" ) , file );
301
301
302
302
unlink (file );
303
303
return 0 ;
@@ -306,7 +306,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
306
306
static struct lock_file lock_file ;
307
307
308
308
static const char ignore_error [] =
309
- "The following paths are ignored by one of your .gitignore files:\n" ;
309
+ N_ ( "The following paths are ignored by one of your .gitignore files:\n" ) ;
310
310
311
311
static int verbose = 0 , show_only = 0 , ignored_too = 0 , refresh_only = 0 ;
312
312
static int ignore_add_errors , addremove , intent_to_add , ignore_missing = 0 ;
@@ -343,17 +343,17 @@ static int add_files(struct dir_struct *dir, int flags)
343
343
int i , exit_status = 0 ;
344
344
345
345
if (dir -> ignored_nr ) {
346
- fprintf (stderr , ignore_error );
346
+ fprintf (stderr , _ ( ignore_error ) );
347
347
for (i = 0 ; i < dir -> ignored_nr ; i ++ )
348
348
fprintf (stderr , "%s\n" , dir -> ignored [i ]-> name );
349
- fprintf (stderr , "Use -f if you really want to add them.\n" );
350
- die ("no files added" );
349
+ fprintf (stderr , _ ( "Use -f if you really want to add them.\n" ) );
350
+ die (_ ( "no files added" ) );
351
351
}
352
352
353
353
for (i = 0 ; i < dir -> nr ; i ++ )
354
354
if (add_file_to_cache (dir -> entries [i ]-> name , flags )) {
355
355
if (!ignore_add_errors )
356
- die ("adding files failed" );
356
+ die (_ ( "adding files failed" ) );
357
357
exit_status = 1 ;
358
358
}
359
359
return exit_status ;
@@ -385,9 +385,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
385
385
argv ++ ;
386
386
387
387
if (addremove && take_worktree_changes )
388
- die ("-A and -u are mutually incompatible" );
388
+ die (_ ( "-A and -u are mutually incompatible" ) );
389
389
if (!show_only && ignore_missing )
390
- die ("Option --ignore-missing can only be used together with --dry-run" );
390
+ die (_ ( "Option --ignore-missing can only be used together with --dry-run" ) );
391
391
if ((addremove || take_worktree_changes ) && !argc ) {
392
392
static const char * here [2 ] = { "." , NULL };
393
393
argc = 1 ;
@@ -407,14 +407,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
407
407
? ADD_CACHE_IGNORE_REMOVAL : 0 ));
408
408
409
409
if (require_pathspec && argc == 0 ) {
410
- fprintf (stderr , "Nothing specified, nothing added.\n" );
411
- fprintf (stderr , "Maybe you wanted to say 'git add .'?\n" );
410
+ fprintf (stderr , _ ( "Nothing specified, nothing added.\n" ) );
411
+ fprintf (stderr , _ ( "Maybe you wanted to say 'git add .'?\n" ) );
412
412
return 0 ;
413
413
}
414
414
pathspec = validate_pathspec (argc , argv , prefix );
415
415
416
416
if (read_cache () < 0 )
417
- die ("index file corrupt" );
417
+ die (_ ( "index file corrupt" ) );
418
418
treat_gitlinks (pathspec );
419
419
420
420
if (add_new_files ) {
@@ -450,7 +450,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
450
450
if (excluded (& dir , pathspec [i ], & dtype ))
451
451
dir_add_ignored (& dir , pathspec [i ], strlen (pathspec [i ]));
452
452
} else
453
- die ("pathspec '%s' did not match any files" ,
453
+ die (_ ( "pathspec '%s' did not match any files" ) ,
454
454
pathspec [i ]);
455
455
}
456
456
}
@@ -466,7 +466,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
466
466
if (active_cache_changed ) {
467
467
if (write_cache (newfd , active_cache , active_nr ) ||
468
468
commit_locked_index (& lock_file ))
469
- die ("Unable to write new index file" );
469
+ die (_ ( "Unable to write new index file" ) );
470
470
}
471
471
472
472
return exit_status ;
0 commit comments