aboutsummaryrefslogtreecommitdiffstats
path: root/diff-merges.c
diff options
context:
space:
mode:
authorSergey Organov <sorganov@gmail.com>2021-04-13 14:41:15 +0300
committerJunio C Hamano <gitster@pobox.com>2021-04-16 23:38:35 -0700
commit26a0f58da84a7da11f9175144c9a926e7b376349 (patch)
tree03fd9452c65541f8b14e86aeb583a1f3895f191e /diff-merges.c
parentdiff-merges: introduce --diff-merges=on (diff)
downloadgit-26a0f58da84a7da11f9175144c9a926e7b376349.tar.gz
git-26a0f58da84a7da11f9175144c9a926e7b376349.zip
diff-merges: refactor set_diff_merges()
Split set_diff_merges() into separate parsing and execution functions, the former to be reused for parsing of configuration values later in the patch series. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-merges.c')
-rw-r--r--diff-merges.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/diff-merges.c b/diff-merges.c
index ff227368bd..66c8ba0cc6 100644
--- a/diff-merges.c
+++ b/diff-merges.c
@@ -55,29 +55,35 @@ static void set_dense_combined(struct rev_info *revs)
revs->dense_combined_merges = 1;
}
-static void set_diff_merges(struct rev_info *revs, const char *optarg)
+static diff_merges_setup_func_t func_by_opt(const char *optarg)
{
- if (!strcmp(optarg, "off") || !strcmp(optarg, "none")) {
- suppress(revs);
- /* Return early to leave revs->merges_need_diff unset */
- return;
- }
-
+ if (!strcmp(optarg, "off") || !strcmp(optarg, "none"))
+ return suppress;
if (!strcmp(optarg, "1") || !strcmp(optarg, "first-parent"))
- set_first_parent(revs);
+ return set_first_parent;
else if (!strcmp(optarg, "m") || !strcmp(optarg, "separate"))
- set_separate(revs);
+ return set_separate;
else if (!strcmp(optarg, "c") || !strcmp(optarg, "combined"))
- set_combined(revs);
+ return set_combined;
else if (!strcmp(optarg, "cc") || !strcmp(optarg, "dense-combined"))
- set_dense_combined(revs);
+ return set_dense_combined;
else if (!strcmp(optarg, "on"))
- set_to_default(revs);
- else
+ return set_to_default;
+ return NULL;
+}
+
+static void set_diff_merges(struct rev_info *revs, const char *optarg)
+{
+ diff_merges_setup_func_t func = func_by_opt(optarg);
+
+ if (!func)
die(_("unknown value for --diff-merges: %s"), optarg);
- /* The flag is cleared by set_xxx() functions, so don't move this up */
- revs->merges_need_diff = 1;
+ func(revs);
+
+ /* NOTE: the merges_need_diff flag is cleared by func() call */
+ if (func != suppress)
+ revs->merges_need_diff = 1;
}
/*
pan> 2002-10-27[PATCH] xd_open is goneAlan Cox1-1/+0 2002-10-27[PATCH] fix umem driver to use pci_get/set..Alan Cox1-8/+3 2002-10-27[PATCH] merge befs file system from 2.4 (no core changes)Alan Cox23-1/+3940 2002-10-27[PATCH] get the right thing out of se401 on gcc 3.2Alan Cox1-2/+4 2002-10-27[PATCH] update qlogicfas driverAlan Cox2-273/+388 2002-10-27[PATCH] correct notes on scsi generic releaseAlan Cox1-2/+2 2002-10-27[PATCH] SCSI configure helpAlan Cox1-8/+21 2002-10-27[PATCH] next NCR5380 updatesAlan Cox15-537/+507 Fix more locking, do a major rethink on the bh handling (now workqueue) 2002-10-27[PATCH] u14-34f update from maintainerAlan Cox2-18/+48 2002-10-27[PATCH] finish updating sym53c416Alan Cox2-25/+47 2002-10-27[PATCH] nsp_cs update from maintainerAlan Cox5-291/+722 2002-10-27[PATCH] fix scsi irq errors on seagateAlan Cox2-0/+9 2002-10-27[PATCH] nsp32 needs updating for scsi_hn_getAlan Cox1-5/+3 2002-10-27[PATCH] resurrect the NCR53c406aAlan Cox2-806/+777 2002-10-27[PATCH] ncr53c8xxx needs updating for scsi_hn_getAlan Cox1-9/+4 2002-10-27[PATCH] inia100 just has to lose a next: NULLAlan Cox1-2/+1 2002-10-27[PATCH] fix all the IRQ breakage on the in2000Alan Cox2-14/+13 2002-10-27[PATCH] initial eata driver updatesAlan Cox4-88/+216 2002-10-27[PATCH] fix aic7xxx on gcc 3.2 warning spewAlan Cox1-20/+20 2002-10-27[PATCH] move advansys from pcibios to pci_Alan Cox1-23/+11 2002-10-27[PATCH] ressurect the aha1740 driverAlan Cox1-12/+19 2002-10-27[PATCH] move 53c7,8xx to pci_ not pcibiosAlan Cox2-11/+7 2002-10-27[PATCH] small scsi compile fixesAlan Cox7-24/+15 This is stuff like next: pointers that are not present rather than anything bigger 2002-10-27[PATCH] MCA bus basic cleanupsAlan Cox8-1540/+1323 2002-10-18Linux v2.5.44v2.5.44Linus Torvalds1-1/+1 2002-10-18[PATCH] device removalPatrick Mochel2-3/+4 The problem was that when the refcount hit 0, it was unconditionally assuming that it had been added, which is wrong. The patch below corrects that, and fixes the Oops when loading the floppy driver.