@@ -72,7 +72,7 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,
72
72
hashcpy (ce -> sha1 , sha1 );
73
73
memcpy (ce -> name , base , baselen );
74
74
memcpy (ce -> name + baselen , pathname , len - baselen );
75
- ce -> ce_flags = create_ce_flags (len , 0 );
75
+ ce -> ce_flags = create_ce_flags (len , 0 ) | CE_UPDATE ;
76
76
ce -> ce_mode = create_ce_mode (mode );
77
77
add_cache_entry (ce , ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE );
78
78
return 0 ;
@@ -229,6 +229,8 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
229
229
230
230
for (pos = 0 ; pos < active_nr ; pos ++ ) {
231
231
struct cache_entry * ce = active_cache [pos ];
232
+ if (source_tree && !(ce -> ce_flags & CE_UPDATE ))
233
+ continue ;
232
234
match_pathspec (pathspec , ce -> name , ce_namelen (ce ), 0 , ps_matched );
233
235
}
234
236
@@ -267,6 +269,8 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
267
269
state .refresh_cache = 1 ;
268
270
for (pos = 0 ; pos < active_nr ; pos ++ ) {
269
271
struct cache_entry * ce = active_cache [pos ];
272
+ if (source_tree && !(ce -> ce_flags & CE_UPDATE ))
273
+ continue ;
270
274
if (match_pathspec (pathspec , ce -> name , ce_namelen (ce ), 0 , NULL )) {
271
275
if (!ce_stage (ce )) {
272
276
errs |= checkout_entry (ce , & state , NULL );
0 commit comments