Subject: Re: qgit reports errors in the git repository

From: Pavel Roskin <[email-masked]>
Date: Thu, 15 Dec 2005 00:27:57 -0500

On Mon, 2005-12-12 at 17:06 -0800, Linus Torvalds wrote:
> 
> Basically, qgit should do either:
> 
>  - check the type of the object by hand first (using "git-cat-file -t" and 
>    then follow any tags it finds by hand)

I'm a complete Qt newbie, but this patch seems to work for me.

Signed-off-by: Pavel Roskin <[email-masked]>

diff --git a/src/git_startup.cpp b/src/git_startup.cpp
index e08d466..1f6e9ad 100644
--- a/src/git_startup.cpp
+++ b/src/git_startup.cpp
@@ -111,6 +111,10 @@ bool Git::getRefs() {
 
 		if (itNext != rLst.constEnd() && (*itNext).right(3) == "^{}") {
 			signedTag = true;
+			if (!run("git-cat-file -t " + refSha, &runOutput))
+				continue; // invalid SHA1
+			if (runOutput != "tag\n")
+				continue; // not a tag
 			if (run("git-cat-file tag " + refSha, &runOutput)) {
 				QString msg(runOutput.section("\n\n", 1));
 				if (!msg.isEmpty())

-- 
Regards,
Pavel Roskin