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

Re: [RFC] revision: Don't let ^<rev> cancel out the default <rev>

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 29, 2018, 21:03 UTC
Message-ID
<xmqqin3s94vf.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180829200553.19379-1-agruenba@redhat.com>
Andreas Gruenbacher <agruenba@redhat.com> writes:
Show 14 quoted lines
> Some commands like 'log' default to HEAD if no other revisions are
> specified on the command line or otherwise.  Unfortunately, excludes
> (^<rev>) cancel out that default, so when a command only excludes
> revisions (e.g., 'git log ^origin/master'), the command will not produce
> any result.
>
> If all the specified revisions are excludes, it seems more useful to
> stick with the default revision instead.
>
> This makes writing wrappers that exclude certain revisions much easier:
> for example, a simple alias l='git log ^origin/master' will show the
> revisions between origin/master and HEAD by default, and 'l foo' will
> show the revisions between origin/master and foo, as you would usually
> expect.

That is a _huge_ departure from the behaviour established for the past 10 years, but it would certainly be more useful.

As long as we can prove that that a command line with only negative revs is absolutely useless, the backward incompatibility may be OK to swallow, especially for commands like "git log" that implicitly use "--default HEAD", as they are meant for human consumption, and not for scripts.

I am not offhand 100% sure that a rev list with only negative revs is totally useless, though.

Previous: Andreas GruenbacherNext: Jeff King
Message 2 of 3 in “[RFC] revision: Don't let ^<rev> cancel out the default <rev>”
  1. Andreas GruenbacherAug 29, 2018
  2. Junio C HamanoAug 29, 2018
  3. Jeff KingAug 29, 2018

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.