"git stash list" shows HEAD reflog

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

 



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@xxxxxxxxxxxxxxxxxx

--
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]