{"thread":{"id":"485","subject":"[PATCH] have commit-id dereference git tags","startedAt":"2005-05-05T07:48:23Z","lastAt":"2005-05-05T21:14:44Z","messageCount":2,"participants":["Alexander Beyn","Matt Porter"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2613","messageId":"20050505074823.GA9075@fatelectrons.org","threadId":"485","inReplyTo":null,"subject":"[PATCH] have commit-id dereference git tags","fromName":"Alexander Beyn","fromEmail":"malex-git@fatelectrons.org","sentAt":"2005-05-05T07:48:23Z","receivedAt":"2005-05-05T07:48:23Z","isPatch":true,"sender":{"key":"malex-git@fatelectrons.org","avatar":null},"body":"With this patch, if commit-id is passed a git tag, it will check to see\nif the tag points to a commit. If it does, commit-id will return that\ncommit's id.\n\nI'm not sure if this is the proper place to handle git tags, but it does\nmake things like \"cg-diff -r v2.6.12-rc2:v2.6.12-rc3\" work in the Linus\nkernel tree. I've not noticed any problems this introduces, but I didn't \ndo a thorough check.\n\nSigned-Off-By: Alexander Beyn <malex-git@fatelectrons.org>\n\n\nIndex: commit-id\n===================================================================\n--- 6a20fd05c468097d5a5a47cd37b41581c963cf63/commit-id  (mode:100755 sha1:daf0ea1e35f1bee22eb4c4771495b2212d15f4e7)\n+++ 66fded2e9d931ecc8b03aa282a7eb9559955c172/commit-id  (mode:100755 sha1:978c3ffeb072422436af7af1ad4a8de0e91c9632)\n@@ -32,7 +32,15 @@\n \texit 1\n fi\n \n-if [ \"$(git-cat-file -t \"$id\")\" != \"commit\" ]; then\n+type=\"$(git-cat-file -t \"$id\")\"\n+\n+if [ \"$type\" = \"tag\" ]; then\n+\tid=$(git-cat-file tag \"$id\" | egrep -m 1 \"^object $SHA1\")\n+\tid=\"${id#object }\"\n+\ttype=\"$(git-cat-file -t \"$id\")\"\n+fi\n+\n+if [ \"$type\" != \"commit\" ]; then\n \techo \"Invalid id: $id\" >&2\n \texit 1\n fi\n"},{"id":"2634","messageId":"20050505141444.B10541@cox.net","threadId":"485","inReplyTo":"20050505074823.GA9075@fatelectrons.org","subject":"Re: [PATCH] have commit-id dereference git tags","fromName":"Matt Porter","fromEmail":"mporter@kernel.crashing.org","sentAt":"2005-05-05T21:14:44Z","receivedAt":"2005-05-05T21:14:44Z","isPatch":true,"sender":{"key":"mporter@kernel.crashing.org","avatar":null},"body":"On Thu, May 05, 2005 at 12:48:23AM -0700, Alexander Beyn wrote:\n> With this patch, if commit-id is passed a git tag, it will check to see\n> if the tag points to a commit. If it does, commit-id will return that\n> commit's id.\n> \n> I'm not sure if this is the proper place to handle git tags, but it does\n> make things like \"cg-diff -r v2.6.12-rc2:v2.6.12-rc3\" work in the Linus\n> kernel tree. I've not noticed any problems this introduces, but I didn't \n> do a thorough check.\n\nI like this feature and it works on the Linus tree for me as well.\nHowever, it fails on the cogito tree as follows:\n\nmporter@beef:~/src/cogito$ cg-diff -r git-pasky-0.7:cogito-0.8\n.git/objects/c8/3b95297c2a6336c2007548f909769e0862b509: No such file or directory\nfatal: git-cat-file c83b95297c2a6336c2007548f909769e0862b509: bad file\nInvalid id: c83b95297c2a6336c2007548f909769e0862b509\nusage: git-cat-file [-t | tagname] <sha1>\nusage: git-cat-file [-t | tagname] <sha1>\nInvalid id:\n\nI haven't looked any further at it yet though.\n\n-Matt\n"}]}