Re: [PATCH] don't use default revision if a rev was specified

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

 



Am 13.03.2010 23:47, schrieb Dave Olszewski:
> If a revision is specified, it happens not to have any commits, don't
> use the default revision.  By doing so, surprising and undesired
> behavior can happen, such as showing the reflog for HEAD when a branch
> was specified.
> 
> Signed-off-by: Dave Olszewski <cxreg@xxxxxxxxx>
> ---
>>> I was testing a patch along the lines of
>>> what Vladimir proposed, which was simply to not set the default rev if a
>>> valid user-specified argument was found, whether or not it contains
>>> commits.
>>
>> Sounds more like it.  How did the tests go?  Does it result in empty
>> output (which is what I would expect from an empty reflog, now that I
>> stopped and thought about it for a second)?
> 
> It seems to work ok(tm)
> 
>  revision.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

Thanks.  And here's an updated, squash-able test.

diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh
index c18ed8e..ba25ff3 100755
--- a/t/t1411-reflog-show.sh
+++ b/t/t1411-reflog-show.sh
@@ -64,4 +64,13 @@ test_expect_success 'using --date= shows reflog date (oneline)' '
 	test_cmp expect actual
 '
 
+: >expect
+test_expect_success 'empty reflog file' '
+	git branch empty &&
+	: >.git/logs/refs/heads/empty &&
+
+	git log -g empty >actual &&
+	test_cmp expect actual
+'
+
 test_done
--
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]