* integrity of a repository
@ 2008-03-15 13:26 Ralf Wildenhues
2008-03-16 3:54 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Wildenhues @ 2008-03-15 13:26 UTC (permalink / raw)
To: git
Hello giters,
I am aware that git provides integrity of a commit (and thus, a branch
head) via its sha, which covers both the tree and its history.
But what about the integrity of a git repository as a whole?
For example, if I have a set of branches, create a file listing
branchname sha-of-head
for each such branch, and hash that file, and also 'git gc --prune',
can I then be sure that not only does the repository contain exactly
what I want (namely all history of all branches), but also that it does
not contain any other material (say, stuff that may not be disclosed)?
Would I need the in file listing all local and remote branches?
What about all heads in .git/*HEAD (such as FETCH_HEAD)?
Thanks,
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: integrity of a repository
2008-03-15 13:26 integrity of a repository Ralf Wildenhues
@ 2008-03-16 3:54 ` Junio C Hamano
2008-03-16 6:32 ` Ralf Wildenhues
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-03-16 3:54 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: git
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> I am aware that git provides integrity of a commit (and thus, a branch
> head) via its sha, which covers both the tree and its history.
>
> But what about the integrity of a git repository as a whole?
>
> For example, if I have a set of branches, create a file listing
> branchname sha-of-head
>
> for each such branch, and hash that file, and also 'git gc --prune',
> can I then be sure that not only does the repository contain exactly
> what I want (namely all history of all branches), but also that it does
> not contain any other material (say, stuff that may not be disclosed)?
>
> Would I need the in file listing all local and remote branches?
> What about all heads in .git/*HEAD (such as FETCH_HEAD)?
That's an incoherent question ;-) First you talk about snapshotting all
the refs, as if you would want to make sure you can detect anybody moving
the tips of branches after that happens, but then you talk about something
completely unrelated.
A freestanding git repository with a work tree consists of a set of refs
(that includes your local branches in refs/heads, tags in refs/tags, and
remote tracking branches refs/remotes but not limited to these three
categories. Anything under refs/ is a ref by definition, and it includes
the stash), reflogs, the index, HEAD (which is typically a pointer into
refs/heads/ somewhere but can directly be pointing at a commit), and an
object store. An object store of a repository that is not corrupt
contains all objects that are reachable from refs, reflogs, the index and
the HEAD, and "gc --prune" will remove everything else.
So the answer to the question in your later part of the message is that:
- FETCH_HEAD, ORIG_HEAD and MERGE_HEAD do not protect anything from
getting pruned;
- Objects that are not reachable from the tip of branches will remain in
the object store after pruning, if they are reachable from non-branch
refs (e.g. tags and the stash), reflogs, or the index.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: integrity of a repository
2008-03-16 3:54 ` Junio C Hamano
@ 2008-03-16 6:32 ` Ralf Wildenhues
2008-03-16 7:01 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Wildenhues @ 2008-03-16 6:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hello Junio,
* Junio C Hamano wrote on Sun, Mar 16, 2008 at 04:54:51AM CET:
> Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
>
> > I am aware that git provides integrity of a commit (and thus, a branch
> > head) via its sha, which covers both the tree and its history.
> >
> > But what about the integrity of a git repository as a whole?
[...]
> > Would I need the in file listing all local and remote branches?
> > What about all heads in .git/*HEAD (such as FETCH_HEAD)?
>
> That's an incoherent question ;-) First you talk about snapshotting all
> the refs, as if you would want to make sure you can detect anybody moving
> the tips of branches after that happens, but then you talk about something
> completely unrelated.
Well, maybe they are two different parts of the larger question how one
can fully characterize the state of a repository.
> So the answer to the question in your later part of the message is that:
>
> - FETCH_HEAD, ORIG_HEAD and MERGE_HEAD do not protect anything from
> getting pruned;
>
> - Objects that are not reachable from the tip of branches will remain in
> the object store after pruning, if they are reachable from non-branch
> refs (e.g. tags and the stash), reflogs, or the index.
OK. Now, is there a way to quickly ensure that a repository is in a
pruned state, short of running 'git gc --prune'?
Thanks,
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: integrity of a repository
2008-03-16 6:32 ` Ralf Wildenhues
@ 2008-03-16 7:01 ` Junio C Hamano
2008-03-16 10:09 ` Ralf Wildenhues
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-03-16 7:01 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: git
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
> OK. Now, is there a way to quickly ensure that a repository is in a
> pruned state, short of running 'git gc --prune'?
"git fsck --full"?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: integrity of a repository
2008-03-16 7:01 ` Junio C Hamano
@ 2008-03-16 10:09 ` Ralf Wildenhues
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Wildenhues @ 2008-03-16 10:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
* Junio C Hamano wrote on Sun, Mar 16, 2008 at 08:01:38AM CET:
> Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
>
> > OK. Now, is there a way to quickly ensure that a repository is in a
> > pruned state, short of running 'git gc --prune'?
>
> "git fsck --full"?
Ahh, good. Thanks!
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-16 10:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-15 13:26 integrity of a repository Ralf Wildenhues
2008-03-16 3:54 ` Junio C Hamano
2008-03-16 6:32 ` Ralf Wildenhues
2008-03-16 7:01 ` Junio C Hamano
2008-03-16 10:09 ` Ralf Wildenhues
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).