Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import foreign commit prefixed instead of transplanting the tree #10

Closed
wants to merge 1 commit into from

Conversation

kentfredric
Copy link
Collaborator

verbatim

This will help avoid problems with rebase.

NOTE: the .gitrepo file is still added at the merge stage, and that
file will be lost in subsequent rebases/merges.

Also, the equivalent code for pull is not in place yet.

It relies on knowledge of the internal format specification for the raw
tree blob object ( what you get if you do git cat-file tree <TREESHA> )
and writes one by hand with a bit of ninja tricks from perl's pack
function.

This is because silly git, unlike everywhere else in git, stores SHA1s
in TREE blobs in binary encoding instead of in Hex. :(

Tree Blob format is

  TYPE SPACE FILENAME NULL BINARYSHA1

Where TYPE is 040000 for directories/trees.

Signed-off-by: Kent Fredric kentfredric@gmail.com

verbatim

This will help avoid problems with rebase.

NOTE: the '.gitrepo' file is still added at the merge stage, and _that_
file will be lost in subsequent rebases/merges.

Also, the equivalent code for 'pull' is not in place yet.

It relies on knowledge of the internal format specification for the raw
tree blob object ( what you get if you do `git cat-file tree <TREESHA>` )
and writes one by hand with a bit of ninja tricks from `perl`'s `pack`
function.

This is because silly git, unlike everywhere else in git, stores SHA1s
in TREE blobs in *binary encoding* instead of in Hex. :(

Tree Blob format is

  TYPE SPACE FILENAME NULL BINARYSHA1

Where `TYPE` is 040000 for directories/trees.

Signed-off-by: Kent Fredric <kentfredric@gmail.com>
@kentfredric
Copy link
Collaborator Author

I'm not entirely sure you'd want to stuff the .gitrepo file in the parent2 commit either, its doable, but a little bit of legwork, and it would require more code to remove.

Oh, and "Former" would be impossible if it was in that commit, because it would have to refer to itself.

@kentfredric
Copy link
Collaborator Author

@ingydotnet
Copy link
Owner

I rewrote the clone command to fetch the remote, checkout the content into the subdir as a WORK TREE, add the .gitrepo file and then do it all as one commit. I changed former to parent, as it now points to the mainline HEAD commit before the clone.

I also made the commit message look better (I hope) so the history is hopefully very nice.

@ingydotnet ingydotnet closed this Mar 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants