> From: George Georgiev <george.georgiev...@gmail.com>
> > The problem is that adding a commit to the *beginning* of the chain
> > requires a bit of work, because you have to recreate all of the later
> > commits so they reference the first commit.
> Are you certain about this. At first pass reading through the git
> shallow.c code I am having the feeling that I will be able to avoid
> this with creating the objects with a shallow flag. Then when I need
> to add a parent I could just attach the parent and unregistered the
> object as shallow without a need to recreate it. (exactly as it
> seems --unshallow works)
I'm not familiar with "shallow", but as I understand it, it fetches
only the latest commits from a repository and inserts them into a new
repository. Thus, the oldest commit in the chain has a "dangling
pointer" to its parent.
The difference between that and the situation you describe is that
adding a new commit to the beginning of the commit chain changes the
hashes of all the commits, because the information that does into the
hash function to get the commit name includes the hash of the parent
commit. "Shallow repositories" work because you already know the
proper hash for the latest commit. You even know the proper hash for
the first commit that you're fetching.
But if you want to add a parent to the current root commit, that
changes the information in the current root commit, which changes its
hash. And in the *next* commit, you have to update the parent
pointer, which changes *its* hash, etc.
But it's not tremendously difficult to recreate a chain of commits.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.