Re: [PATCH v3 3/5] Documentation: add git-log --merges= option and log.merges config. var
On 04/14/2015 08:42 AM, Eric Sunshine wrote: On Mon, Apr 13, 2015 at 11:29 AM, Koosha Khajehmoogahi koo...@posteo.de wrote: From: Junio C Hamano gits...@pobox.com [kk: added documentation in git-log.txt] Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index f620ee4..88f152f 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -96,6 +96,23 @@ if it is part of the log message. --remove-empty:: Stop when a given path disappears from the tree. +--merges={show|hide|only}:: + + Limit the output by type of commits. + + `hide`;; + Hide merge commits from the output. + + `only`;; + Hide non-merge commits from the output (i.e showing + only merge commits). + + `show`;; + Do not hide either merge or non-merge commits. This + is primarily useful when the user has non-standard + setting of `log.merges` configuration variable that + needs to be overriden from the command line. s/overriden/overridden/ --merges:: Print only merge commits. This is exactly the same as `--min-parents=2`. -- 2.3.3.263.g095251d.dirty Should I send a new reroll or wait for reviews on my other commits. I have not received any review on other patches of this series yet. -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/5] t4202-log: add tests for --merges=
From: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- t/t4202-log.sh | 29 + 1 file changed, 29 insertions(+) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 1b2e981..3edcd81 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -270,6 +270,35 @@ cat expect \EOF * initial EOF +test_expect_success 'setup merges=' ' + git log --min-parents=2 --pretty=tformat:%s expect_only + git log --max-parents=1 --pretty=tformat:%s expect_hide + git log --min-parents=-1 --pretty=tformat:%s expect_show +' + +test_log_merges() { + expect=expect_$1 + config=${2:+-c log.merges=$2} + option=${3:+--merges=$3} + option=${4:-$option} + test_expect_success merges${config:+ $config}${option:+ $option} + git $config log $option --pretty=tformat:%s actual + test_cmp $expect actual + +} + +states=show only hide +for c in '' $states +do + for o in '' $states + do + test_log_merges ${o:-${c:-show}} $c $o + done +done + +test_log_merges hide show '' --no-merges +test_log_merges only hide '' '--merges --max-parents=2' + test_expect_success 'log --graph with merge' ' git log --graph --date-order --pretty=tformat:%s | sed s/ *\$// actual -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/5] revision: add --merges={show|only|hide} option
From: Junio C Hamano gits...@pobox.com Add a new option 'merges=' with possible values of 'only', 'show' and 'hide'. The option is used when showing the list of commits. The value 'only' lists only merges. The value 'show' is the default behavior which shows the commits as well as merges and the value 'hide' makes it just list commit items. [kk: chose names for options; wrote commit message] Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- revision.c | 20 revision.h | 1 + 2 files changed, 21 insertions(+) diff --git a/revision.c b/revision.c index 6399a04..c3c3dcc 100644 --- a/revision.c +++ b/revision.c @@ -1678,6 +1678,23 @@ static void add_message_grep(struct rev_info *revs, const char *pattern) add_grep(revs, pattern, GREP_PATTERN_BODY); } +int parse_merges_opt(struct rev_info *revs, const char *param) +{ + if (!strcmp(param, show)) { + revs-min_parents = 0; + revs-max_parents = -1; + } else if (!strcmp(param, only)) { + revs-min_parents = 2; + revs-max_parents = -1; + } else if (!strcmp(param, hide)) { + revs-min_parents = 0; + revs-max_parents = 1; + } else { + return -1; + } + return 0; +} + static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv, int *unkc, const char **unkv) { @@ -1800,6 +1817,9 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-show_all = 1; } else if (!strcmp(arg, --remove-empty)) { revs-remove_empty_trees = 1; + } else if (starts_with(arg, --merges=)) { + if (parse_merges_opt(revs, arg + 9)) + die(unknown option: %s, arg); } else if (!strcmp(arg, --merges)) { revs-min_parents = 2; } else if (!strcmp(arg, --no-merges)) { diff --git a/revision.h b/revision.h index 0ea8b4e..f9df58c 100644 --- a/revision.h +++ b/revision.h @@ -240,6 +240,7 @@ extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, extern void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx, const struct option *options, const char * const usagestr[]); +extern int parse_merges_opt(struct rev_info *, const char *); #define REVARG_CANNOT_BE_FILENAME 01 #define REVARG_COMMITTISH 02 extern int handle_revision_arg(const char *arg, struct rev_info *revs, -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/5] bash-completion: add support for git-log --merges= and log.merges
Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- contrib/completion/git-completion.bash | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index fbe5972..a75d7f5 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1406,7 +1406,7 @@ _git_ls_tree () __git_log_common_options= --not --all --branches --tags --remotes - --first-parent --merges --no-merges + --first-parent --merges --merges= --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= @@ -1451,7 +1451,11 @@ _git_log () __gitcomp long short ${cur##--decorate=} return ;; - --*) + --merges=*) + __gitcomp show hide only ${cur##--merges=} + return + ;; + --*) __gitcomp $__git_log_common_options $__git_log_shortlog_options @@ -1861,6 +1865,10 @@ _git_config () __gitcomp $__git_log_date_formats return ;; + log.merges) + __gitcomp show hide only + return + ;; sendemail.aliasesfiletype) __gitcomp mutt mailrc pine elm gnus return @@ -2150,6 +2158,7 @@ _git_config () interactive.singlekey log.date log.decorate + log.merges log.showroot mailmap.file man. -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/5] Documentation: add git-log --merges= option and log.merges config. var
From: Junio C Hamano gits...@pobox.com [kk: added documentation in git-log.txt] Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/git-log.txt | 3 +++ Documentation/rev-list-options.txt | 17 + 2 files changed, 20 insertions(+) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 18bc716..e16f0f8 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -190,6 +190,9 @@ log.showRoot:: `git log -p` output would be shown without a diff attached. The default is `true`. +log.merges:: +Default for `--merges=` option. Defaults to `show`. + mailmap.*:: See linkgit:git-shortlog[1]. diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index f620ee4..88f152f 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -96,6 +96,23 @@ if it is part of the log message. --remove-empty:: Stop when a given path disappears from the tree. +--merges={show|hide|only}:: + + Limit the output by type of commits. + + `hide`;; + Hide merge commits from the output. + + `only`;; + Hide non-merge commits from the output (i.e showing + only merge commits). + + `show`;; + Do not hide either merge or non-merge commits. This + is primarily useful when the user has non-standard + setting of `log.merges` configuration variable that + needs to be overriden from the command line. + --merges:: Print only merge commits. This is exactly the same as `--min-parents=2`. -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/5] log: honor log.merges= option
From: Junio C Hamano gits...@pobox.com The config. variable is honored only by log. Other log family commands including show, shortlog and rev-list are affected only from the equivalent command line option (i.e. --merges=). Since these commands are somehow different representations of log command, we like to have the same behavior from them as we do from log itself. However, to not break the default output of them, we do not consider the the config. var. Other log-family commands format-patch and cherry ignore the option altogether (i.e. both on command line and on config settings). [kk: wrote commit message] Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- builtin/log.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..c7a7aad 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -36,6 +36,7 @@ static int decoration_given; static int use_mailmap_config; static const char *fmt_patch_subject_prefix = PATCH; static const char *fmt_pretty; +static const char *log_merges; static const char * const builtin_log_usage[] = { N_(git log [options] [revision range] [[--] path...]), @@ -386,6 +387,9 @@ static int git_log_config(const char *var, const char *value, void *cb) decoration_style = 0; /* maybe warn? */ return 0; } + if (!strcmp(var, log.merges)) { + return git_config_string(log_merges, var, value); + } if (!strcmp(var, log.showroot)) { default_show_root = git_config_bool(var, value); return 0; @@ -628,6 +632,8 @@ int cmd_log(int argc, const char **argv, const char *prefix) init_revisions(rev, prefix); rev.always_show_header = 1; + if (log_merges parse_merges_opt(rev, log_merges)) + die(unknown config value for log.merges: %s, log_merges); memset(opt, 0, sizeof(opt)); opt.def = HEAD; opt.revarg_opt = REVARG_COMMITTISH; -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/5] log: honor log.merges= option
On 04/08/2015 04:28 AM, Junio C Hamano wrote: Koosha Khajehmoogahi koo...@posteo.de writes: On 04/04/2015 10:00 PM, Junio C Hamano wrote: Koosha Khajehmoogahi koo...@posteo.de writes: From: Junio C Hamano gits...@pobox.com [kk: wrote commit message] Ehh, what exactly did you write ;-)? I think the most important thing that needs to be explained by the log message for this change is that the variable is honored only by log and it needs to explain why other Porcelain commands in the same log family, like whatchanged, should ignore the variable. So, what would be the reason? It is strange that you have to ask me to give you the reason why you chose it that way, isn't it? AFAIK, the only other command that supports --merges and --no-merges options is rev-list. This new feature aims to make a default behavior for the commands that have these options. The command-line option is supported by the two commands. However, the config var is only used by git-log and rev-list ignores it. I didn't exclude rev-list for any particular reason. If we need, I could also handle it in rev-list. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/5] log: honor log.merges= option
On 04/04/2015 10:00 PM, Junio C Hamano wrote: Koosha Khajehmoogahi koo...@posteo.de writes: From: Junio C Hamano gits...@pobox.com [kk: wrote commit message] Ehh, what exactly did you write ;-)? I think the most important thing that needs to be explained by the log message for this change is that the variable is honored only by log and it needs to explain why other Porcelain commands in the same log family, like whatchanged, should ignore the variable. So, what would be the reason? I think that we must not to allow format-patch and show to be affected by this variable, because it is silly if log.merges=only broke format-patch output or made git show silent. But I didn't think about others. Whoever is doing this change needs to explain in the log message the reason why it was decided that only git log should pay attention to it. signature.asc Description: OpenPGP digital signature
[PATCH v2 3/5] Documentation: add git-log --merges= option and log.merges config. var
Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/git-log.txt | 3 +++ Documentation/rev-list-options.txt | 18 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 18bc716..e16f0f8 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -190,6 +190,9 @@ log.showRoot:: `git log -p` output would be shown without a diff attached. The default is `true`. +log.merges:: +Default for `--merges=` option. Defaults to `show`. + mailmap.*:: See linkgit:git-shortlog[1]. diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index f620ee4..0bb2390 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -96,12 +96,24 @@ if it is part of the log message. --remove-empty:: Stop when a given path disappears from the tree. +--merges={show|hide|only}:: ++ +-- +`show`: show both merge and non-merge commits + +`hide`: only show non-merge commits; same as `--max-parents=1` + +`only`: only show merge commits; same as `--min-parents=2` + +If `--merges=` is not specified, default value is `show`. +-- ++ + --merges:: - Print only merge commits. This is exactly the same as `--min-parents=2`. + Shorthand for `--merges=only`. --no-merges:: - Do not print commits with more than one parent. This is - exactly the same as `--max-parents=1`. + Shorthand for `--merges=hide`. --min-parents=number:: --max-parents=number:: -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/5] log: honor log.merges= option
From: Junio C Hamano gits...@pobox.com [kk: wrote commit message] Helped-by: Eris Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- builtin/log.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..c7a7aad 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -36,6 +36,7 @@ static int decoration_given; static int use_mailmap_config; static const char *fmt_patch_subject_prefix = PATCH; static const char *fmt_pretty; +static const char *log_merges; static const char * const builtin_log_usage[] = { N_(git log [options] [revision range] [[--] path...]), @@ -386,6 +387,9 @@ static int git_log_config(const char *var, const char *value, void *cb) decoration_style = 0; /* maybe warn? */ return 0; } + if (!strcmp(var, log.merges)) { + return git_config_string(log_merges, var, value); + } if (!strcmp(var, log.showroot)) { default_show_root = git_config_bool(var, value); return 0; @@ -628,6 +632,8 @@ int cmd_log(int argc, const char **argv, const char *prefix) init_revisions(rev, prefix); rev.always_show_header = 1; + if (log_merges parse_merges_opt(rev, log_merges)) + die(unknown config value for log.merges: %s, log_merges); memset(opt, 0, sizeof(opt)); opt.def = HEAD; opt.revarg_opt = REVARG_COMMITTISH; -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/5] t4202-log: add tests for --merges=
Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- t/t4202-log.sh | 84 ++ 1 file changed, 84 insertions(+) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 1b2e981..ceaaf4e 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -270,6 +270,90 @@ cat expect \EOF * initial EOF +test_expect_success 'setup --merges=' ' + git log --min-parents=2 --pretty=tformat:%s expect_only + git log --max-parents=1 --pretty=tformat:%s expect_hide + git log --min-parents=-1 --pretty=tformat:%s expect_show +' + +test_expect_success 'log with config log.merges=show' ' + test_config log.merges show + git log --pretty=tformat:%s actual + test_cmp expect_show actual +' + +test_expect_success 'log with config log.merges=only' ' + test_config log.merges only + git log --pretty=tformat:%s actual + test_cmp expect_only actual +' + +test_expect_success 'log with config log.merges=hide' ' + test_config log.merges hide + git log --pretty=tformat:%s actual + test_cmp expect_hide actual +' + +test_expect_success 'log with config log.merges=show with git log --no-merges' ' + test_config log.merges show + git log --no-merges --pretty=tformat:%s actual + test_cmp expect_hide actual +' + +test_expect_success 'log with config log.merges=hide with git log ---merges' ' + test_config log.merges hide + git log --merges --pretty=tformat:%s actual + test ! -s actual +' + +test_expect_success 'log --merges=show' ' + test_unconfig log.merges + git log --merges=show --pretty=tformat:%s actual + test_cmp expect_show actual +' + +test_expect_success 'log --merges=only' ' + test_unconfig log.merges + git log --merges=only --pretty=tformat:%s actual + test_cmp expect_only actual +' + +test_expect_success 'log --merges=hide' ' + test_unconfig log.merges + git log --merges=hide --pretty=tformat:%s actual + test_cmp expect_hide actual +' + +test_log_merges() { + test_config log.merges $2 + git log --merges=$1 --pretty=tformat:%s actual + test_cmp $3 actual +} + +test_expect_success 'log --merges=show with config log.merges=hide' ' + test_log_merges show hide expect_show +' + +test_expect_success 'log --merges=show with config log.merges=only' ' + test_log_merges show only expect_show +' + +test_expect_success 'log --merges=only with config log.merges=show' ' + test_log_merges only show expect_only +' + +test_expect_success 'log --merges=only with config log.merges=hide' ' + test_log_merges only hide expect_only +' + +test_expect_success 'log --merges=hide with config log.merges=show' ' + test_log_merges hide show expect_hide +' + +test_expect_success 'log --merges=hide with config log.merges=only' ' + test_log_merges hide only expect_hide +' + test_expect_success 'log --graph with merge' ' git log --graph --date-order --pretty=tformat:%s | sed s/ *\$// actual -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/5] bash-completion: add support for git-log --merges= and log.merges
Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- contrib/completion/git-completion.bash | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index fbe5972..a75d7f5 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1406,7 +1406,7 @@ _git_ls_tree () __git_log_common_options= --not --all --branches --tags --remotes - --first-parent --merges --no-merges + --first-parent --merges --merges= --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= @@ -1451,7 +1451,11 @@ _git_log () __gitcomp long short ${cur##--decorate=} return ;; - --*) + --merges=*) + __gitcomp show hide only ${cur##--merges=} + return + ;; + --*) __gitcomp $__git_log_common_options $__git_log_shortlog_options @@ -1861,6 +1865,10 @@ _git_config () __gitcomp $__git_log_date_formats return ;; + log.merges) + __gitcomp show hide only + return + ;; sendemail.aliasesfiletype) __gitcomp mutt mailrc pine elm gnus return @@ -2150,6 +2158,7 @@ _git_config () interactive.singlekey log.date log.decorate + log.merges log.showroot mailmap.file man. -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/5] revision: add --merges={show|only|hide} option
From: Junio C Hamano gits...@pobox.com revision: add a new option 'merges=' with possible values of 'only', 'show' and 'hide'. The option is used when showing the list of commits. The value 'only' lists only merges. The value 'show' is the default behavior which shows the commits as well as merges and the value 'hide' makes it just list commit items. [kk: chose names for options; wrote commit message] Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- revision.c | 20 revision.h | 1 + 2 files changed, 21 insertions(+) diff --git a/revision.c b/revision.c index 6399a04..c3c3dcc 100644 --- a/revision.c +++ b/revision.c @@ -1678,6 +1678,23 @@ static void add_message_grep(struct rev_info *revs, const char *pattern) add_grep(revs, pattern, GREP_PATTERN_BODY); } +int parse_merges_opt(struct rev_info *revs, const char *param) +{ + if (!strcmp(param, show)) { + revs-min_parents = 0; + revs-max_parents = -1; + } else if (!strcmp(param, only)) { + revs-min_parents = 2; + revs-max_parents = -1; + } else if (!strcmp(param, hide)) { + revs-min_parents = 0; + revs-max_parents = 1; + } else { + return -1; + } + return 0; +} + static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv, int *unkc, const char **unkv) { @@ -1800,6 +1817,9 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-show_all = 1; } else if (!strcmp(arg, --remove-empty)) { revs-remove_empty_trees = 1; + } else if (starts_with(arg, --merges=)) { + if (parse_merges_opt(revs, arg + 9)) + die(unknown option: %s, arg); } else if (!strcmp(arg, --merges)) { revs-min_parents = 2; } else if (!strcmp(arg, --no-merges)) { diff --git a/revision.h b/revision.h index 0ea8b4e..f9df58c 100644 --- a/revision.h +++ b/revision.h @@ -240,6 +240,7 @@ extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, extern void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx, const struct option *options, const char * const usagestr[]); +extern int parse_merges_opt(struct rev_info *, const char *); #define REVARG_CANNOT_BE_FILENAME 01 #define REVARG_COMMITTISH 02 extern int handle_revision_arg(const char *arg, struct rev_info *revs, -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/5] Add tests for git-log --merges=show|hide|only
On 03/22/2015 08:57 PM, Torsten Bögershausen wrote: On 22.03.15 19:28, Koosha Khajehmoogahi wrote: Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- t/t4202-log.sh | 141 + 1 file changed, 141 insertions(+) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 5f2b290..ab6f371 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -428,6 +428,147 @@ cat expect \EOF * initial EOF +cat only_merges EOF - please no space after the - please add the at the end of the line: cat only_merges EOF (And the same further down) +test_expect_success 'log with config log.merges=show' ' +git config log.merges show Indent with TAB is good +git log --pretty=tformat:%s actual but indent with 4 spaces not ideal, please use a TAB as well. +test_cmp both_commits_merges actual +git config --unset log.merges Do we need the unset here? The log.merges is nicely set up before each test case, so can we drop the unset lines ? (Or do I miss something ?) Good point; we can drop only those unset lines whose next test sets the log.merges. However, if the next test does not set it, we must unset it as it affects the default behavior of git-log. -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] Update Bash completion script to include git log --merges option
Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- contrib/completion/git-completion.bash | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 731c289..b63bb95 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1406,7 +1406,7 @@ _git_ls_tree () __git_log_common_options= --not --all --branches --tags --remotes - --first-parent --merges --no-merges + --first-parent --merges --merges= --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= @@ -1451,6 +1451,10 @@ _git_log () __gitcomp long short ${cur##--decorate=} return ;; +--merges=*) +__gitcomp show hide only ${cur##--merges=} +return +;; --*) __gitcomp $__git_log_common_options @@ -1861,6 +1865,10 @@ _git_config () __gitcomp $__git_log_date_formats return ;; + log.merges) + __gitcomp show hide only + return + ;; sendemail.aliasesfiletype) __gitcomp mutt mailrc pine elm gnus return @@ -2150,6 +2158,7 @@ _git_config () interactive.singlekey log.date log.decorate + log.merges log.showroot mailmap.file man. -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] Add a new option 'merges' to revision.c
revision.c: add a new option 'merges' with possible values of 'only', 'show' and 'hide'. The option is used when showing the list of commits. The value 'only' lists only merges. The value 'show' is the default behavior which shows the commits as well as merges and the value 'hide' makes it just list commit items. Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- revision.c | 22 ++ revision.h | 1 + 2 files changed, 23 insertions(+) diff --git a/revision.c b/revision.c index 66520c6..edb7bed 100644 --- a/revision.c +++ b/revision.c @@ -1678,6 +1678,23 @@ static void add_message_grep(struct rev_info *revs, const char *pattern) add_grep(revs, pattern, GREP_PATTERN_BODY); } +int parse_merges_opt(struct rev_info *revs, const char *param) +{ + if (!strcmp(param, show)) { + revs-min_parents = 0; + revs-max_parents = -1; + } else if (!strcmp(param, only)) { + revs-min_parents = 2; + revs-max_parents = -1; + } else if (!strcmp(param, hide)) { + revs-min_parents = 0; + revs-max_parents = 1; + } else { + return -1; + } + return 0; +} + static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv, int *unkc, const char **unkv) { @@ -1800,9 +1817,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-show_all = 1; } else if (!strcmp(arg, --remove-empty)) { revs-remove_empty_trees = 1; + } else if (starts_with(arg, --merges=)) { + if (parse_merges_opt(revs, arg + 9)) + die(unknown option: %s, arg); } else if (!strcmp(arg, --merges)) { + revs-max_parents = -1; revs-min_parents = 2; } else if (!strcmp(arg, --no-merges)) { + revs-min_parents = 0; revs-max_parents = 1; } else if (starts_with(arg, --min-parents=)) { revs-min_parents = atoi(arg+14); diff --git a/revision.h b/revision.h index 0ea8b4e..f9df58c 100644 --- a/revision.h +++ b/revision.h @@ -240,6 +240,7 @@ extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, extern void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx, const struct option *options, const char * const usagestr[]); +extern int parse_merges_opt(struct rev_info *, const char *); #define REVARG_CANNOT_BE_FILENAME 01 #define REVARG_COMMITTISH 02 extern int handle_revision_arg(const char *arg, struct rev_info *revs, -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5] Update documentations for git-log to include the new --merges option and also its corresponding config option.
Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/git-log.txt | 3 +++ Documentation/rev-list-options.txt | 6 ++ 2 files changed, 9 insertions(+) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 1f7bc67..506125a 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -190,6 +190,9 @@ log.showroot:: `git log -p` output would be shown without a diff attached. The default is `true`. +log.merges:: +Default for `--merges` option. Defaults to `show`. + mailmap.*:: See linkgit:git-shortlog[1]. diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 4ed8587..398e657 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -99,6 +99,12 @@ if it is part of the log message. --merges:: Print only merge commits. This is exactly the same as `--min-parents=2`. +--merges=show|hide|only:: + If show is specified, merge commits will be shown in conjunction with + other commits. If hide is specified, it will work like `--no-merges`. + If only is specified, it will work like `--merges`. The default option + is show. + --no-merges:: Do not print commits with more than one parent. This is exactly the same as `--max-parents=1`. -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] Make git-log honor log.merges option
Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- builtin/log.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..c7a7aad 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -36,6 +36,7 @@ static int decoration_given; static int use_mailmap_config; static const char *fmt_patch_subject_prefix = PATCH; static const char *fmt_pretty; +static const char *log_merges; static const char * const builtin_log_usage[] = { N_(git log [options] [revision range] [[--] path...]), @@ -386,6 +387,9 @@ static int git_log_config(const char *var, const char *value, void *cb) decoration_style = 0; /* maybe warn? */ return 0; } + if (!strcmp(var, log.merges)) { + return git_config_string(log_merges, var, value); + } if (!strcmp(var, log.showroot)) { default_show_root = git_config_bool(var, value); return 0; @@ -628,6 +632,8 @@ int cmd_log(int argc, const char **argv, const char *prefix) init_revisions(rev, prefix); rev.always_show_header = 1; + if (log_merges parse_merges_opt(rev, log_merges)) + die(unknown config value for log.merges: %s, log_merges); memset(opt, 0, sizeof(opt)); opt.def = HEAD; opt.revarg_opt = REVARG_COMMITTISH; -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] Add tests for git-log --merges=show|hide|only
Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- t/t4202-log.sh | 141 + 1 file changed, 141 insertions(+) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 5f2b290..ab6f371 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -428,6 +428,147 @@ cat expect \EOF * initial EOF +cat only_merges EOF +Merge tag 'reach' +Merge tags 'octopus-a' and 'octopus-b' +Merge branch 'tangle' +Merge branch 'side' (early part) into tangle +Merge branch 'master' (early part) into tangle +Merge branch 'side' +EOF + +cat only_commits EOF +seventh +octopus-b +octopus-a +reach +tangle-a +side-2 +side-1 +Second +sixth +fifth +fourth +third +second +initial +EOF + +cat both_commits_merges EOF +Merge tag 'reach' +Merge tags 'octopus-a' and 'octopus-b' +seventh +octopus-b +octopus-a +reach +Merge branch 'tangle' +Merge branch 'side' (early part) into tangle +Merge branch 'master' (early part) into tangle +tangle-a +Merge branch 'side' +side-2 +side-1 +Second +sixth +fifth +fourth +third +second +initial +EOF + +test_expect_success 'log with config log.merges=show' ' + git config log.merges show +git log --pretty=tformat:%s actual + test_cmp both_commits_merges actual +git config --unset log.merges +' + +test_expect_success 'log with config log.merges=only' ' + git config log.merges only +git log --pretty=tformat:%s actual + test_cmp only_merges actual +git config --unset log.merges +' + +test_expect_success 'log with config log.merges=hide' ' + git config log.merges hide +git log --pretty=tformat:%s actual + test_cmp only_commits actual +git config --unset log.merges +' + +test_expect_success 'log with config log.merges=show with git log --no-merges' ' + git config log.merges show +git log --no-merges --pretty=tformat:%s actual + test_cmp only_commits actual +git config --unset log.merges +' + +test_expect_success 'log with config log.merges=hide with git log ---merges' ' + git config log.merges hide +git log --merges --pretty=tformat:%s actual + test_cmp only_merges actual +git config --unset log.merges +' + +test_expect_success 'log --merges=show' ' +git log --merges=show --pretty=tformat:%s actual + test_cmp both_commits_merges actual +' + +test_expect_success 'log --merges=only' ' +git log --merges=only --pretty=tformat:%s actual + test_cmp only_merges actual +' + +test_expect_success 'log --merges=hide' ' +git log --merges=hide --pretty=tformat:%s actual + test_cmp only_commits actual +' + +test_expect_success 'log --merges=show with config log.merges=hide' ' + git config log.merges hide +git log --merges=show --pretty=tformat:%s actual + test_cmp both_commits_merges actual +git config --unset log.merges +' + +test_expect_success 'log --merges=show with config log.merges=only' ' + git config log.merges only +git log --merges=show --pretty=tformat:%s actual + test_cmp both_commits_merges actual +git config --unset log.merges +' + +test_expect_success 'log --merges=only with config log.merges=show' ' + git config log.merges show +git log --merges=only --pretty=tformat:%s actual + test_cmp only_merges actual +git config --unset log.merges +' + +test_expect_success 'log --merges=only with config log.merges=hide' ' + git config log.merges hide +git log --merges=only --pretty=tformat:%s actual + test_cmp only_merges actual +git config --unset log.merges +' + +test_expect_success 'log --merges=hide with config log.merges=show' ' + git config log.merges show +git log --merges=hide --pretty=tformat:%s actual + test_cmp only_commits actual +git config --unset log.merges +' + +test_expect_success 'log --merges=hide with config log.merges=only' ' + git config log.merges only +git log --merges=hide --pretty=tformat:%s actual + test_cmp only_commits actual +git config --unset log.merges +' + test_expect_success 'log --graph with merge' ' git log --graph --date-order --pretty=tformat:%s | sed s/ *\$// actual -- 2.3.3.263.g095251d.dirty -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/5] Add tests for git-log --merges=show|hide|only
On 03/22/2015 11:40 PM, Eric Sunshine wrote: On Sun, Mar 22, 2015 at 6:07 PM, Koosha Khajehmoogahi koo...@posteo.de wrote: On 03/22/2015 08:57 PM, Torsten Bögershausen wrote: On 22.03.15 19:28, Koosha Khajehmoogahi wrote: Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 5f2b290..ab6f371 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -428,6 +428,147 @@ cat expect \EOF * initial EOF +test_expect_success 'log with config log.merges=show' ' +git config log.merges show +git log --pretty=tformat:%s actual +test_cmp both_commits_merges actual +git config --unset log.merges Do we need the unset here? The log.merges is nicely set up before each test case, so can we drop the unset lines ? (Or do I miss something ?) Good point; we can drop only those unset lines whose next test sets the log.merges. However, if the next test does not set it, we must unset it as it affects the default behavior of git-log. Such an approach would be too fragile. Tests may be re-ordered, added, or removed. Better is to make each test as self-contained as possible. See my review[1] of this patch for alternate suggestions. [1]: http://article.gmane.org/gmane.comp.version-control.git/266099 That's why I wrote them this way actually. Also, thanks for your review. I will refactor my code to consider your suggestions. Thanks. -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
git-send-email.perl should check the version of Perl modules it uses
On Debian Wheezy with its outdated packages, the version of Net::SMTP::SSL is 1.01. If you try to use send-email, the script will crash with the following error: STARTTLS failed! SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/libexec/git-core/git-send-email line 1294 Apparently, that is because the script is calling a subroutine (start_SSL()) that is missing in older versions. I guess the script should check the minimum required version before proceeding with the execution. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/5] Add a new option 'merges' to revision.c
On 03/23/2015 12:31 AM, Junio C Hamano wrote: Koosha Khajehmoogahi koo...@posteo.de writes: @@ -1800,9 +1817,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-show_all = 1; } else if (!strcmp(arg, --remove-empty)) { revs-remove_empty_trees = 1; +} else if (starts_with(arg, --merges=)) { +if (parse_merges_opt(revs, arg + 9)) +die(unknown option: %s, arg); This one makes sense to me (so does what the parse_merges_opt() does). In fact this change was written by you in your previous kind review :-) I will add a 'From: Junio C Hamano gits...@pobox.com' header to my next patch. } else if (!strcmp(arg, --merges)) { +revs-max_parents = -1; revs-min_parents = 2; But is this change warranted? An existing user who is not at all interested in the new --merges= option may be relying on the fact that --merges does not affect the value of max_parents and she can say log --max-parents=2 --merges to see only the two-way merges, for example. This change just broke her, and I do not see why it is a good thing. The point is that if you have your log.merges conf option set to 'hide' and you use git log --merges (two mutually conflicting options), git will silently exit without anything to show. We need to clear the max_parents set by parse_merges_opt() as the user should be able to continue to use --merges without problem. But, your point is also valid. } else if (!strcmp(arg, --no-merges)) { +revs-min_parents = 0; revs-max_parents = 1; Likewise. Similarly, without this, if log.merges is set to 'only' and you use git log --no-merges, you will still see the merges in the output. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [RFC] Add a new config. option for skipping merges in git-log
This patch adds a 'showmerges' config. option for git-log. This option determines whether the log should contain merge commits or not. In essence, if this option is set to false, git-log will be run as 'git-log --no-merges'. To force git-log to show merges even if 'log.showmerges' is set, we use --include-merges command line option. Signed-off-by: Koosha Khajehmoogahi koosha.kha...@gmail.com --- Documentation/config.txt | 3 +++ builtin/log.c| 9 + revision.c | 2 ++ revision.h | 1 + 4 files changed, 15 insertions(+) This is the third time I send this patch as it seems it didn't get delivered even after one hour! Please help me with this patch. It seems that my --include-merges command-line option does not have have any effect on the behavior of git-log. I don't know why the value of force_show_merges is always 0! diff --git a/Documentation/config.txt b/Documentation/config.txt index 1530255..7775b8c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1735,6 +1735,9 @@ log.showroot:: Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which normally hide the root commit will now show it. True by default. +log.showmerges:: + If true, merges will be shown in the log list. True by default. + log.mailmap:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--use-mailmap`. diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..867bcf2 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -31,6 +31,7 @@ static const char *default_date_mode = NULL; static int default_abbrev_commit; static int default_show_root = 1; +static int default_max_parents = -1; static int decoration_style; static int decoration_given; static int use_mailmap_config; @@ -108,6 +109,8 @@ static void cmd_log_init_defaults(struct rev_info *rev) rev-diffopt.stat_graph_width = -1; /* respect statGraphWidth config */ rev-abbrev_commit = default_abbrev_commit; rev-show_root_diff = default_show_root; + if (rev-force_show_merges == 0) + rev-max_parents = default_max_parents; rev-subject_prefix = fmt_patch_subject_prefix; DIFF_OPT_SET(rev-diffopt, ALLOW_TEXTCONV); @@ -390,6 +393,12 @@ static int git_log_config(const char *var, const char *value, void *cb) default_show_root = git_config_bool(var, value); return 0; } + + if (!strcmp(var, log.showmerges)) { + default_max_parents = git_config_bool(var, value) ? -1 : 1; + return 0; + } + if (skip_prefix(var, color.decorate., slot_name)) return parse_decorate_color_config(var, slot_name, value); if (!strcmp(var, log.mailmap)) { diff --git a/revision.c b/revision.c index 66520c6..e7073b8 100644 --- a/revision.c +++ b/revision.c @@ -1804,6 +1804,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-min_parents = 2; } else if (!strcmp(arg, --no-merges)) { revs-max_parents = 1; + } else if (!strcmp(arg, --include-merges)) { + revs-force_show_merges = 1; } else if (starts_with(arg, --min-parents=)) { revs-min_parents = atoi(arg+14); } else if (starts_with(arg, --no-min-parents)) { diff --git a/revision.h b/revision.h index 0ea8b4e..f496472 100644 --- a/revision.h +++ b/revision.h @@ -145,6 +145,7 @@ struct rev_info { unsigned inttrack_linear:1, track_first_time:1, linear:1; + unsigned int force_show_merges:1; enum date_mode date_mode; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [RFC] Add a new config. option for skipping merges in git-log
This patch adds a 'showmerges' config. option for git-log. This option determines whether the log should contain merge commits or not. In essence, if this option is set to false, git-log will be run as 'git-log --no-merges'. To force git-log to show merges even if 'log.showmerges' is set, we use --include-merges command line option. Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/config.txt | 3 +++ builtin/log.c| 9 + revision.c | 2 ++ revision.h | 1 + 4 files changed, 15 insertions(+) Please help me with this patch. It seems that my --include-merges command-line option does not have have any effect on the behavior of git-log. I don't know why the value of force_show_merges is always 0! diff --git a/Documentation/config.txt b/Documentation/config.txt index 1530255..7775b8c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1735,6 +1735,9 @@ log.showroot:: Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which normally hide the root commit will now show it. True by default. +log.showmerges:: + If true, merges will be shown in the log list. True by default. + log.mailmap:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--use-mailmap`. diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..867bcf2 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -31,6 +31,7 @@ static const char *default_date_mode = NULL; static int default_abbrev_commit; static int default_show_root = 1; +static int default_max_parents = -1; static int decoration_style; static int decoration_given; static int use_mailmap_config; @@ -108,6 +109,8 @@ static void cmd_log_init_defaults(struct rev_info *rev) rev-diffopt.stat_graph_width = -1; /* respect statGraphWidth config */ rev-abbrev_commit = default_abbrev_commit; rev-show_root_diff = default_show_root; + if (rev-force_show_merges == 0) + rev-max_parents = default_max_parents; rev-subject_prefix = fmt_patch_subject_prefix; DIFF_OPT_SET(rev-diffopt, ALLOW_TEXTCONV); @@ -390,6 +393,12 @@ static int git_log_config(const char *var, const char *value, void *cb) default_show_root = git_config_bool(var, value); return 0; } + + if (!strcmp(var, log.showmerges)) { + default_max_parents = git_config_bool(var, value) ? -1 : 1; + return 0; + } + if (skip_prefix(var, color.decorate., slot_name)) return parse_decorate_color_config(var, slot_name, value); if (!strcmp(var, log.mailmap)) { diff --git a/revision.c b/revision.c index 66520c6..e7073b8 100644 --- a/revision.c +++ b/revision.c @@ -1804,6 +1804,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-min_parents = 2; } else if (!strcmp(arg, --no-merges)) { revs-max_parents = 1; + } else if (!strcmp(arg, --include-merges)) { + revs-force_show_merges = 1; } else if (starts_with(arg, --min-parents=)) { revs-min_parents = atoi(arg+14); } else if (starts_with(arg, --no-min-parents)) { diff --git a/revision.h b/revision.h index 0ea8b4e..f496472 100644 --- a/revision.h +++ b/revision.h @@ -145,6 +145,7 @@ struct rev_info { unsigned inttrack_linear:1, track_first_time:1, linear:1; + unsigned int force_show_merges:1; enum date_mode date_mode; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [RFC] Add a new config. option for skipping merges in git-log
This patch adds a 'showmerges' config. option for git-log. This option determines whether the log should contain merge commits or not. In essence, if this option is set to false, git-log will be run as 'git-log --no-merges'. To force git-log to show merges even if 'log.showmerges' is set, we use --include-merges command line option. Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/config.txt | 3 +++ builtin/log.c| 9 + revision.c | 2 ++ revision.h | 1 + 4 files changed, 15 insertions(+) This is the second time I send this patch as it seems it didn't get delivered even after one hour! Please help me with this patch. It seems that my --include-merges command-line option does not have have any effect on the behavior of git-log. I don't know why the value of force_show_merges is always 0! diff --git a/Documentation/config.txt b/Documentation/config.txt index 1530255..7775b8c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1735,6 +1735,9 @@ log.showroot:: Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which normally hide the root commit will now show it. True by default. +log.showmerges:: + If true, merges will be shown in the log list. True by default. + log.mailmap:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--use-mailmap`. diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..867bcf2 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -31,6 +31,7 @@ static const char *default_date_mode = NULL; static int default_abbrev_commit; static int default_show_root = 1; +static int default_max_parents = -1; static int decoration_style; static int decoration_given; static int use_mailmap_config; @@ -108,6 +109,8 @@ static void cmd_log_init_defaults(struct rev_info *rev) rev-diffopt.stat_graph_width = -1; /* respect statGraphWidth config */ rev-abbrev_commit = default_abbrev_commit; rev-show_root_diff = default_show_root; + if (rev-force_show_merges == 0) + rev-max_parents = default_max_parents; rev-subject_prefix = fmt_patch_subject_prefix; DIFF_OPT_SET(rev-diffopt, ALLOW_TEXTCONV); @@ -390,6 +393,12 @@ static int git_log_config(const char *var, const char *value, void *cb) default_show_root = git_config_bool(var, value); return 0; } + + if (!strcmp(var, log.showmerges)) { + default_max_parents = git_config_bool(var, value) ? -1 : 1; + return 0; + } + if (skip_prefix(var, color.decorate., slot_name)) return parse_decorate_color_config(var, slot_name, value); if (!strcmp(var, log.mailmap)) { diff --git a/revision.c b/revision.c index 66520c6..e7073b8 100644 --- a/revision.c +++ b/revision.c @@ -1804,6 +1804,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs-min_parents = 2; } else if (!strcmp(arg, --no-merges)) { revs-max_parents = 1; + } else if (!strcmp(arg, --include-merges)) { + revs-force_show_merges = 1; } else if (starts_with(arg, --min-parents=)) { revs-min_parents = atoi(arg+14); } else if (starts_with(arg, --no-min-parents)) { diff --git a/revision.h b/revision.h index 0ea8b4e..f496472 100644 --- a/revision.h +++ b/revision.h @@ -145,6 +145,7 @@ struct rev_info { unsigned inttrack_linear:1, track_first_time:1, linear:1; + unsigned int force_show_merges:1; enum date_mode date_mode; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [RFC] Add a new config. option for skipping merges in git-log
On 03/16/2015 09:50 PM, Junio C Hamano wrote: The command line overrides the config, no? If you set up what the command line defaults to from the config, let the command line parser do whatever it wants to do, and do nothing else after the command line parser returns, wouldn't that be sufficient? Puzzled... Yes, the command line overrides the config. But, the config and command line parameters are parsed in two different files. The question is how you would read the config in revision.c while parsing the command line when there is no function in revision.c for that? Sorry if I look baffled. -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [RFC] Add a new config. option for skipping merges in git-log
On 03/16/2015 06:53 PM, Junio C Hamano wrote: Koosha Khajehmoogahi koo...@posteo.de writes: This patch adds a 'showmerges' config. option for git-log. This option determines whether the log should contain merge commits or not. In essence, if this option is set to false, git-log will be run as 'git-log --no-merges'. To force git-log to show merges even if 'log.showmerges' is set, we use --include-merges command line option. Yuck. I agree that there is currently no way to revert the setting that is touched by --merges and --no-merges back to the default, but I think the right way to fix that is by streamlining these two options, instead of piling yet another kludge --include-merges on top. When we think about possible canned selection modes: (do we show merge commits?) * (do we show non-merge commits?) we have four combinations. Answering the above two questions with No/No would end up showing nothing, which is meaningless, so that leaves us three choices (of course, the user could choose to futz directly with min/max-parents to select only Octopus merges, but that is a more advanced/exotic usage). Wouldn't it make more sense to spell which selection mode the user wants with: git log --merges=selection-mode by naming the three meaningful selection modes with short and sweet names? Perhaps default? show? both? -- show both merge commits and non-merge commits only -- show only merge commits skip -- show only non-merge commits or something? Now, as I always say, I am not great at naming things, so do not take these names as the final suggestion, but I think you got the idea. Of course, then the traditional --merges option can be kept as a short-hand for --merges=only, and --no-merges would become a short-hand for --merges=skip. Once we have done that streamlining of the command line options, it will naturally follow that log.merges = show | only | skip would be a useful configuration option. I doubt we need an extra bit in rev_info to implement such a syntax sugar. diff --git a/revision.h b/revision.h index 0ea8b4e..f496472 100644 --- a/revision.h +++ b/revision.h @@ -145,6 +145,7 @@ struct rev_info { unsigned inttrack_linear:1, track_first_time:1, linear:1; +unsigned int force_show_merges:1; enum date_mode date_mode; Thanks for your suggestions. The extra bit in rev_info is used when we need to compare user's command-line input to his configuration. Since command-line input is processed in revision.c but config. options are read in builtin/log.c, we need a way to pass the value to builtin/log.c. How would you do that without this extra bit? -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [GSoC] Add configuration options for some commonly used command-line options
On 03/15/2015 08:29 PM, Koosha Khajehmoogahi wrote: This patch adds a 'showmerges' config. option for git-log. This option determines whether the log should contain merge commits or not. In essence, if this option is set to true, Sorry, this should be 'false'. git-log will be run as 'git-log --no-merges'. Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/config.txt | 3 +++ builtin/log.c| 8 2 files changed, 11 insertions(+) diff --git a/Documentation/config.txt b/Documentation/config.txt index 1530255..7775b8c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1735,6 +1735,9 @@ log.showroot:: Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which normally hide the root commit will now show it. True by default. +log.showmerges:: + If true, merges will be shown in the log list. True by default. + log.mailmap:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--use-mailmap`. diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..bb36f61 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -31,6 +31,7 @@ static const char *default_date_mode = NULL; static int default_abbrev_commit; static int default_show_root = 1; +static int default_max_parents = -1; static int decoration_style; static int decoration_given; static int use_mailmap_config; @@ -108,6 +109,7 @@ static void cmd_log_init_defaults(struct rev_info *rev) rev-diffopt.stat_graph_width = -1; /* respect statGraphWidth config */ rev-abbrev_commit = default_abbrev_commit; rev-show_root_diff = default_show_root; + rev-max_parents = default_max_parents; rev-subject_prefix = fmt_patch_subject_prefix; DIFF_OPT_SET(rev-diffopt, ALLOW_TEXTCONV); @@ -390,6 +392,12 @@ static int git_log_config(const char *var, const char *value, void *cb) default_show_root = git_config_bool(var, value); return 0; } + + if (!strcmp(var, log.showmerges)) { + default_max_parents = git_config_bool(var, value) ? -1 : 1; + return 0; + } + if (skip_prefix(var, color.decorate., slot_name)) return parse_decorate_color_config(var, slot_name, value); if (!strcmp(var, log.mailmap)) { -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [GSoC] Add configuration options for some commonly used command-line options
This patch adds a 'showmerges' config. option for git-log. This option determines whether the log should contain merge commits or not. In essence, if this option is set to true, git-log will be run as 'git-log --no-merges'. Signed-off-by: Koosha Khajehmoogahi koo...@posteo.de --- Documentation/config.txt | 3 +++ builtin/log.c| 8 2 files changed, 11 insertions(+) diff --git a/Documentation/config.txt b/Documentation/config.txt index 1530255..7775b8c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1735,6 +1735,9 @@ log.showroot:: Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which normally hide the root commit will now show it. True by default. +log.showmerges:: + If true, merges will be shown in the log list. True by default. + log.mailmap:: If true, makes linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1] assume `--use-mailmap`. diff --git a/builtin/log.c b/builtin/log.c index dd8f3fc..bb36f61 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -31,6 +31,7 @@ static const char *default_date_mode = NULL; static int default_abbrev_commit; static int default_show_root = 1; +static int default_max_parents = -1; static int decoration_style; static int decoration_given; static int use_mailmap_config; @@ -108,6 +109,7 @@ static void cmd_log_init_defaults(struct rev_info *rev) rev-diffopt.stat_graph_width = -1; /* respect statGraphWidth config */ rev-abbrev_commit = default_abbrev_commit; rev-show_root_diff = default_show_root; + rev-max_parents = default_max_parents; rev-subject_prefix = fmt_patch_subject_prefix; DIFF_OPT_SET(rev-diffopt, ALLOW_TEXTCONV); @@ -390,6 +392,12 @@ static int git_log_config(const char *var, const char *value, void *cb) default_show_root = git_config_bool(var, value); return 0; } + + if (!strcmp(var, log.showmerges)) { + default_max_parents = git_config_bool(var, value) ? -1 : 1; + return 0; + } + if (skip_prefix(var, color.decorate., slot_name)) return parse_decorate_color_config(var, slot_name, value); if (!strcmp(var, log.mailmap)) { -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Clarification required for microproject Add configuration options for some commonly used command-line options
Does this microproject require the feature to be a generic one for every possible command or should it be limited to some particular commands? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GSoC idea] Resumable clone
Among GSoC 2011 ideas of git [1], it was proposed that a GSoC project could be implementing resumable clone for git. AFAIK, this feature is still missing in git but could be a great idea to be implemented. Does that sound OK to the community? [1]: https://git.wiki.kernel.org/index.php/SoC2011Ideas#Resumable_clone -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Multi-threaded 'git clone'
Greetings, Cloning huge repositories like Linux kernel takes considerable amount of time. Is it possible to incorporate a multi-threaded simultaneous connections functionality for cloning? To what extent do we need to change the architecture of the current code and how large would be the scope of the work? That just seems an interesting idea to me and would liked to share it with the community. Regards -- Koosha -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html