{"thread":{"id":"12707","subject":"integrity of a repository","startedAt":"2008-03-15T13:26:45Z","lastAt":"2008-03-16T10:09:52Z","messageCount":5,"participants":["Ralf Wildenhues","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72185","messageId":"20080315132645.GC17579@ins.uni-bonn.de","threadId":"12707","inReplyTo":null,"subject":"integrity of a repository","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2008-03-15T13:26:45Z","receivedAt":"2008-03-15T13:26:45Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"Hello giters,\n\nI am aware that git provides integrity of a commit (and thus, a branch\nhead) via its sha, which covers both the tree and its history.\n\nBut what about the integrity of a git repository as a whole?\n\nFor example, if I have a set of branches, create a file listing\n  branchname  sha-of-head\n\nfor each such branch, and hash that file, and also 'git gc --prune',\ncan I then be sure that not only does the repository contain exactly\nwhat I want (namely all history of all branches), but also that it does\nnot contain any other material (say, stuff that may not be disclosed)?\n\nWould I need the in file listing all local and remote branches?\nWhat about all heads in .git/*HEAD (such as FETCH_HEAD)?\n\nThanks,\nRalf\n"},{"id":"72201","messageId":"7v4pb7migk.fsf@gitster.siamese.dyndns.org","threadId":"12707","inReplyTo":"20080315132645.GC17579@ins.uni-bonn.de","subject":"Re: integrity of a repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-16T03:54:51Z","receivedAt":"2008-03-16T03:54:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:\n\n> I am aware that git provides integrity of a commit (and thus, a branch\n> head) via its sha, which covers both the tree and its history.\n>\n> But what about the integrity of a git repository as a whole?\n>\n> For example, if I have a set of branches, create a file listing\n>   branchname  sha-of-head\n>\n> for each such branch, and hash that file, and also 'git gc --prune',\n> can I then be sure that not only does the repository contain exactly\n> what I want (namely all history of all branches), but also that it does\n> not contain any other material (say, stuff that may not be disclosed)?\n>\n> Would I need the in file listing all local and remote branches?\n> What about all heads in .git/*HEAD (such as FETCH_HEAD)?\n\nThat's an incoherent question ;-)  First you talk about snapshotting all\nthe refs, as if you would want to make sure you can detect anybody moving\nthe tips of branches after that happens, but then you talk about something\ncompletely unrelated.\n\nA freestanding git repository with a work tree consists of a set of refs\n(that includes your local branches in refs/heads, tags in refs/tags, and\nremote tracking branches refs/remotes but not limited to these three\ncategories.  Anything under refs/ is a ref by definition, and it includes\nthe stash), reflogs, the index, HEAD (which is typically a pointer into\nrefs/heads/ somewhere but can directly be pointing at a commit), and an\nobject store.  An object store of a repository that is not corrupt\ncontains all objects that are reachable from refs, reflogs, the index and\nthe HEAD, and \"gc --prune\" will remove everything else.\n\nSo the answer to the question in your later part of the message is that:\n\n - FETCH_HEAD, ORIG_HEAD and MERGE_HEAD do not protect anything from\n   getting pruned;\n\n - Objects that are not reachable from the tip of branches will remain in\n   the object store after pruning, if they are reachable from non-branch\n   refs (e.g. tags and the stash), reflogs, or the index.\n"},{"id":"72210","messageId":"20080316063215.GA6067@ins.uni-bonn.de","threadId":"12707","inReplyTo":"7v4pb7migk.fsf@gitster.siamese.dyndns.org","subject":"Re: integrity of a repository","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2008-03-16T06:32:15Z","receivedAt":"2008-03-16T06:32:15Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"Hello Junio,\n\n* Junio C Hamano wrote on Sun, Mar 16, 2008 at 04:54:51AM CET:\n> Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:\n> \n> > I am aware that git provides integrity of a commit (and thus, a branch\n> > head) via its sha, which covers both the tree and its history.\n> >\n> > But what about the integrity of a git repository as a whole?\n[...]\n> > Would I need the in file listing all local and remote branches?\n> > What about all heads in .git/*HEAD (such as FETCH_HEAD)?\n> \n> That's an incoherent question ;-)  First you talk about snapshotting all\n> the refs, as if you would want to make sure you can detect anybody moving\n> the tips of branches after that happens, but then you talk about something\n> completely unrelated.\n\nWell, maybe they are two different parts of the larger question how one\ncan fully characterize the state of a repository.\n\n> So the answer to the question in your later part of the message is that:\n> \n>  - FETCH_HEAD, ORIG_HEAD and MERGE_HEAD do not protect anything from\n>    getting pruned;\n> \n>  - Objects that are not reachable from the tip of branches will remain in\n>    the object store after pruning, if they are reachable from non-branch\n>    refs (e.g. tags and the stash), reflogs, or the index.\n\nOK.  Now, is there a way to quickly ensure that a repository is in a\npruned state, short of running 'git gc --prune'?\n\nThanks,\nRalf\n"},{"id":"72212","messageId":"7v8x0jkv8t.fsf@gitster.siamese.dyndns.org","threadId":"12707","inReplyTo":"20080316063215.GA6067@ins.uni-bonn.de","subject":"Re: integrity of a repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-16T07:01:38Z","receivedAt":"2008-03-16T07:01:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:\n\n> OK.  Now, is there a way to quickly ensure that a repository is in a\n> pruned state, short of running 'git gc --prune'?\n\n\"git fsck --full\"?\n"},{"id":"72213","messageId":"20080316100952.GC32394@ins.uni-bonn.de","threadId":"12707","inReplyTo":"7v8x0jkv8t.fsf@gitster.siamese.dyndns.org","subject":"Re: integrity of a repository","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2008-03-16T10:09:52Z","receivedAt":"2008-03-16T10:09:52Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"* Junio C Hamano wrote on Sun, Mar 16, 2008 at 08:01:38AM CET:\n> Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:\n> \n> > OK.  Now, is there a way to quickly ensure that a repository is in a\n> > pruned state, short of running 'git gc --prune'?\n> \n> \"git fsck --full\"?\n\nAhh, good.  Thanks!\nRalf\n"}]}