Skip to content

Commit 2346617

Browse files
committed
Merge branch 'jk/revision-no-early-output'
Remove unsupported, unused, and unsupportable old option from "git log". * jk/revision-no-early-output: revision: drop early output option
2 parents 6741b9b + 54b1826 commit 2346617

File tree

3 files changed

+0
-154
lines changed

3 files changed

+0
-154
lines changed

builtin/log.c

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -391,145 +391,16 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
391391
cmd_log_init_finish(argc, argv, prefix, rev, opt, cfg);
392392
}
393393

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-
517394
static int cmd_log_walk_no_free(struct rev_info *rev)
518395
{
519396
struct commit *commit;
520397
int saved_nrl = 0;
521398
int saved_dcctc = 0;
522399
int result;
523400

524-
if (rev->early_output)
525-
setup_early_output();
526-
527401
if (prepare_revision_walk(rev))
528402
die(_("revision walk setup failed"));
529403

530-
if (rev->early_output)
531-
finish_early_output(rev);
532-
533404
/*
534405
* For --check and --exit-code, the exit code is based on CHECK_FAILED
535406
* and HAS_CHANGES being accumulated in rev->diffopt, so be careful to

revision.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
#include "parse-options.h"
5151
#include "wildmatch.h"
5252

53-
volatile show_early_output_fn_t show_early_output;
54-
5553
static char *term_bad;
5654
static char *term_good;
5755

@@ -1473,7 +1471,6 @@ static int limit_list(struct rev_info *revs)
14731471
while (original_list) {
14741472
struct commit *commit = pop_commit(&original_list);
14751473
struct object *obj = &commit->object;
1476-
show_early_output_fn_t show;
14771474

14781475
if (commit == interesting_cache)
14791476
interesting_cache = NULL;
@@ -1497,13 +1494,6 @@ static int limit_list(struct rev_info *revs)
14971494
continue;
14981495
date = commit->date;
14991496
p = &commit_list_insert(commit, p)->next;
1500-
1501-
show = show_early_output;
1502-
if (!show)
1503-
continue;
1504-
1505-
show(revs, newlist);
1506-
show_early_output = NULL;
15071497
}
15081498
if (revs->cherry_pick || revs->cherry_mark)
15091499
cherry_pick_list(newlist, revs);
@@ -2437,13 +2427,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
24372427
} else if (!strcmp(arg, "--author-date-order")) {
24382428
revs->sort_order = REV_SORT_BY_AUTHOR_DATE;
24392429
revs->topo_order = 1;
2440-
} else if (!strcmp(arg, "--early-output")) {
2441-
revs->early_output = 100;
2442-
revs->topo_order = 1;
2443-
} else if (skip_prefix(arg, "--early-output=", &optarg)) {
2444-
if (strtoul_ui(optarg, 10, &revs->early_output) < 0)
2445-
die("'%s': not a non-negative integer", optarg);
2446-
revs->topo_order = 1;
24472430
} else if (!strcmp(arg, "--parents")) {
24482431
revs->rewrite_parents = 1;
24492432
revs->print_parents = 1;

revision.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ struct rev_info {
160160
/* topo-sort */
161161
enum rev_sort_order sort_order;
162162

163-
unsigned int early_output;
164-
165163
unsigned int ignore_missing:1,
166164
ignore_missing_links:1;
167165

@@ -553,10 +551,4 @@ int rewrite_parents(struct rev_info *revs,
553551
*/
554552
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
555553

556-
/**
557-
* Global for the (undocumented) "--early-output" flag for "git log".
558-
*/
559-
typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
560-
extern volatile show_early_output_fn_t show_early_output;
561-
562554
#endif

0 commit comments

Comments
 (0)