Browse Source

diff-merges: re-arrange functions to match the order they are called in

For clarity, define public functions in the order they are called, to
make logic inter-dependencies easier to grok.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Sergey Organov 4 years ago committed by Junio C Hamano
parent
commit
564a4fc847
  1. 24
      diff-merges.c
  2. 5
      diff-merges.h

24
diff-merges.c

@ -2,6 +2,10 @@ @@ -2,6 +2,10 @@

#include "revision.h"

/*
* Public functions. They are in the order they are called.
*/

void diff_merges_init_revs(struct rev_info *revs)
{
revs->ignore_merges = -1;
@ -46,16 +50,6 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv) @@ -46,16 +50,6 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
return argcount;
}

void diff_merges_setup_revs(struct rev_info *revs)
{
if (revs->combine_merges && revs->ignore_merges < 0)
revs->ignore_merges = 0;
if (revs->ignore_merges < 0)
revs->ignore_merges = 1;
if (revs->combined_all_paths && !revs->combine_merges)
die("--combined-all-paths makes no sense without -c or --cc");
}

void diff_merges_default_to_first_parent(struct rev_info *revs)
{
if (revs->ignore_merges < 0) /* No -m */
@ -72,3 +66,13 @@ void diff_merges_default_to_dense_combined(struct rev_info *revs) @@ -72,3 +66,13 @@ void diff_merges_default_to_dense_combined(struct rev_info *revs)
}
}
}

void diff_merges_setup_revs(struct rev_info *revs)
{
if (revs->combine_merges && revs->ignore_merges < 0)
revs->ignore_merges = 0;
if (revs->ignore_merges < 0)
revs->ignore_merges = 1;
if (revs->combined_all_paths && !revs->combine_merges)
die("--combined-all-paths makes no sense without -c or --cc");
}

5
diff-merges.h

@ -13,11 +13,10 @@ void diff_merges_init_revs(struct rev_info *revs); @@ -13,11 +13,10 @@ void diff_merges_init_revs(struct rev_info *revs);

int diff_merges_parse_opts(struct rev_info *revs, const char **argv);

void diff_merges_setup_revs(struct rev_info *revs);
void diff_merges_default_to_first_parent(struct rev_info *revs);

void diff_merges_default_to_dense_combined(struct rev_info *revs);

void diff_merges_default_to_first_parent(struct rev_info *revs);

void diff_merges_setup_revs(struct rev_info *revs);

#endif

Loading…
Cancel
Save