git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir Panteleev" <vladimir@thecybershadow.net>
To: git@vger.kernel.org
Subject: "git stash list" shows HEAD reflog
Date: Fri, 12 Mar 2010 16:52:45 +0200	[thread overview]
Message-ID: <op.u9gl97fstuzx1w@cybershadow.mshome.net> (raw)

I stumbled upon a curious problem with a repository: the command "git  
stash list" displayed the HEAD reflog instead of the stash list.

The problem was caused by a very long line in ".git/logs/refs/stash". (The  
stash was based on a commit imported from Subversion, the commit message  
of which didn't follow git conventions.) The entire line was longer than  
1023 characters, which is the buffer size passed to fgets in  
for_each_recent_reflog_ent. The validation check (buf[len-1] != '\n')  
causes the line to be skipped. The fix should be simple - if the line read  
didn't fit in the buffer, add a newline anyway instead of skipping the  
line entirely.

That doesn't explain why git displayed the HEAD reflog, though. That seems  
to happen thanks to the check (revs->def && !revs->pending.nr) in  
setup_revisions ("HEAD" is the default, as specified in the caller  
cmd_log_init). It looks like (ideally) git shouldn't rely on whether  
revs->pending is empty to decide whether to use the default, but rather if  
a ref was specified by the user or not.

-- 
Best regards,
  Vladimir                            mailto:vladimir@thecybershadow.net

             reply	other threads:[~2010-03-12 14:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 14:52 Vladimir Panteleev [this message]
2010-03-13 17:37 ` "git stash list" shows HEAD reflog 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
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=op.u9gl97fstuzx1w@cybershadow.mshome.net \
    --to=vladimir@thecybershadow.net \
    --cc=git@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).