* git-notes, how do they work?
@ 2012-05-12 10:43 Ulrich Spoerlein
2012-05-12 11:01 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Spoerlein @ 2012-05-12 10:43 UTC (permalink / raw)
To: git
Dear all,
I cannot figure out how notes are supposed to stay around and not be
GC'ed eventually, seeing as nothing references them, usually.
But let me start from the beginning, I'm using svn2git to convert a
large repository and I want it to store metadata in the notes, which it
does just fine. However, after a while of running (and I suspect garbage
collection is to blame) the older notes start to disappear and only HEAD
has a note attached to it. This means that the notes, as pushed to
github, are only partially complete.
IIUC refs/notes/commits points to the latest note, which points to HEAD.
However, there's no reference that points to the note pointing to
HEAD^1, so how will it not be garbage collected? How can it be pushed to
a remote repository?
I understand that notes cannot point to older notes, as that would make
removing/adding notes from/to older commits quite a hassle.
So, what am I doing wrong here? How can I avoid notes from disappearing
so that each and every one of it remains in the repo?
Cheers,
Uli
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-notes, how do they work?
2012-05-12 10:43 git-notes, how do they work? Ulrich Spoerlein
@ 2012-05-12 11:01 ` Nguyen Thai Ngoc Duy
2012-05-12 11:27 ` Ulrich Spoerlein
2012-05-12 11:41 ` Angus Hammond
0 siblings, 2 replies; 4+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-12 11:01 UTC (permalink / raw)
To: Ulrich Spoerlein; +Cc: git
On Sat, May 12, 2012 at 5:43 PM, Ulrich Spoerlein <uspoerlein@gmail.com> wrote:
> IIUC refs/notes/commits points to the latest note, which points to HEAD.
> However, there's no reference that points to the note pointing to
> HEAD^1, so how will it not be garbage collected?
No. refs/notes/commits points to a commit, whose tree contains all
notes at the last time a note is changed. This commit has a parent
commit that stores note snapshot of the previous change and so on..
refs/notes/commits is an ordinary ref, which is searched for
reachability at gc time, so all notes (even replaced notes) cannot be
deleted.
> How can it be pushed to a remote repository?
What I wrote about were my findings while I studied the notes code.
I'm new to it too. And I believe there's no mechanism to transfer
notes. Of course you can transfer resfs/notes/commits like any other
refs, but the objects those notes are attached to might or might not
exist at destination repo.
> I understand that notes cannot point to older notes, as that would make
> removing/adding notes from/to older commits quite a hassle.
>
> So, what am I doing wrong here? How can I avoid notes from disappearing
> so that each and every one of it remains in the repo?
--
Duy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-notes, how do they work?
2012-05-12 11:01 ` Nguyen Thai Ngoc Duy
@ 2012-05-12 11:27 ` Ulrich Spoerlein
2012-05-12 11:41 ` Angus Hammond
1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Spoerlein @ 2012-05-12 11:27 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git
On Sat, 2012-05-12 at 18:01:40 +0700, Nguyen Thai Ngoc Duy wrote:
> On Sat, May 12, 2012 at 5:43 PM, Ulrich Spoerlein <uspoerlein@gmail.com> wrote:
> > IIUC refs/notes/commits points to the latest note, which points to HEAD.
> > However, there's no reference that points to the note pointing to
> > HEAD^1, so how will it not be garbage collected?
>
> No. refs/notes/commits points to a commit, whose tree contains all
> notes at the last time a note is changed. This commit has a parent
> commit that stores note snapshot of the previous change and so on..
>
> refs/notes/commits is an ordinary ref, which is searched for
> reachability at gc time, so all notes (even replaced notes) cannot be
> deleted.
Cool, I believe this is then a bug with how svn2git works when it's
being restarted to do incremental conversions and have contacted the
author of that code.
> > How can it be pushed to a remote repository?
>
> What I wrote about were my findings while I studied the notes code.
> I'm new to it too. And I believe there's no mechanism to transfer
> notes. Of course you can transfer resfs/notes/commits like any other
> refs, but the objects those notes are attached to might or might not
> exist at destination repo.
Pushing them to github works fine like this:
[remote "github"]
url = github.com:freebsd/freebsd.git
push = +refs/heads/master:refs/heads/master
push = +refs/heads/release/*:refs/heads/release/*
push = +refs/heads/releng/*:refs/heads/releng/*
push = +refs/heads/stable/*:refs/heads/stable/*
push = +refs/notes/*:refs/notes/*
And you will see them displayed in their web UI (at the bottom):
https://github.com/freebsd/freebsd/commit/4bef84bb40695b68a4ccdcec5f847b5a7a302864
But older commits are missing this, most likely because the notes were
clobbered before I pushed them, e.g.
https://github.com/freebsd/freebsd/commit/1e7688b79181301805cd4616daa42ae827d74e99#README
> > I understand that notes cannot point to older notes, as that would make
> > removing/adding notes from/to older commits quite a hassle.
> >
> > So, what am I doing wrong here? How can I avoid notes from disappearing
> > so that each and every one of it remains in the repo?
> --
> Duy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-notes, how do they work?
2012-05-12 11:01 ` Nguyen Thai Ngoc Duy
2012-05-12 11:27 ` Ulrich Spoerlein
@ 2012-05-12 11:41 ` Angus Hammond
1 sibling, 0 replies; 4+ messages in thread
From: Angus Hammond @ 2012-05-12 11:41 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Ulrich Spoerlein, git
> What I wrote about were my findings while I studied the notes code.
> I'm new to it too. And I believe there's no mechanism to transfer
> notes. Of course you can transfer resfs/notes/commits like any other
> refs, but the objects those notes are attached to might or might not
> exist at destination repo.
If anyone's interested Scott's written a bit about the problems with
using notes with remote repositories here:
http://git-scm.com/2010/08/25/notes.html . Having said that the post
is almost 2 years old and I have no idea about how notes work in git
myself so I don't know if it's still completely accurate.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-12 11:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-12 10:43 git-notes, how do they work? Ulrich Spoerlein
2012-05-12 11:01 ` Nguyen Thai Ngoc Duy
2012-05-12 11:27 ` Ulrich Spoerlein
2012-05-12 11:41 ` Angus Hammond
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).