All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Dave Olszewski <cxreg@pobox.com>
Cc: Vladimir Panteleev <vladimir@thecybershadow.net>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] don't use default revision if a rev was specified
Date: Sun, 14 Mar 2010 00:19:19 +0100	[thread overview]
Message-ID: <4B9C1D77.3080007@lsrfire.ath.cx> (raw)
In-Reply-To: <1268520425-31889-1-git-send-email-cxreg@pobox.com>

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@pobox.com>
> ---
>>> 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

  reply	other threads:[~2010-03-13 23:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 14:52 "git stash list" shows HEAD reflog Vladimir Panteleev
2010-03-13 17:37 ` René Scharfe
2010-03-13 17:41   ` Dave Olszewski
2010-03-13 20:11     ` René Scharfe
2010-03-13 21:21       ` Re: [git] " Dave Olszewski
2010-03-13 21:49         ` René Scharfe
2010-03-13 22:47           ` [PATCH] don't use default revision if a rev was specified Dave Olszewski
2010-03-13 23:19             ` René Scharfe [this message]
2010-03-14  6:57             ` Junio C Hamano
2010-03-13 21:43   ` "git stash list" shows HEAD reflog Pete Harlan
2010-03-13 22:07     ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B9C1D77.3080007@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=cxreg@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=vladimir@thecybershadow.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.