author | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Feb 2012 18:13:27 +0000 (10:13 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 9 Feb 2012 04:44:39 +0000 (20:44 -0800) | ||
commit | 31fd8d72f2eb82c2b6d8d450ee4e13a3925291c3 | |
tree | 4cee9e7f699ac08f014a4659bd5ae690fdfb3d92 | tree | snapshot |
parent | fb630e048c6efabe4d46b1b125fe7348062d38e6 | commit | diff |
tag: do not show non-tag contents with "-n"
"git tag -n" did not check the type of the object it is reading the top n
lines from. At least, avoid showing the beginning of trees and blobs when
dealing with lightweight tags that point at them.
As the payload of a tag and a commit look similar in that they both start
with a header block, which is skipped for the purpose of "-n" output,
followed by human readable text, allow the message of commit objects to be
shown just like the contents of tag objects. This avoids regression for
people who have been using "tag -n" to show the log messages of commits
that are pointed at by lightweight tags.
Test script is from Jeff King.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"git tag -n" did not check the type of the object it is reading the top n
lines from. At least, avoid showing the beginning of trees and blobs when
dealing with lightweight tags that point at them.
As the payload of a tag and a commit look similar in that they both start
with a header block, which is skipped for the purpose of "-n" output,
followed by human readable text, allow the message of commit objects to be
shown just like the contents of tag objects. This avoids regression for
people who have been using "tag -n" to show the log messages of commits
that are pointed at by lightweight tags.
Test script is from Jeff King.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/tag.c | diff | blob | history | |
t/t7004-tag.sh | diff | blob | history |