{"thread":{"id":"381","subject":"diff against a tag ?","startedAt":"2005-04-28T20:09:53Z","lastAt":"2005-04-28T23:44:51Z","messageCount":9,"participants":["Dave Jones","Junio C Hamano","Linus Torvalds","Morten Welinder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2072","messageId":"20050428200953.GD8514@redhat.com","threadId":"381","inReplyTo":null,"subject":"diff against a tag ?","fromName":"Dave Jones","fromEmail":"davej@redhat.com","sentAt":"2005-04-28T20:09:53Z","receivedAt":"2005-04-28T20:09:53Z","isPatch":false,"sender":{"key":"davej@redhat.com","avatar":null},"body":"Maybe I missed this in the discussion on tags recently\n(I kinda tuned out after a while on that thread).\n\nIs there an easy way to express 'show me the diff\nbetween HEAD and 2.6.12rc3' today ?\nLooking at the commit for rc3, theres nothing obvious\nto me distinguishing it from any other commit\nother than the \"Linux v2.6.12-rc3\" in the description,\nwhich makes it somewhat difficult to automate.\n\n\t\tDave\n\n"},{"id":"2075","messageId":"7vpswe7hvj.fsf@assigned-by-dhcp.cox.net","threadId":"381","inReplyTo":"20050428200953.GD8514@redhat.com","subject":"Re: diff against a tag ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-28T20:42:40Z","receivedAt":"2005-04-28T20:42:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"DJ\" == Dave Jones <davej@redhat.com> writes:\n\nDJ> Maybe I missed this in the discussion on tags recently\nDJ> (I kinda tuned out after a while on that thread).\n\nDJ> Is there an easy way to express 'show me the diff\nDJ> between HEAD and 2.6.12rc3' today ?\n\nDepends on your definition of today, but with the patch below I\nsent today, you can say \"diff-tree -p $tag $(cat .git/HEAD)\".\n\n    Subject: [PATCH] Rename and extend read_tree_with_tree_or_commit_sha1\n    Date:\tThu, 28 Apr 2005 12:15:43 -0700\n    Message-ID: <7vu0lq7lwg.fsf@assigned-by-dhcp.cox.net>\n\n    This patch renames read_tree_with_tree_or_commit_sha1() to\n    read_object_with_reference() and extends it to automatically\n    dereference not just \"commit\" objects but \"tag\" objects.  With\n    this patch, you can say e.g.:\n\n        ls-tree $tag\n        read-tree -m $(merge-base $tag $HEAD) $tag $HEAD\n        diff-cache $tag\n        diff-tree $tag $HEAD\n\n"},{"id":"2078","messageId":"Pine.LNX.4.58.0504281358060.18901@ppc970.osdl.org","threadId":"381","inReplyTo":"7vpswe7hvj.fsf@assigned-by-dhcp.cox.net","subject":"Re: diff against a tag ?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-28T21:01:40Z","receivedAt":"2005-04-28T21:01:40Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 28 Apr 2005, Junio C Hamano wrote:\n> \n> Depends on your definition of today, but with the patch below I\n> sent today, you can say \"diff-tree -p $tag $(cat .git/HEAD)\".\n\nI think Dave was wondering how to _find_ the tag in the first place, which \nis a different issue.\n\nRight now fsck is the only thing that reports tags that aren't referenced \nsome other way. Once you know the tag, things are easy - even without \nJunio's patch you can just do\n\n\tobject=$(cat-file tag $tag | sed 's/object //;q')\n\nand then you can just do\n\n\tdiff-tree $object $(cat .git/HEAD)\n\nor whatever you want to do.\n\nDave: do a \"fsck --tags\" in your tree, and it will talk about the tags it\nfinds. Then you can create files like .git/refs/tags/v2.6.12-rc2 that\ncontain pointers to those tags..\n\n\t\tLinus\n\n"},{"id":"2083","messageId":"7vwtqm616h.fsf@assigned-by-dhcp.cox.net","threadId":"381","inReplyTo":"Pine.LNX.4.58.0504281358060.18901@ppc970.osdl.org","subject":"Re: diff against a tag ?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-28T21:28:38Z","receivedAt":"2005-04-28T21:28:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> Right now fsck is the only thing that reports tags that aren't referenced \nLT> some other way. Once you know the tag, things are easy - even without \nLT> Junio's patch you can just do\nLT> \tobject=$(cat-file tag $tag | sed 's/object //;q')\nLT> and then you can just do\nLT> \tdiff-tree $object $(cat .git/HEAD)\nLT> or whatever you want to do.\n\nOf course you are right.  The patch is about skipping the first\nstep and requiring you to know what you have is a tag not a\ncommit.\n\nLT> Dave: do a \"fsck --tags\" in your tree, and it will talk about the tags it\nLT> finds. Then you can create files like .git/refs/tags/v2.6.12-rc2 that\nLT> contain pointers to those tags..\n\nArrrrrrrrrgh!  I just did \"fsck --tags\" blindly X-<.  Good thing\nI was not root.\n\nOf course you meant \"fsck-cache --tags\" ;-).\n\n"},{"id":"2098","messageId":"20050428220626.GC15706@redhat.com","threadId":"381","inReplyTo":"Pine.LNX.4.58.0504281358060.18901@ppc970.osdl.org","subject":"Re: diff against a tag ?","fromName":"Dave Jones","fromEmail":"davej@redhat.com","sentAt":"2005-04-28T22:06:26Z","receivedAt":"2005-04-28T22:06:26Z","isPatch":false,"sender":{"key":"davej@redhat.com","avatar":null},"body":"On Thu, Apr 28, 2005 at 02:01:40PM -0700, Linus Torvalds wrote:\n > \n > \n > On Thu, 28 Apr 2005, Junio C Hamano wrote:\n > > \n > > Depends on your definition of today, but with the patch below I\n > > sent today, you can say \"diff-tree -p $tag $(cat .git/HEAD)\".\n > \n > I think Dave was wondering how to _find_ the tag in the first place, which \n > is a different issue.\n\nIndeed. Sorry if I was unclear.\n\n > Right now fsck is the only thing that reports tags that aren't referenced \n > some other way. Once you know the tag, things are easy - even without \n > Junio's patch you can just do\n > \n > \tobject=$(cat-file tag $tag | sed 's/object //;q')\n > \n > and then you can just do\n > \n > \tdiff-tree $object $(cat .git/HEAD)\n > \n > or whatever you want to do.\n > \n > Dave: do a \"fsck --tags\" in your tree, and it will talk about the tags it\n > finds. Then you can create files like .git/refs/tags/v2.6.12-rc2 that\n > contain pointers to those tags..\n\nGroovy. Is it 'THE LAW' that the first one it reports will always be\nthe most recent tag ?\n\nHmm, in a fresh rsync from your kernel tree, I get this..\ntagged commit a2755a80f40e5794ddc20e00f781af9d6320fafb (v2.6.12-rc3) in 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a\ntagged commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (v2.6.12-rc2) in 9e734775f7c22d2f89943ad6c745571f1930105f\nexpect dangling commits - potential heads - due to lack of head information\ndangling tag 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a\ndangling commit 9acf6597c533f3d5c991f730c6a1be296679018e\ndangling tag 9e734775f7c22d2f89943ad6c745571f1930105f\n\nIs that last part to be expected ?\n\n\t\tDave\n\n"},{"id":"2103","messageId":"Pine.LNX.4.58.0504281518100.18901@ppc970.osdl.org","threadId":"381","inReplyTo":"20050428220626.GC15706@redhat.com","subject":"Re: diff against a tag ?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-28T22:22:21Z","receivedAt":"2005-04-28T22:22:21Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 28 Apr 2005, Dave Jones wrote:\n>\n> Groovy. Is it 'THE LAW' that the first one it reports will always be\n> the most recent tag ?\n\nNope. They are reported in the order they are found, which is not \nmeaningful at all (it depends on the directory ordering, with the \nhighest-level bits being obviously ordered by the sha1 number thanks to \nthe subdirectory stuff).\n\nSo you can only see the name of the tag - there's no ordering. The \ntag-name may of course imply an ordering in itself..\n\n> Hmm, in a fresh rsync from your kernel tree, I get this..\n> tagged commit a2755a80f40e5794ddc20e00f781af9d6320fafb (v2.6.12-rc3) in 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a\n> tagged commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (v2.6.12-rc2) in 9e734775f7c22d2f89943ad6c745571f1930105f\n> expect dangling commits - potential heads - due to lack of head information\n> dangling tag 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a\n> dangling commit 9acf6597c533f3d5c991f730c6a1be296679018e\n> dangling tag 9e734775f7c22d2f89943ad6c745571f1930105f\n> \n> Is that last part to be expected ?\n\nIt even says so: \"expect dangling commits\".\n\nThe tags will always be dangling, since nothing refers to them. Once you \nhave them listed in your tag database (ie you've created files that \nmention them in .git/refs/tags or something), you can tell fsck about \nthem, and fsck won't complain. \n\nSomething like\n\n\tfsck-cache --unreachable $(cat .git/refs/*/*)\n\nwould do it (and depending on exactly how cogito ends up recording them).\n\n\t\tLinus\n"},{"id":"2109","messageId":"118833cc05042816141ba672a4@mail.gmail.com","threadId":"381","inReplyTo":"Pine.LNX.4.58.0504281358060.18901@ppc970.osdl.org","subject":"Re: diff against a tag ?","fromName":"Morten Welinder","fromEmail":"mwelinder@gmail.com","sentAt":"2005-04-28T23:14:22Z","receivedAt":"2005-04-28T23:14:22Z","isPatch":false,"sender":{"key":"mwelinder@gmail.com","avatar":null},"body":"> Right now fsck is the only thing that reports tags that aren't referenced\n> some other way. \n\nWhich begs the question: why wasn't the type of the object made part of the\nfile name?\n\ncommit-babe1234...\ntag-deadbeef5678...\ntree-c0ca4321...\nblob-cafe8765...\n\nThat would have simplied scripts a good deal and listing all tags\nwould be trivial.\n\nMorten\n"},{"id":"2110","messageId":"Pine.LNX.4.58.0504281619080.18901@ppc970.osdl.org","threadId":"381","inReplyTo":"118833cc05042816141ba672a4@mail.gmail.com","subject":"Re: diff against a tag ?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-28T23:27:48Z","receivedAt":"2005-04-28T23:27:48Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 28 Apr 2005, Morten Welinder wrote:\n> \n> Which begs the question: why wasn't the type of the object made part of the\n> file name?\n\nBecause it would just have complicated the code and made it less flexible.\n\nAs it is, we can open an object by just knowing its name, and by \"name\" I \nmean the true one, the SHA1. No need for \"open_blob()\" or anything like \nthat. You just do\n\n\tsha1_file_name(const unsigned char *sha1)\n\nto find out what the filesystem name of the object is, and this works for \n_any_ object.\n\nAnd thanks to this, we can pass in a sha1 _without_ knowing whether it's a \ntree or a commit (or a tag) and just open in. Then, when we figure out \nthat it was a commit rather than a tree, we look up the tree instead. \n\nBeing able to open files _without_ knowing what they are is hugely useful. \nThe user passes you a name, and you can just do the right thing. \n\nBesides, I _still_ don't want scripts mucking around with the objects\ndirectly. Remember? They're encrypted with my super-sekrit zlib encoder\nring, just because people shouldn't be mucking around in them.\n\nTrust me, when the object directories have a million files, you'll thank\nme. You do _not_ want to do a readdir and try to figure out tags that way. \nYou want to do it the way I _force_ you to do it, ie the right way.\n\n\t\tLinus\n"},{"id":"2112","messageId":"20050428234451.GB1730@redhat.com","threadId":"381","inReplyTo":"Pine.LNX.4.58.0504281518100.18901@ppc970.osdl.org","subject":"Re: diff against a tag ?","fromName":"Dave Jones","fromEmail":"davej@redhat.com","sentAt":"2005-04-28T23:44:51Z","receivedAt":"2005-04-28T23:44:51Z","isPatch":false,"sender":{"key":"davej@redhat.com","avatar":null},"body":"On Thu, Apr 28, 2005 at 03:22:21PM -0700, Linus Torvalds wrote:\n\n > > Hmm, in a fresh rsync from your kernel tree, I get this..\n > > tagged commit a2755a80f40e5794ddc20e00f781af9d6320fafb (v2.6.12-rc3) in 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a\n > > tagged commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (v2.6.12-rc2) in 9e734775f7c22d2f89943ad6c745571f1930105f\n > > expect dangling commits - potential heads - due to lack of head information\n > > dangling tag 0397236d43e48e821cce5bbe6a80a1a56bb7cc3a\n > > dangling commit 9acf6597c533f3d5c991f730c6a1be296679018e\n > > dangling tag 9e734775f7c22d2f89943ad6c745571f1930105f\n > > \n > > Is that last part to be expected ?\n > It even says so: \"expect dangling commits\".\n\nheh, I was hex-blinded.\n \n > The tags will always be dangling, since nothing refers to them. Once you \n > have them listed in your tag database (ie you've created files that \n > mention them in .git/refs/tags or something), you can tell fsck about \n > them, and fsck won't complain. \n > \n > Something like\n > \n > \tfsck-cache --unreachable $(cat .git/refs/*/*)\n > \n > would do it (and depending on exactly how cogito ends up recording them).\n\ngreat.\n\n\t\tDave\n\n"}]}