revision: provide implementation for diff merges tweaks
Use these implementations from show_setup_revisions_tweak() and log_setup_revisions_tweak() in builtin/log.c. This completes moving of management of diff merges parameters to a single place, where we can finally observe them simultaneously. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
027c4783d7
commit
3d4fd94363
@ -598,15 +598,7 @@ static int show_tree_object(const struct object_id *oid,
|
|||||||
static void show_setup_revisions_tweak(struct rev_info *rev,
|
static void show_setup_revisions_tweak(struct rev_info *rev,
|
||||||
struct setup_revision_opt *opt)
|
struct setup_revision_opt *opt)
|
||||||
{
|
{
|
||||||
if (rev->ignore_merges < 0) {
|
rev_diff_merges_default_to_dense_combined(rev);
|
||||||
/* There was no "-m" variant on the command line */
|
|
||||||
rev->ignore_merges = 0;
|
|
||||||
if (!rev->first_parent_only && !rev->combine_merges) {
|
|
||||||
/* No "--first-parent", "-c", or "--cc" */
|
|
||||||
rev->combine_merges = 1;
|
|
||||||
rev->dense_combined_merges = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!rev->diffopt.output_format)
|
if (!rev->diffopt.output_format)
|
||||||
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
|
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
}
|
}
|
||||||
@ -731,8 +723,7 @@ static void log_setup_revisions_tweak(struct rev_info *rev,
|
|||||||
if (!rev->diffopt.output_format && rev->combine_merges)
|
if (!rev->diffopt.output_format && rev->combine_merges)
|
||||||
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
|
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
|
|
||||||
if (rev->first_parent_only && rev->ignore_merges < 0)
|
rev_diff_merges_first_parent_defaults_to_enable(rev);
|
||||||
rev->ignore_merges = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmd_log(int argc, const char **argv, const char *prefix)
|
int cmd_log(int argc, const char **argv, const char *prefix)
|
||||||
|
19
revision.c
19
revision.c
@ -2209,6 +2209,25 @@ static void setup_diff_merges_revs(struct rev_info *revs)
|
|||||||
die("--combined-all-paths makes no sense without -c or --cc");
|
die("--combined-all-paths makes no sense without -c or --cc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rev_diff_merges_first_parent_defaults_to_enable(struct rev_info *revs)
|
||||||
|
{
|
||||||
|
if (revs->first_parent_only && revs->ignore_merges < 0)
|
||||||
|
revs->ignore_merges = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rev_diff_merges_default_to_dense_combined(struct rev_info *revs)
|
||||||
|
{
|
||||||
|
if (revs->ignore_merges < 0) {
|
||||||
|
/* There was no "-m" variant on the command line */
|
||||||
|
revs->ignore_merges = 0;
|
||||||
|
if (!revs->first_parent_only && !revs->combine_merges) {
|
||||||
|
/* No "--first-parent", "-c", or "--cc" */
|
||||||
|
revs->combine_merges = 1;
|
||||||
|
revs->dense_combined_merges = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
|
static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
|
||||||
int *unkc, const char **unkv,
|
int *unkc, const char **unkv,
|
||||||
const struct setup_revision_opt* opt)
|
const struct setup_revision_opt* opt)
|
||||||
|
@ -456,4 +456,7 @@ int rewrite_parents(struct rev_info *revs,
|
|||||||
*/
|
*/
|
||||||
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
|
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
|
||||||
|
|
||||||
|
void rev_diff_merges_default_to_dense_combined(struct rev_info *revs);
|
||||||
|
void rev_diff_merges_first_parent_defaults_to_enable(struct rev_info *revs);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user