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

Re: [PATCH 2/2] Add revision range support on "-" and "@{-1}"

From
KCKenny Lee Sin Cheong <kenny.lee28@gmail.com>
Date
Mar 17, 2015, 21:25 UTC
Message-ID
<87egons4du.fsf@gmail.com>
In-Reply-To
<xmqq8uewp183.fsf@gitster.dls.corp.google.com>
On Tue, Mar 17 2015 at 02:49:48 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
> 	if (try to see if it is a revision or regvision range) {
>         	/* if failed ... */
> 		if (starts with '-') {
>                 	do the option thing;
>                         continue;
> 		}
> 		/* args must be pathspecs from here on */
>                 check the  '--' disambiguation;
>                 add pathspec to prune-data;
> 	} else {
> 		got_rev_arg = 1;
> 	}
>
> but I didn't trace the logic myself to see if that would work.

You're right. I was actually going to try and check all possible suffixes of "-" but your solution saves us from doing that, and it didn't break any tests.

On a similar note, would it be relevant to add similar changes to rev-parse? While trying to write some test, I noticed that rev-parse doesn't support "-". If I'm not mistaking it assumes everything that starts with "-" must be an option. But since it is a plumbing tool I don't know if it would be worth it or even an improvement.

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 9 in “[GSoC] revision.c: Allow "-" as stand-in for "@{-1}" everywhere a branch is allowed”
  1. 0/2 [GSoC] revision.c: Allow "-" as stand-in for "@{-1}" everywhere a branch is allowedKenny Lee Sin Cheong, Mar 16, 2015
  2. 1/2 "-" and "@{-1}" on various programsKenny Lee Sin Cheong, Mar 16, 2015
  3. 2/2 Add revision range support on "-" and "@{-1}"Kenny Lee Sin Cheong, Mar 16, 2015
  4. Junio C HamanoMar 16, 2015
  5. Junio C HamanoMar 17, 2015
  6. Kenny Lee Sin CheongMar 17, 2015
  7. Junio C HamanoMar 17, 2015
  8. Kenny Lee Sin CheongMar 24, 2015
  9. Junio C HamanoMar 25, 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.