@@ -672,7 +672,8 @@ static struct cache_entry *create_alias_ce(struct index_state *istate,
672
672
struct cache_entry * new_entry ;
673
673
674
674
if (alias -> ce_flags & CE_ADDED )
675
- die ("Will not add file alias '%s' ('%s' already exists in index)" , ce -> name , alias -> name );
675
+ die (_ ("will not add file alias '%s' ('%s' already exists in index)" ),
676
+ ce -> name , alias -> name );
676
677
677
678
/* Ok, create the new entry using the name of the existing alias */
678
679
len = ce_namelen (alias );
@@ -687,7 +688,7 @@ void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
687
688
{
688
689
struct object_id oid ;
689
690
if (write_object_file ("" , 0 , blob_type , & oid ))
690
- die ("cannot create an empty blob in the object database" );
691
+ die (_ ( "cannot create an empty blob in the object database" ) );
691
692
oidcpy (& ce -> oid , & oid );
692
693
}
693
694
@@ -708,7 +709,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
708
709
newflags |= HASH_RENORMALIZE ;
709
710
710
711
if (!S_ISREG (st_mode ) && !S_ISLNK (st_mode ) && !S_ISDIR (st_mode ))
711
- return error ("%s: can only add regular files, symbolic links or git-directories" , path );
712
+ return error (_ ( "%s: can only add regular files, symbolic links or git-directories" ) , path );
712
713
713
714
namelen = strlen (path );
714
715
if (S_ISDIR (st_mode )) {
@@ -763,7 +764,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
763
764
if (!intent_only ) {
764
765
if (index_path (istate , & ce -> oid , path , st , newflags )) {
765
766
discard_cache_entry (ce );
766
- return error ("unable to index file %s" , path );
767
+ return error (_ ( "unable to index file '%s'" ) , path );
767
768
}
768
769
} else
769
770
set_object_name_for_intent_to_add_entry (ce );
@@ -782,7 +783,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
782
783
discard_cache_entry (ce );
783
784
else if (add_index_entry (istate , ce , add_option )) {
784
785
discard_cache_entry (ce );
785
- return error ("unable to add %s to index" , path );
786
+ return error (_ ( "unable to add '%s' to index" ) , path );
786
787
}
787
788
if (verbose && !was_same )
788
789
printf ("add '%s'\n" , path );
@@ -793,7 +794,7 @@ int add_file_to_index(struct index_state *istate, const char *path, int flags)
793
794
{
794
795
struct stat st ;
795
796
if (lstat (path , & st ))
796
- die_errno ("unable to stat '%s'" , path );
797
+ die_errno (_ ( "unable to stat '%s'" ) , path );
797
798
return add_to_index (istate , path , & st , flags );
798
799
}
799
800
@@ -818,7 +819,7 @@ struct cache_entry *make_cache_entry(struct index_state *istate,
818
819
int len ;
819
820
820
821
if (!verify_path (path , mode )) {
821
- error ("Invalid path '%s'" , path );
822
+ error (_ ( "invalid path '%s'") , path );
822
823
return NULL ;
823
824
}
824
825
@@ -844,7 +845,7 @@ struct cache_entry *make_transient_cache_entry(unsigned int mode, const struct o
844
845
int len ;
845
846
846
847
if (!verify_path (path , mode )) {
847
- error ("Invalid path '%s'" , path );
848
+ error (_ ( "invalid path '%s'") , path );
848
849
return NULL ;
849
850
}
850
851
@@ -1297,12 +1298,12 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
1297
1298
if (!ok_to_add )
1298
1299
return -1 ;
1299
1300
if (!verify_path (ce -> name , ce -> ce_mode ))
1300
- return error ("Invalid path '%s'" , ce -> name );
1301
+ return error (_ ( "invalid path '%s'") , ce -> name );
1301
1302
1302
1303
if (!skip_df_check &&
1303
1304
check_file_directory_conflict (istate , ce , pos , ok_to_replace )) {
1304
1305
if (!ok_to_replace )
1305
- return error ("'%s' appears as both a file and as a directory" ,
1306
+ return error (_ ( "'%s' appears as both a file and as a directory" ) ,
1306
1307
ce -> name );
1307
1308
pos = index_name_stage_pos (istate , ce -> name , ce_namelen (ce ), ce_stage (ce ));
1308
1309
pos = - pos - 1 ;
@@ -1676,10 +1677,10 @@ static int verify_hdr(const struct cache_header *hdr, unsigned long size)
1676
1677
int hdr_version ;
1677
1678
1678
1679
if (hdr -> hdr_signature != htonl (CACHE_SIGNATURE ))
1679
- return error ("bad signature" );
1680
+ return error (_ ( "bad signature 0x%08x" ), hdr -> hdr_signature );
1680
1681
hdr_version = ntohl (hdr -> hdr_version );
1681
1682
if (hdr_version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < hdr_version )
1682
- return error ("bad index version %d" , hdr_version );
1683
+ return error (_ ( "bad index version %d" ) , hdr_version );
1683
1684
1684
1685
if (!verify_index_checksum )
1685
1686
return 0 ;
@@ -1688,7 +1689,7 @@ static int verify_hdr(const struct cache_header *hdr, unsigned long size)
1688
1689
the_hash_algo -> update_fn (& c , hdr , size - the_hash_algo -> rawsz );
1689
1690
the_hash_algo -> final_fn (hash , & c );
1690
1691
if (!hasheq (hash , (unsigned char * )hdr + size - the_hash_algo -> rawsz ))
1691
- return error ("bad index file sha1 signature" );
1692
+ return error (_ ( "bad index file sha1 signature" ) );
1692
1693
return 0 ;
1693
1694
}
1694
1695
@@ -1718,9 +1719,9 @@ static int read_index_extension(struct index_state *istate,
1718
1719
break ;
1719
1720
default :
1720
1721
if (* ext < 'A' || 'Z' < * ext )
1721
- return error ("index uses %.4s extension, which we do not understand" ,
1722
+ return error (_ ( "index uses %.4s extension, which we do not understand" ) ,
1722
1723
ext );
1723
- fprintf (stderr , "ignoring %.4s extension\n" , ext );
1724
+ fprintf_ln (stderr , _ ( "ignoring %.4s extension" ) , ext );
1724
1725
break ;
1725
1726
}
1726
1727
return 0 ;
@@ -1767,7 +1768,7 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
1767
1768
extended_flags = get_be16 (& ondisk2 -> flags2 ) << 16 ;
1768
1769
/* We do not yet understand any bit out of CE_EXTENDED_FLAGS */
1769
1770
if (extended_flags & ~CE_EXTENDED_FLAGS )
1770
- die ("Unknown index entry format %08x" , extended_flags );
1771
+ die (_ ( "unknown index entry format 0x %08x") , extended_flags );
1771
1772
flags |= extended_flags ;
1772
1773
name = ondisk2 -> name ;
1773
1774
}
@@ -1840,13 +1841,13 @@ static void check_ce_order(struct index_state *istate)
1840
1841
int name_compare = strcmp (ce -> name , next_ce -> name );
1841
1842
1842
1843
if (0 < name_compare )
1843
- die ("unordered stage entries in index" );
1844
+ die (_ ( "unordered stage entries in index" ) );
1844
1845
if (!name_compare ) {
1845
1846
if (!ce_stage (ce ))
1846
- die ("multiple stage entries for merged file '%s'" ,
1847
+ die (_ ( "multiple stage entries for merged file '%s'" ) ,
1847
1848
ce -> name );
1848
1849
if (ce_stage (ce ) > ce_stage (next_ce ))
1849
- die ("unordered stage entries for '%s'" ,
1850
+ die (_ ( "unordered stage entries for '%s'" ) ,
1850
1851
ce -> name );
1851
1852
}
1852
1853
}
@@ -2149,19 +2150,19 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
2149
2150
if (fd < 0 ) {
2150
2151
if (!must_exist && errno == ENOENT )
2151
2152
return 0 ;
2152
- die_errno ("%s: index file open failed" , path );
2153
+ die_errno (_ ( "%s: index file open failed" ) , path );
2153
2154
}
2154
2155
2155
2156
if (fstat (fd , & st ))
2156
- die_errno (" cannot stat the open index" );
2157
+ die_errno (_ ( "%s: cannot stat the open index"), path );
2157
2158
2158
2159
mmap_size = xsize_t (st .st_size );
2159
2160
if (mmap_size < sizeof (struct cache_header ) + the_hash_algo -> rawsz )
2160
- die (" index file smaller than expected" );
2161
+ die (_ ( "%s: index file smaller than expected"), path );
2161
2162
2162
2163
mmap = xmmap (NULL , mmap_size , PROT_READ , MAP_PRIVATE , fd , 0 );
2163
2164
if (mmap == MAP_FAILED )
2164
- die_errno (" unable to map index file" );
2165
+ die_errno (_ ( "%s: unable to map index file"), path );
2165
2166
close (fd );
2166
2167
2167
2168
hdr = (const struct cache_header * )mmap ;
@@ -2243,7 +2244,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
2243
2244
2244
2245
unmap :
2245
2246
munmap ((void * )mmap , mmap_size );
2246
- die ("index file corrupt" );
2247
+ die (_ ( "index file corrupt" ) );
2247
2248
}
2248
2249
2249
2250
/*
@@ -2255,7 +2256,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
2255
2256
static void freshen_shared_index (const char * shared_index , int warn )
2256
2257
{
2257
2258
if (!check_and_freshen_file (shared_index , 1 ) && warn )
2258
- warning ("could not freshen shared index '%s'" , shared_index );
2259
+ warning (_ ( "could not freshen shared index '%s'" ) , shared_index );
2259
2260
}
2260
2261
2261
2262
int read_index_from (struct index_state * istate , const char * path ,
@@ -2290,7 +2291,7 @@ int read_index_from(struct index_state *istate, const char *path,
2290
2291
base_path = xstrfmt ("%s/sharedindex.%s" , gitdir , base_oid_hex );
2291
2292
ret = do_read_index (split_index -> base , base_path , 1 );
2292
2293
if (!oideq (& split_index -> base_oid , & split_index -> base -> oid ))
2293
- die ("broken index, expect %s in %s, got %s" ,
2294
+ die (_ ( "broken index, expect %s in %s, got %s" ) ,
2294
2295
base_oid_hex , base_path ,
2295
2296
oid_to_hex (& split_index -> base -> oid ));
2296
2297
@@ -3076,7 +3077,7 @@ static int write_shared_index(struct index_state *istate,
3076
3077
return ret ;
3077
3078
ret = adjust_shared_perm (get_tempfile_path (* temp ));
3078
3079
if (ret ) {
3079
- error ("cannot fix permission bits on %s" , get_tempfile_path (* temp ));
3080
+ error (_ ( "cannot fix permission bits on '%s'" ) , get_tempfile_path (* temp ));
3080
3081
return ret ;
3081
3082
}
3082
3083
ret = rename_tempfile (temp ,
@@ -3222,7 +3223,7 @@ int read_index_unmerged(struct index_state *istate)
3222
3223
new_ce -> ce_namelen = len ;
3223
3224
new_ce -> ce_mode = ce -> ce_mode ;
3224
3225
if (add_index_entry (istate , new_ce , ADD_CACHE_SKIP_DFCHECK ))
3225
- return error ("%s: cannot drop to stage #0" ,
3226
+ return error (_ ( "%s: cannot drop to stage #0" ) ,
3226
3227
new_ce -> name );
3227
3228
}
3228
3229
return unmerged ;
0 commit comments