Re: [PATCH] specifying ranges: we did not mean to make ".." an empty set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

>> --- a/Documentation/revisions.txt
>> +++ b/Documentation/revisions.txt
>> @@ -213,6 +213,13 @@ of 'r1' and 'r2' and is defined as
>>  It is the set of commits that are reachable from either one of
>>  'r1' or 'r2' but not from both.
>>  
>> +In these two shorthands, you can omit one end and let it default to HEAD.
>> +For example, 'origin..' is a shorthand for 'origin..HEAD' and asks "What
>> +did I do since I forked from the origin branch?"  Similarly, '..origin'
>> +is a shorthand for 'HEAD..origin' and asks "What did the origin do since
>> +I forked from them?"  Note that '..' would mean 'HEAD..HEAD' which is an
>> +empty range that is both reachable and unreachable from HEAD.
>
> This last sentence confuses me. Now we are documenting that "yes, ..
> really means HEAD..HEAD, which is the empty range". But isn't the point
> of this patch to say "sure, it would be the empty range, but because
> that is stupid and pointless, we do not consider it valid and treat ..
> as a pathspec"?

No, we still allow ".." as a short-hand for HEAD..HEAD when it is
understood as a rev.  We also allow ".." as a pathspec to match the
parent directory when it is understood as a pathspec.

The only thing the topic wanted to change was the disambiguation
logic.  When a string S can name both rev and path, we ask the user
to disambiguate, but when S is "..", we do not have to (as one
interpretation is meaningless).

> I think that may be what you are trying to say with the "would" in that
> sentence, but perhaps this would be a good point to expand and mention
> that we special-case "..".

I think that documentation belongs to the section of disambiguation
without "--".  Usually you need to use "--", but ".." is taken as
path even without "--".  An interesting side effect is that

	git log .. pu

used to error out for ".." being both rev and path, but it will
error out for "pu" not being a path in the working tree.  This is
because on a command line without "--" disambiguation, once you
start listing paths, you have to have nothing but paths after that
point.

>> +test_expect_success 'dotdot is not an empty set' '
>> +	( H=$(git rev-parse HEAD) && echo $H ; echo ^$H ) >expect &&
>
> It almost certainly doesn't matter in practice, but the ';' here would
> break the &&-chain from rev-parse.

Yeah, my bad.  Thanks for spotting.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]