RFE: git relink
It would be nice if somebody were motivated enough to create a command that functions like:
git relink repoA repoB repoC repoD... repoX
which would examine
repoA/.git
repoB/.git
repoC/.git
repoD/.git
and verify (updating, if necessary) that each of the A/B/C/D repos are hardlinked to repoX.
Jeff
Quoted 8 lines · Jeff Garzik
It would be nice if somebody were motivated enough to create a command that functions like:
git relink repoA repoB repoC repoD... repoX
which would examine
Quoted 7 lines
repoA/.git
repoB/.git
repoC/.git
repoD/.gitand verify (updating, if necessary) that each of the A/B/C/D repos are hardlinked to repoX.
Submitted a while ago, dunno what happened with it. This only does 2 repositories, but it's trivial to do
for i in repoA repoB repoC repoD ; do git-relink-script "$i" repoX ; done
Provide a tool to relink two git repositories.
---
commit a3bcc763d71bdb91a3b48e9105fbaa5e79abb807
tree 2553e2d8befbe0cda3e413616fd4cc7bf04157ad
parent a31c6d022e2435a514fcc8ca57f9995c4376a986 author Ryan Anderson <ryan@mythryan2.(none)> 1115185675 -0400 committer Ryan Anderson <[email protected]> 1115185675 -0400
Makefile (mode:100644 sha1:a99665e252a2342caa84238e886a80a5f27ac3c8) renamed from Makefile (mode:100644 sha1:99b4753d34879842b972da9b68694c9d0485f216) +1 -1
@@ -13,7 +13,7 @@ AR=ar SCRIPTS=git-apply-patch-script git-merge-one-file-script git-prune-script \ - git-pull-script git-tag-script + git-pull-script git-tag-script git-relink-script PROG= git-update-cache git-diff-files git-init-db git-write-tree \ git-read-tree git-commit-tree git-cat-file git-fsck-cache \
git-relink-script (mode:100644 sha1:78c954edcc370d8be951c856bfbfd38975d08348) renamed from dev/null (tree:51a882a2dc62e0d3cdc79e0badc61559fb723481) +115 -0
115 lines not on this page · raw message
Signature · 2 lines
Ryan Anderson sometimes Pug Majere
Quoted 14 lines · Ryan Anderson
Quoted 13 lines · Jeff Garzik
It would be nice if somebody were motivated enough to create a command that functions like:
git relink repoA repoB repoC repoD... repoX
which would examine
repoA/.git
repoB/.git
repoC/.git
repoD/.git
Quoted 6 lines
Quoted 2 lines
and verify (updating, if necessary) that each of the A/B/C/D repos are hardlinked to repoX.
Submitted a while ago, dunno what happened with it. This only does 2 repositories, but it's trivial to do
for i in repoA repoB repoC repoD ; do git-relink-script "$i" repoX ; done
And of course, I didn't actually look at my code, what my code really wants is:
for i in repoA repoB repoC repoD ; do git-relink-script repoX "$i" ; done
It should be relatively trivial to convert it over to the other behavior if it matters.
Signature · 2 lines
Ryan Anderson sometimes Pug Majere
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"JG" == Jeff Garzik <[email protected]> writes:
JG> It would be nice if somebody were motivated enough to create a command JG> that functions like:
JG> git relink repoA repoB repoC repoD... repoX
JG> which would examine
JG> repoA/.git
JG> repoB/.git
JG> repoC/.git
JG> repoD/.git
JG> and verify (updating, if necessary) that each of the A/B/C/D repos are JG> hardlinked to repoX.
Whoever is doing this script needs to be a bit careful.
If you end up unlinking a full object and hard-linking a deltified object representation (delta) in its place, the repository can get corrupted, because it might not have the necessary base object for the delta.
There are two strategies to solve this. Either (1) the relinker refuses to replace a full object with a delta, or (2) the relinker notices a delta, and makes an additional hard link to the base object when replacing a full object with a delta (this needs to be done recursively until you hit a full base object).
(1) is simpler and cleaner, but does not get full advantage of the delta compression. (2) gives you delta compression but it will add possibly "unwanted" objects to a repository that happens to slurp in a delta (fsck would not complain, though).
My knee-jerk vote goes to (1), but in either case the relinker needs to check if it is dealing with a delta; this cannot be done with git-cat-file -t AFAIK.
Ryan Anderson code will notice delta vs full object case most of the time because it checks and makes sure the sizes of corresponding files from two repositories match. The problem with the code is that it dies, instead of just ignoring, when size differs. Dying is good for ordinary case (two full object representations of the same file should not have different sizes), but it is not the right thing to do when it sees one side using the full object representation and the other side using a delta.