@@ -391,145 +391,16 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
391
391
cmd_log_init_finish (argc , argv , prefix , rev , opt , cfg );
392
392
}
393
393
394
- /*
395
- * This gives a rough estimate for how many commits we
396
- * will print out in the list.
397
- */
398
- static int estimate_commit_count (struct commit_list * list )
399
- {
400
- int n = 0 ;
401
-
402
- while (list ) {
403
- struct commit * commit = list -> item ;
404
- unsigned int flags = commit -> object .flags ;
405
- list = list -> next ;
406
- if (!(flags & (TREESAME | UNINTERESTING )))
407
- n ++ ;
408
- }
409
- return n ;
410
- }
411
-
412
- static void show_early_header (struct rev_info * rev , const char * stage , int nr )
413
- {
414
- if (rev -> shown_one ) {
415
- rev -> shown_one = 0 ;
416
- if (rev -> commit_format != CMIT_FMT_ONELINE )
417
- putchar (rev -> diffopt .line_termination );
418
- }
419
- fprintf (rev -> diffopt .file , _ ("Final output: %d %s\n" ), nr , stage );
420
- }
421
-
422
- static struct itimerval early_output_timer ;
423
-
424
- static void log_show_early (struct rev_info * revs , struct commit_list * list )
425
- {
426
- int i = revs -> early_output ;
427
- int show_header = 1 ;
428
- int no_free = revs -> diffopt .no_free ;
429
-
430
- revs -> diffopt .no_free = 0 ;
431
- sort_in_topological_order (& list , revs -> sort_order );
432
- while (list && i ) {
433
- struct commit * commit = list -> item ;
434
- switch (simplify_commit (revs , commit )) {
435
- case commit_show :
436
- if (show_header ) {
437
- int n = estimate_commit_count (list );
438
- show_early_header (revs , "incomplete" , n );
439
- show_header = 0 ;
440
- }
441
- log_tree_commit (revs , commit );
442
- i -- ;
443
- break ;
444
- case commit_ignore :
445
- break ;
446
- case commit_error :
447
- revs -> diffopt .no_free = no_free ;
448
- diff_free (& revs -> diffopt );
449
- return ;
450
- }
451
- list = list -> next ;
452
- }
453
-
454
- /* Did we already get enough commits for the early output? */
455
- if (!i ) {
456
- revs -> diffopt .no_free = 0 ;
457
- diff_free (& revs -> diffopt );
458
- return ;
459
- }
460
-
461
- /*
462
- * ..if no, then repeat it twice a second until we
463
- * do.
464
- *
465
- * NOTE! We don't use "it_interval", because if the
466
- * reader isn't listening, we want our output to be
467
- * throttled by the writing, and not have the timer
468
- * trigger every second even if we're blocked on a
469
- * reader!
470
- */
471
- early_output_timer .it_value .tv_sec = 0 ;
472
- early_output_timer .it_value .tv_usec = 500000 ;
473
- setitimer (ITIMER_REAL , & early_output_timer , NULL );
474
- }
475
-
476
- static void early_output (int signal UNUSED )
477
- {
478
- show_early_output = log_show_early ;
479
- }
480
-
481
- static void setup_early_output (void )
482
- {
483
- struct sigaction sa ;
484
-
485
- /*
486
- * Set up the signal handler, minimally intrusively:
487
- * we only set a single volatile integer word (not
488
- * using sigatomic_t - trying to avoid unnecessary
489
- * system dependencies and headers), and using
490
- * SA_RESTART.
491
- */
492
- memset (& sa , 0 , sizeof (sa ));
493
- sa .sa_handler = early_output ;
494
- sigemptyset (& sa .sa_mask );
495
- sa .sa_flags = SA_RESTART ;
496
- sigaction (SIGALRM , & sa , NULL );
497
-
498
- /*
499
- * If we can get the whole output in less than a
500
- * tenth of a second, don't even bother doing the
501
- * early-output thing..
502
- *
503
- * This is a one-time-only trigger.
504
- */
505
- early_output_timer .it_value .tv_sec = 0 ;
506
- early_output_timer .it_value .tv_usec = 100000 ;
507
- setitimer (ITIMER_REAL , & early_output_timer , NULL );
508
- }
509
-
510
- static void finish_early_output (struct rev_info * rev )
511
- {
512
- int n = estimate_commit_count (rev -> commits );
513
- signal (SIGALRM , SIG_IGN );
514
- show_early_header (rev , "done" , n );
515
- }
516
-
517
394
static int cmd_log_walk_no_free (struct rev_info * rev )
518
395
{
519
396
struct commit * commit ;
520
397
int saved_nrl = 0 ;
521
398
int saved_dcctc = 0 ;
522
399
int result ;
523
400
524
- if (rev -> early_output )
525
- setup_early_output ();
526
-
527
401
if (prepare_revision_walk (rev ))
528
402
die (_ ("revision walk setup failed" ));
529
403
530
- if (rev -> early_output )
531
- finish_early_output (rev );
532
-
533
404
/*
534
405
* For --check and --exit-code, the exit code is based on CHECK_FAILED
535
406
* and HAS_CHANGES being accumulated in rev->diffopt, so be careful to
0 commit comments