@@ -150,9 +150,10 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
150150}
151151
152152static int verify_cache (struct cache_entry * * cache ,
153- int entries , int silent )
153+ int entries , int flags )
154154{
155155 int i , funny ;
156+ int silent = flags & WRITE_TREE_SILENT ;
156157
157158 /* Verify that the tree is merged */
158159 funny = 0 ;
@@ -241,10 +242,11 @@ static int update_one(struct cache_tree *it,
241242 int entries ,
242243 const char * base ,
243244 int baselen ,
244- int missing_ok ,
245- int dryrun )
245+ int flags )
246246{
247247 struct strbuf buffer ;
248+ int missing_ok = flags & WRITE_TREE_MISSING_OK ;
249+ int dryrun = flags & WRITE_TREE_DRY_RUN ;
248250 int i ;
249251
250252 if (0 <= it -> entry_count && has_sha1_file (it -> sha1 ))
@@ -288,8 +290,7 @@ static int update_one(struct cache_tree *it,
288290 cache + i , entries - i ,
289291 path ,
290292 baselen + sublen + 1 ,
291- missing_ok ,
292- dryrun );
293+ flags );
293294 if (subcnt < 0 )
294295 return subcnt ;
295296 i += subcnt - 1 ;
@@ -371,15 +372,13 @@ static int update_one(struct cache_tree *it,
371372int cache_tree_update (struct cache_tree * it ,
372373 struct cache_entry * * cache ,
373374 int entries ,
374- int missing_ok ,
375- int dryrun ,
376- int silent )
375+ int flags )
377376{
378377 int i ;
379- i = verify_cache (cache , entries , silent );
378+ i = verify_cache (cache , entries , flags );
380379 if (i )
381380 return i ;
382- i = update_one (it , cache , entries , "" , 0 , missing_ok , dryrun );
381+ i = update_one (it , cache , entries , "" , 0 , flags );
383382 if (i < 0 )
384383 return i ;
385384 return 0 ;
@@ -572,11 +571,9 @@ int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix)
572571
573572 was_valid = cache_tree_fully_valid (active_cache_tree );
574573 if (!was_valid ) {
575- int missing_ok = flags & WRITE_TREE_MISSING_OK ;
576-
577574 if (cache_tree_update (active_cache_tree ,
578575 active_cache , active_nr ,
579- missing_ok , 0 , 0 ) < 0 )
576+ flags ) < 0 )
580577 return WRITE_TREE_UNMERGED_INDEX ;
581578 if (0 <= newfd ) {
582579 if (!write_cache (newfd , active_cache , active_nr ) &&
@@ -672,10 +669,10 @@ int cache_tree_matches_traversal(struct cache_tree *root,
672669 return 0 ;
673670}
674671
675- int update_main_cache_tree (int silent )
672+ int update_main_cache_tree (int flags )
676673{
677674 if (!the_index .cache_tree )
678675 the_index .cache_tree = cache_tree ();
679676 return cache_tree_update (the_index .cache_tree ,
680- the_index .cache , the_index .cache_nr , 0 , 0 , silent );
677+ the_index .cache , the_index .cache_nr , flags );
681678}
0 commit comments