@@ -45,13 +45,13 @@ static int write_entry(struct cache_entry *ce)
4545
4646 new = read_sha1_file (ce -> sha1 , "blob" , & size );
4747 if (!new ) {
48- fprintf (stderr , "checkout-cache: unable to read sha1 file of %s (%s)" ,
48+ fprintf (stderr , "checkout-cache: unable to read sha1 file of %s (%s)\n " ,
4949 ce -> name , sha1_to_hex (ce -> sha1 ));
5050 return -1 ;
5151 }
5252 fd = open (ce -> name , O_WRONLY | O_CREAT | O_TRUNC , 0600 );
5353 if (fd < 0 ) {
54- fprintf (stderr , "checkout-cache: unable to create %s (%s)" ,
54+ fprintf (stderr , "checkout-cache: unable to create %s (%s)\n " ,
5555 ce -> name , strerror (errno ));
5656 free (new );
5757 return -1 ;
@@ -61,7 +61,7 @@ static int write_entry(struct cache_entry *ce)
6161 free (new );
6262 if (wrote == size )
6363 return 0 ;
64- fprintf (stderr , "checkout-cache: unable to write %s" , ce -> name );
64+ fprintf (stderr , "checkout-cache: unable to write %s\n " , ce -> name );
6565 return -1 ;
6666}
6767
@@ -72,11 +72,9 @@ static int checkout_entry(struct cache_entry *ce)
7272
7373 if (!stat (ce -> name , & st )) {
7474 unsigned changed = cache_match_stat (ce , & st );
75- if (!changed )
76- return 0 ;
77- if (!quiet )
78- fprintf (stderr , "checkout-cache: %s already exists" , ce -> name );
79- return -1 ;
75+ if (changed && !quiet )
76+ fprintf (stderr , "checkout-cache: %s already exists\n" , ce -> name );
77+ return 0 ;
8078 }
8179 }
8280 return write_entry (ce );
@@ -87,7 +85,7 @@ static int checkout_file(const char *name)
8785 int pos = cache_name_pos (name , strlen (name ));
8886 if (pos < 0 ) {
8987 if (!quiet )
90- fprintf (stderr , "checkout-cache: %s is not in the cache" , name );
88+ fprintf (stderr , "checkout-cache: %s is not in the cache\n " , name );
9189 return -1 ;
9290 }
9391 return checkout_entry (active_cache [pos ]);
@@ -110,7 +108,7 @@ int main(int argc, char **argv)
110108 int i , force_filename = 0 ;
111109
112110 if (read_cache () < 0 ) {
113- fprintf (stderr , "Invalid cache" );
111+ fprintf (stderr , "Invalid cache\n " );
114112 exit (1 );
115113 }
116114
0 commit comments