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