{"thread":{"id":"30519","subject":"git-notes, how do they work?","startedAt":"2012-05-12T10:43:32Z","lastAt":"2012-05-12T11:41:10Z","messageCount":4,"participants":["Ulrich Spoerlein","Nguyen Thai Ngoc Duy","Angus Hammond"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191442","messageId":"20120512104332.GN71676@acme.spoerlein.net","threadId":"30519","inReplyTo":null,"subject":"git-notes, how do they work?","fromName":"Ulrich Spoerlein","fromEmail":"uspoerlein@gmail.com","sentAt":"2012-05-12T10:43:32Z","receivedAt":"2012-05-12T10:43:32Z","isPatch":false,"sender":{"key":"uspoerlein@gmail.com","avatar":null},"body":"Dear all,\n\nI cannot figure out how notes are supposed to stay around and not be\nGC'ed eventually, seeing as nothing references them, usually.\n\nBut let me start from the beginning, I'm using svn2git to convert a\nlarge repository and I want it to store metadata in the notes, which it\ndoes just fine. However, after a while of running (and I suspect garbage\ncollection is to blame) the older notes start to disappear and only HEAD\nhas a note attached to it. This means that the notes, as pushed to\ngithub, are only partially complete.\n\nIIUC refs/notes/commits points to the latest note, which points to HEAD.\nHowever, there's no reference that points to the note pointing to\nHEAD^1, so how will it not be garbage collected? How can it be pushed to\na remote repository?\n\nI understand that notes cannot point to older notes, as that would make\nremoving/adding notes from/to older commits quite a hassle.\n\nSo, what am I doing wrong here? How can I avoid notes from disappearing\nso that each and every one of it remains in the repo?\n\nCheers,\nUli\n"},{"id":"191443","messageId":"CACsJy8DRujbCc5Etod8eCoUW5+SxK-1qbJaAYw7gdvkO2SdSRw@mail.gmail.com","threadId":"30519","inReplyTo":"20120512104332.GN71676@acme.spoerlein.net","subject":"Re: git-notes, how do they work?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-05-12T11:01:40Z","receivedAt":"2012-05-12T11:01:40Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, May 12, 2012 at 5:43 PM, Ulrich Spoerlein <uspoerlein@gmail.com> wrote:\n> IIUC refs/notes/commits points to the latest note, which points to HEAD.\n> However, there's no reference that points to the note pointing to\n> HEAD^1, so how will it not be garbage collected?\n\nNo. refs/notes/commits points to a commit, whose tree contains all\nnotes at the last time a note is changed. This commit has a parent\ncommit that stores note snapshot of the previous change and so on..\n\nrefs/notes/commits is an ordinary ref, which is searched for\nreachability at gc time, so all notes (even replaced notes) cannot be\ndeleted.\n\n> How can it be pushed to a remote repository?\n\nWhat I wrote about were my findings while I studied the notes code.\nI'm new to it too. And I believe there's no mechanism to transfer\nnotes. Of course you can transfer resfs/notes/commits like any other\nrefs, but the objects those notes are attached to might or might not\nexist at destination repo.\n\n> I understand that notes cannot point to older notes, as that would make\n> removing/adding notes from/to older commits quite a hassle.\n>\n> So, what am I doing wrong here? How can I avoid notes from disappearing\n> so that each and every one of it remains in the repo?\n-- \nDuy\n"},{"id":"191445","messageId":"20120512112707.GP71676@acme.spoerlein.net","threadId":"30519","inReplyTo":"CACsJy8DRujbCc5Etod8eCoUW5+SxK-1qbJaAYw7gdvkO2SdSRw@mail.gmail.com","subject":"Re: git-notes, how do they work?","fromName":"Ulrich Spoerlein","fromEmail":"uspoerlein@gmail.com","sentAt":"2012-05-12T11:27:07Z","receivedAt":"2012-05-12T11:27:07Z","isPatch":false,"sender":{"key":"uspoerlein@gmail.com","avatar":null},"body":"On Sat, 2012-05-12 at 18:01:40 +0700, Nguyen Thai Ngoc Duy wrote:\n> On Sat, May 12, 2012 at 5:43 PM, Ulrich Spoerlein <uspoerlein@gmail.com> wrote:\n> > IIUC refs/notes/commits points to the latest note, which points to HEAD.\n> > However, there's no reference that points to the note pointing to\n> > HEAD^1, so how will it not be garbage collected?\n> \n> No. refs/notes/commits points to a commit, whose tree contains all\n> notes at the last time a note is changed. This commit has a parent\n> commit that stores note snapshot of the previous change and so on..\n> \n> refs/notes/commits is an ordinary ref, which is searched for\n> reachability at gc time, so all notes (even replaced notes) cannot be\n> deleted.\n\nCool, I believe this is then a bug with how svn2git works when it's\nbeing restarted to do incremental conversions and have contacted the\nauthor of that code.\n\n> > How can it be pushed to a remote repository?\n> \n> What I wrote about were my findings while I studied the notes code.\n> I'm new to it too. And I believe there's no mechanism to transfer\n> notes. Of course you can transfer resfs/notes/commits like any other\n> refs, but the objects those notes are attached to might or might not\n> exist at destination repo.\n\nPushing them to github works fine like this:\n\n[remote \"github\"]\n        url = github.com:freebsd/freebsd.git\n        push = +refs/heads/master:refs/heads/master\n        push = +refs/heads/release/*:refs/heads/release/*\n        push = +refs/heads/releng/*:refs/heads/releng/*\n        push = +refs/heads/stable/*:refs/heads/stable/*\n        push = +refs/notes/*:refs/notes/*\n\nAnd you will see them displayed in their web UI (at the bottom):\n\nhttps://github.com/freebsd/freebsd/commit/4bef84bb40695b68a4ccdcec5f847b5a7a302864\n\nBut older commits are missing this, most likely because the notes were\nclobbered before I pushed them, e.g.\n\nhttps://github.com/freebsd/freebsd/commit/1e7688b79181301805cd4616daa42ae827d74e99#README\n\n\n> > I understand that notes cannot point to older notes, as that would make\n> > removing/adding notes from/to older commits quite a hassle.\n> >\n> > So, what am I doing wrong here? How can I avoid notes from disappearing\n> > so that each and every one of it remains in the repo?\n> -- \n> Duy\n"},{"id":"191446","messageId":"CAOBOgRbN3FgahEbRAWWjQsZwhzBy5M37S6+5xtK2zbquBs6KVw@mail.gmail.com","threadId":"30519","inReplyTo":"CACsJy8DRujbCc5Etod8eCoUW5+SxK-1qbJaAYw7gdvkO2SdSRw@mail.gmail.com","subject":"Re: git-notes, how do they work?","fromName":"Angus Hammond","fromEmail":"angusgh@gmail.com","sentAt":"2012-05-12T11:41:10Z","receivedAt":"2012-05-12T11:41:10Z","isPatch":false,"sender":{"key":"angusgh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1839397?v=4"},"body":"> What I wrote about were my findings while I studied the notes code.\n> I'm new to it too. And I believe there's no mechanism to transfer\n> notes. Of course you can transfer resfs/notes/commits like any other\n> refs, but the objects those notes are attached to might or might not\n> exist at destination repo.\n\nIf anyone's interested Scott's written a bit about the problems with\nusing notes with remote repositories here:\nhttp://git-scm.com/2010/08/25/notes.html . Having said that the post\nis almost 2 years old and I have no idea about how notes work in git\nmyself so I don't know if it's still completely accurate.\n"}]}