Skip to contentSkip to conversation

Help requested - trying to build a tool doing whole-tree commits

DISCUSSION Unknown 5 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Unknown

author
#0 lore raw

(Apologies if this arrives twice. I'm on the road, with somewhat flaky email.)

Because of my work on reposurgeon, I am sometimes asked to produce git repositories for very old projects that not only are still using CVS but have ancient releases not in the CVS repository, preserved only as tarballs. I have such a request currently pending from the robotfindskitten project.

To automate this process, I am trying to write a tool that will take a sequence of file trees and synthetic change comments in one end and emit a git repository composing them into a DAG out the other. The working name for this tool is 'gitpacker'.

I've already written the unpacking operation (git repo to tree sequence plus log). This morning I discovered that git-commit won't do quite what I need for the packing operation. I'm requesting help.

I need a command or command sequence that will commit an entire file tree to a repository...

(a) Allowing me to specify committer and author metadata, and

(b) deleting paths not present in the previous commit on the current branch, and

(c) allowing me to specify merge links from other previous commits.

git commit -a passes (a) and (b) but not (c).

Advice on how to accomplish this is requested

Advice on a better name for the tool is also requested, as I'm not happy with the way my use of 'pack' collides with existing git use of the same verb.

Signature · 6 lines
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

.. a government and its agents are under no general duty to 
provide public services, such as police protection, to any 
particular individual citizen...
        -- Warren v. District of Columbia, 444 A.2d 1 (D.C. App.181)
#1 lore raw
Quoted 6 lines · Unknown

(Apologies if this arrives twice. I'm on the road, with somewhat flaky email.)

Because of my work on reposurgeon, I am sometimes asked to produce git repositories for very old projects that not only are still using CVS but have ancient releases not in the CVS repository, preserved only as tarballs.

Perhaps not exactly what you are looking for, but don't we have import-tar somewhere in contrib/fast-import hierarchy (sorry, not on a machine yet, and I cannot give more details).

#3 lore raw
In reply to Unknown
Quoted 11 lines · Unknown

I need a command or command sequence that will commit an entire file tree to a repository...

(a) Allowing me to specify committer and author metadata, and

(b) deleting paths not present in the previous commit on the current branch, and

(c) allowing me to specify merge links from other previous commits.

git commit -a passes (a) and (b) but not (c).

git commit -a won't add new files, so you probably want to use git add -A && git commit. I'm not quite sure what you mean with "merge links", but if you want to create merge commits the you'll need to resort to
plumbing: git add -A && git write-tree && git commit-tree && git update-ref.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw
Quoted 1 line · Andreas Schwab

Unknown <[email protected]> writes:

Unknown Invalid? Please don't change the original email, makes it harder for other people to reply.

Quoted 10 lines
Quoted 10 lines

I need a command or command sequence that will commit an entire file tree to a repository...

(a) Allowing me to specify committer and author metadata, and

(b) deleting paths not present in the previous commit on the current branch, and

(c) allowing me to specify merge links from other previous commits.

Quoted 7 lines
Quoted 1 line

git commit -a passes (a) and (b) but not (c).

git commit -a won't add new files, so you probably want to use git add -A && git commit. I'm not quite sure what you mean with "merge links", but if you want to create merge commits the you'll need to resort to
plumbing: git add -A && git write-tree && git commit-tree && git update-ref.

I've done something similar, except that I used git hash-object instead of git commit-tree so that I can specify every single detail about the commit object.

Cheers.

Signature · 1 line
Felipe Contreras
#2 lore raw
In reply to Junio C Hamano

Junio C Hamano <[email protected]>:

Quoted 3 lines

Perhaps not exactly what you are looking for, but don't we have import-tar somewhere in contrib/fast-import hierarchy (sorry, not on a machine yet, and I cannot give more details).

If I recall correctly, that can only be used for original import.

I think Andreas Schwab's suggestion (git add -A && git write-tree && git commit-tree && git update-ref) is probably the right thing. I'm going to try that.

Signature · 1 line
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>