@@ -18,7 +18,7 @@ static char topath[4][TEMPORARY_FILENAME_LENGTH + 1];
18
18
19
19
static struct checkout state ;
20
20
21
- static void write_tempfile_record (const char * name , int prefix_length )
21
+ static void write_tempfile_record (const char * name , const char * prefix )
22
22
{
23
23
int i ;
24
24
@@ -35,14 +35,14 @@ static void write_tempfile_record(const char *name, int prefix_length)
35
35
fputs (topath [checkout_stage ], stdout );
36
36
37
37
putchar ('\t' );
38
- write_name_quoted (name + prefix_length , stdout , line_termination );
38
+ write_name_quoted_relative (name , prefix , stdout , line_termination );
39
39
40
40
for (i = 0 ; i < 4 ; i ++ ) {
41
41
topath [i ][0 ] = 0 ;
42
42
}
43
43
}
44
44
45
- static int checkout_file (const char * name , int prefix_length )
45
+ static int checkout_file (const char * name , const char * prefix )
46
46
{
47
47
int namelen = strlen (name );
48
48
int pos = cache_name_pos (name , namelen );
@@ -71,7 +71,7 @@ static int checkout_file(const char *name, int prefix_length)
71
71
72
72
if (did_checkout ) {
73
73
if (to_tempfile )
74
- write_tempfile_record (name , prefix_length );
74
+ write_tempfile_record (name , prefix );
75
75
return errs > 0 ? -1 : 0 ;
76
76
}
77
77
@@ -106,15 +106,15 @@ static void checkout_all(const char *prefix, int prefix_length)
106
106
if (last_ce && to_tempfile ) {
107
107
if (ce_namelen (last_ce ) != ce_namelen (ce )
108
108
|| memcmp (last_ce -> name , ce -> name , ce_namelen (ce )))
109
- write_tempfile_record (last_ce -> name , prefix_length );
109
+ write_tempfile_record (last_ce -> name , prefix );
110
110
}
111
111
if (checkout_entry (ce , & state ,
112
112
to_tempfile ? topath [ce_stage (ce )] : NULL ) < 0 )
113
113
errs ++ ;
114
114
last_ce = ce ;
115
115
}
116
116
if (last_ce && to_tempfile )
117
- write_tempfile_record (last_ce -> name , prefix_length );
117
+ write_tempfile_record (last_ce -> name , prefix );
118
118
if (errs )
119
119
/* we have already done our error reporting.
120
120
* exit with the same code as die().
@@ -248,7 +248,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
248
248
if (read_from_stdin )
249
249
die ("git checkout-index: don't mix '--stdin' and explicit filenames" );
250
250
p = prefix_path (prefix , prefix_length , arg );
251
- checkout_file (p , prefix_length );
251
+ checkout_file (p , prefix );
252
252
if (p < arg || p > arg + strlen (arg ))
253
253
free ((char * )p );
254
254
}
@@ -268,7 +268,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
268
268
strbuf_swap (& buf , & nbuf );
269
269
}
270
270
p = prefix_path (prefix , prefix_length , buf .buf );
271
- checkout_file (p , prefix_length );
271
+ checkout_file (p , prefix );
272
272
if (p < buf .buf || p > buf .buf + buf .len )
273
273
free ((char * )p );
274
274
}
0 commit comments