git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Missing git options
@ 2018-02-05  9:12 Martin Häcker
  2018-02-05 18:56 ` Stefan Beller
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Martin Häcker @ 2018-02-05  9:12 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

Hi there,

I just recently learned that not all command line switches seem to automatically correlate to options in the git configuration.

This seems something that should be relatively easy to fix.

What I’m most missing is

— snip —
[log]
	graph = true
	patch = true
— snap —

which would / should correspond to `git log —graph —patch`.

What do you guys think?

Best Regards,
Martin Häcker

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-05  9:12 Missing git options Martin Häcker
@ 2018-02-05 18:56 ` Stefan Beller
  2018-02-05 19:41   ` Junio C Hamano
  2018-02-05 20:11 ` Ævar Arnfjörð Bjarmason
  2018-02-06  0:43 ` brian m. carlson
  2 siblings, 1 reply; 8+ messages in thread
From: Stefan Beller @ 2018-02-05 18:56 UTC (permalink / raw)
  To: Martin Häcker; +Cc: git

On Mon, Feb 5, 2018 at 1:12 AM, Martin Häcker
<mhaecker@schwarz-online.org> wrote:
> Hi there,
>
> I just recently learned that not all command line switches seem to automatically correlate to options in the git configuration.
>
> This seems something that should be relatively easy to fix.
>
> What I’m most missing is
>
> — snip —
> [log]
>         graph = true
>         patch = true
> — snap —
>
> which would / should correspond to `git log —graph —patch`.
>
> What do you guys think?

Feel free to send patches adding these options.

I had the impression that git-log was a pseudo-plumbing,
despite it being explicitly marked porcelain
as there is no good plumbing alternative.
But as we already have things like log.date, log.decorate,
that change the output of git-log, I think a patch or graph
option would be ok.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-05 18:56 ` Stefan Beller
@ 2018-02-05 19:41   ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2018-02-05 19:41 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Martin Häcker, git

Stefan Beller <sbeller@google.com> writes:

> I had the impression that git-log was a pseudo-plumbing,
> despite it being explicitly marked porcelain
> as there is no good plumbing alternative.

I do not think that is a fair assessment of the situation.  The more
troublesome is that depending on what exactly you want to do, you
need to use a different plumbing command and/or combinations of
them, which means people need to _learn_ Git scripting.  

We recently saw that somebody used "log -1 --pretty=format:%T
$commit" when the code only needed to say "rev-parse --verify
$commit^{tree}" and got broken due to end-user configuration ;-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-05  9:12 Missing git options Martin Häcker
  2018-02-05 18:56 ` Stefan Beller
@ 2018-02-05 20:11 ` Ævar Arnfjörð Bjarmason
  2018-02-06  0:43 ` brian m. carlson
  2 siblings, 0 replies; 8+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-02-05 20:11 UTC (permalink / raw)
  To: Martin Häcker; +Cc: git


On Mon, Feb 05 2018, Martin Häcker jotted:

> Hi there,
>
> I just recently learned that not all command line switches seem to automatically correlate to options in the git configuration.
>
> This seems something that should be relatively easy to fix.
>
> What I’m most missing is
>
> — snip —
> [log]
> 	graph = true
> 	patch = true
> — snap —
>
> which would / should correspond to `git log —graph —patch`.
>
> What do you guys think?

FWIW my WIP
https://public-inbox.org/git/20170328131316.32516-1-avarab@gmail.com/
had some discussion around this.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-05  9:12 Missing git options Martin Häcker
  2018-02-05 18:56 ` Stefan Beller
  2018-02-05 20:11 ` Ævar Arnfjörð Bjarmason
@ 2018-02-06  0:43 ` brian m. carlson
  2018-02-06 11:13   ` Martin Häcker
  2 siblings, 1 reply; 8+ messages in thread
From: brian m. carlson @ 2018-02-06  0:43 UTC (permalink / raw)
  To: Martin Häcker; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

On Mon, Feb 05, 2018 at 10:12:05AM +0100, Martin Häcker wrote:
> Hi there,
> 
> I just recently learned that not all command line switches seem to automatically correlate to options in the git configuration.
> 
> This seems something that should be relatively easy to fix.
> 
> What I’m most missing is
> 
> — snip —
> [log]
> 	graph = true
> 	patch = true
> — snap —
> 
> which would / should correspond to `git log —graph —patch`.
> 
> What do you guys think?

I think this is likely to cause problems.  Many people use git log with
--pretty to format commit hashes or messages into other programs.  I'm
aware of multiple tools that will simply break if --graph or --patch
become the default.  Requiring people to retrofit their tools to use
--no-graph or --no-patch is likely to be a burden.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 867 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-06  0:43 ` brian m. carlson
@ 2018-02-06 11:13   ` Martin Häcker
  2018-02-06 11:47     ` Duy Nguyen
  2018-02-06 18:27     ` Jonathan Nieder
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Häcker @ 2018-02-06 11:13 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

Hi all,

> Am 06.02.2018 um 01:43 schrieb brian m. carlson <sandals@crustytoothpaste.net>:
> 
> I think this is likely to cause problems.  Many people use git log with
> --pretty to format commit hashes or messages into other programs.  I'm
> aware of multiple tools that will simply break if --graph or --patch
> become the default.  Requiring people to retrofit their tools to use
> --no-graph or --no-patch is likely to be a burden.

While I share your concern, this is something that will completely freeze development of the git tui which I cannot imagine is wanted.

If this where my tool, I would much rather advertise an output format specifically for scripting.

An interim solution could be something like an `—ignore-configuration` option that allows script writers to get predictable output. This however still freezes the default output of git forever.

So you will need something like —output-for=scripting|json|xml|whatever sooner or later. Mixing up the TUI for humans and for scripts is not going to be fun to evolve.

Best Regards,
Martin Häcker


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-06 11:13   ` Martin Häcker
@ 2018-02-06 11:47     ` Duy Nguyen
  2018-02-06 18:27     ` Jonathan Nieder
  1 sibling, 0 replies; 8+ messages in thread
From: Duy Nguyen @ 2018-02-06 11:47 UTC (permalink / raw)
  To: Martin Häcker; +Cc: brian m. carlson, Git Mailing List

On Tue, Feb 6, 2018 at 6:13 PM, Martin Häcker
<mhaecker@schwarz-online.org> wrote:
> This however still freezes the default output of git forever.

Why is that a bad thing? Default output format should not change
(much) from version to version, or from machine to machine (because of
different ~/.gitconfig) for that matter. I don't want to type "git
log" on somebody else's machine and have a big surprise. You _can_
customize output but that should be explicit.

If you want good defaults, that's what aliases are for. I personally
rarely type "git log". I have "l", "lp", "l1"  and other aliases for
my everyday use.
-- 
Duy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing git options
  2018-02-06 11:13   ` Martin Häcker
  2018-02-06 11:47     ` Duy Nguyen
@ 2018-02-06 18:27     ` Jonathan Nieder
  1 sibling, 0 replies; 8+ messages in thread
From: Jonathan Nieder @ 2018-02-06 18:27 UTC (permalink / raw)
  To: Martin Häcker; +Cc: brian m. carlson, git

Hi,

Martin Häcker wrote:
>> Am 06.02.2018 um 01:43 schrieb brian m. carlson <sandals@crustytoothpaste.net>:

>> I think this is likely to cause problems.  Many people use git log with
>> --pretty to format commit hashes or messages into other programs.  I'm
>> aware of multiple tools that will simply break if --graph or --patch
>> become the default.  Requiring people to retrofit their tools to use
>> --no-graph or --no-patch is likely to be a burden.
>
> While I share your concern, this is something that will completely
> freeze development of the git tui which I cannot imagine is wanted.

On the contrary, we take things on a case by case basis.  Brian
described a cost to your proposed change and you described a benefit;
the next step would be to figure out a way to accomplish what you're
aiming to do in a way that maximizes the benefit and minimizes the
cost.

In other words, it is not that we never change default output formats,
but we do care a lot about helping existing users.  One way of doing
that is to provide more convenient machine-readable versions of some
commands so that it is obvious to script writers what to use.

As Stefan Beller mentioned, "git log" is in interesting case, in that
the scripting commands exist:

 - "git rev-list" to list commits satisfying some criteria
 - "git diff-tree --stdin" to show information about those commits

But these commands were not sufficiently discoverable and easy to use,
so people end up using "git log" for scripting anyway.  We provide

 - "git log --format" to produce log output with a fixed format, and
   in particular

 - "git log --format=raw" to print raw objects

It's perfectly normal and common to change what "git log
--format=medium" (the default format) prints, as long as we take into
account the effect on existing users.  In particular:

 - Some scripts do not care about the *exact* format from "git log"
   but are using the output for a particular purpose (e.g. to generate
   release notes that they distribute along with compiler output).
   If these scripts start _sometimes_ using --graph instead based on
   configuration, this would be disruptive to some users.

 - Making --format suppress `log.graph` configuration feels confusing
   and hard to explain to me.  --graph --format=<x> would mean something
   different from -c log.graph=true --format=<x>, except when <x> =
   medium, or "--format=medium" would mean something different from not
   specifying --format at all even though medium is the default format.

In that context, it feels simpler to me to use aliases:

	[alias]
		l = log --oneline --graph --patch

That way, it does not confuse scripts, and even better, it is easier
to type, as "git l".

I would be happy to see some documentation pointing users to the
alias feature for this purpose.

As an example of changing the default "git log" format, see the
history in "git log --grep=decorate".  I am all for that kind of
change, but I don't think --graph or --patch falls into this category.

Thanks and hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-06 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05  9:12 Missing git options Martin Häcker
2018-02-05 18:56 ` Stefan Beller
2018-02-05 19:41   ` Junio C Hamano
2018-02-05 20:11 ` Ævar Arnfjörð Bjarmason
2018-02-06  0:43 ` brian m. carlson
2018-02-06 11:13   ` Martin Häcker
2018-02-06 11:47     ` Duy Nguyen
2018-02-06 18:27     ` Jonathan Nieder

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).