git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] [RFC] Add a new config. option for skipping merges in git-log

From
KKKoosha Khajehmoogahi <koosha@posteo.de>
Date
Mar 16, 2015, 19:33 UTC
Message-ID
<5507301B.2060401@posteo.de>
In-Reply-To
<xmqqpp88rfq0.fsf@gitster.dls.corp.google.com>
On 03/16/2015 06:53 PM, Junio C Hamano wrote:
Show 67 quoted lines
> Koosha Khajehmoogahi <koosha@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 int	track_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
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 8 in “[RFC] Add a new config. option for skipping merges in git-log”
  1. [RFC] Add a new config. option for skipping merges in git-logKoosha Khajehmoogahi, Mar 16, 2015
  2. [RFC] Add a new config. option for skipping merges in git-logKoosha Khajehmoogahi, Mar 16, 2015
  3. [RFC] Add a new config. option for skipping merges in git-logKoosha Khajehmoogahi, Mar 16, 2015
  4. Junio C HamanoMar 16, 2015
  5. Koosha KhajehmoogahiMar 16, 2015
  6. Junio C HamanoMar 16, 2015
  7. Koosha KhajehmoogahiMar 16, 2015
  8. Junio C HamanoMar 16, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.