File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -269,6 +269,8 @@ static int batch_objects(struct batch_options *opt)
269269{
270270 struct strbuf buf = STRBUF_INIT ;
271271 struct expand_data data ;
272+ int save_warning ;
273+ int retval = 0 ;
272274
273275 if (!opt -> format )
274276 opt -> format = "%(objectname) %(objecttype) %(objectsize)" ;
@@ -297,11 +299,10 @@ static int batch_objects(struct batch_options *opt)
297299 * warn) ends up dwarfing the actual cost of the object lookups
298300 * themselves. We can work around it by just turning off the warning.
299301 */
302+ save_warning = warn_on_object_refname_ambiguity ;
300303 warn_on_object_refname_ambiguity = 0 ;
301304
302305 while (strbuf_getline (& buf , stdin , '\n' ) != EOF ) {
303- int error ;
304-
305306 if (data .split_on_whitespace ) {
306307 /*
307308 * Split at first whitespace, tying off the beginning
@@ -316,12 +317,14 @@ static int batch_objects(struct batch_options *opt)
316317 data .rest = p ;
317318 }
318319
319- error = batch_one_object (buf .buf , opt , & data );
320- if (error )
321- return error ;
320+ retval = batch_one_object (buf .buf , opt , & data );
321+ if (retval )
322+ break ;
322323 }
323324
324- return 0 ;
325+ strbuf_release (& buf );
326+ warn_on_object_refname_ambiguity = save_warning ;
327+ return retval ;
325328}
326329
327330static const char * const cat_file_usage [] = {
Original file line number Diff line number Diff line change @@ -1575,6 +1575,10 @@ static void read_revisions_from_stdin(struct rev_info *revs,
15751575{
15761576 struct strbuf sb ;
15771577 int seen_dashdash = 0 ;
1578+ int save_warning ;
1579+
1580+ save_warning = warn_on_object_refname_ambiguity ;
1581+ warn_on_object_refname_ambiguity = 0 ;
15781582
15791583 strbuf_init (& sb , 1000 );
15801584 while (strbuf_getwholeline (& sb , stdin , '\n' ) != EOF ) {
@@ -1596,7 +1600,9 @@ static void read_revisions_from_stdin(struct rev_info *revs,
15961600 }
15971601 if (seen_dashdash )
15981602 read_pathspec_from_stdin (revs , & sb , prune );
1603+
15991604 strbuf_release (& sb );
1605+ warn_on_object_refname_ambiguity = save_warning ;
16001606}
16011607
16021608static void add_grep (struct rev_info * revs , const char * ptn , enum grep_pat_token what )
You can’t perform that action at this time.
0 commit comments