{"thread":{"id":"32050","subject":"Help requested - trying to build a tool doing whole-tree commits","startedAt":"2012-11-09T18:20:24Z","lastAt":"2012-11-11T14:47:22Z","messageCount":5,"participants":["Unknown","Andreas Schwab","Junio C Hamano","Felipe Contreras","Eric S. Raymond"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202725","messageId":"20121109182024.81074BC66D4@golux","threadId":"32050","inReplyTo":null,"subject":"Help requested - trying to build a tool doing whole-tree commits","fromName":"Unknown","fromEmail":"unknown@unknown.invalid","sentAt":"2012-11-09T18:20:24Z","receivedAt":"2012-11-09T18:20:24Z","isPatch":false,"sender":{"key":"unknown@unknown.invalid","avatar":null},"body":"(Apologies if this arrives twice. I'm on the road, with somewhat flaky email.)\n\nBecause of my work on reposurgeon, I am sometimes asked to produce git\nrepositories for very old projects that not only are still using CVS\nbut have ancient releases not in the CVS repository, preserved only\nas tarballs.  I have such a request currently pending from the\nrobotfindskitten project.\n\nTo automate this process, I am trying to write a tool that will take a\nsequence of file trees and synthetic change comments in one end and\nemit a git repository composing them into a DAG out the other. The\nworking name for this tool is 'gitpacker'.\n\nI've already written the unpacking operation (git repo to tree\nsequence plus log). This morning I discovered that git-commit\nwon't do quite what I need for the packing operation.\nI'm requesting help.\n\nI need a command or command sequence that will commit an entire file\ntree to a repository...\n\n(a) Allowing me to specify committer and author metadata, and\n\n(b) deleting paths not present in the previous commit on the current\nbranch, and\n\n(c) allowing me to specify merge links from other previous commits.\n\ngit commit -a passes (a) and (b) but not (c).\n\nAdvice on how to accomplish this is requested\n\nAdvice on a better name for the tool is also requested, as I'm\nnot happy with the way my use of 'pack' collides with existing\ngit use of the same verb.\n-- \n\t\t<a href=\"http://www.catb.org/~esr/\">Eric S. Raymond</a>\n\n.. a government and its agents are under no general duty to \nprovide public services, such as police protection, to any \nparticular individual citizen...\n        -- Warren v. District of Columbia, 444 A.2d 1 (D.C. App.181)\n"},{"id":"202727","messageId":"m2txsyqwdi.fsf@igel.home","threadId":"32050","inReplyTo":"20121109182024.81074BC66D4@golux","subject":"Re: Help requested - trying to build a tool doing whole-tree commits","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-11-09T21:50:17Z","receivedAt":"2012-11-09T21:50:17Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Unknown <unknown@unknown.invalid> writes:\n\n> I need a command or command sequence that will commit an entire file\n> tree to a repository...\n>\n> (a) Allowing me to specify committer and author metadata, and\n>\n> (b) deleting paths not present in the previous commit on the current\n> branch, and\n>\n> (c) allowing me to specify merge links from other previous commits.\n>\n> git commit -a passes (a) and (b) but not (c).\n\ngit commit -a won't add new files, so you probably want to use git add\n-A && git commit.  I'm not quite sure what you mean with \"merge links\",\nbut if you want to create merge commits the you'll need to resort to\nplumbing: git add -A && git write-tree && git commit-tree && git\nupdate-ref.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"202760","messageId":"7vlie9pf96.fsf@alter.siamese.dyndns.org","threadId":"32050","inReplyTo":"20121109182024.81074BC66D4@golux","subject":"Re: Help requested - trying to build a tool doing whole-tree commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-10T16:57:41Z","receivedAt":"2012-11-10T16:57:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Unknown <unknown@unknown.invalid> writes:\n\n> (Apologies if this arrives twice. I'm on the road, with somewhat flaky email.)\n>\n> Because of my work on reposurgeon, I am sometimes asked to produce git\n> repositories for very old projects that not only are still using CVS\n> but have ancient releases not in the CVS repository, preserved only\n> as tarballs.\n\nPerhaps not exactly what you are looking for, but don't we have\nimport-tar somewhere in contrib/fast-import hierarchy (sorry, not on\na machine yet, and I cannot give more details).\n"},{"id":"202776","messageId":"CAMP44s2NzPw+GYKk5s7UUo8uRWob=K9nedcB+xP85rcyM5WPrQ@mail.gmail.com","threadId":"32050","inReplyTo":"m2txsyqwdi.fsf@igel.home","subject":"Re: Help requested - trying to build a tool doing whole-tree commits","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2012-11-10T19:24:33Z","receivedAt":"2012-11-10T19:24:33Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Fri, Nov 9, 2012 at 10:50 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Unknown <unknown@unknown.invalid> writes:\n\nUnknown Invalid? Please don't change the original email, makes it\nharder for other people to reply.\n\n>> I need a command or command sequence that will commit an entire file\n>> tree to a repository...\n>>\n>> (a) Allowing me to specify committer and author metadata, and\n>>\n>> (b) deleting paths not present in the previous commit on the current\n>> branch, and\n>>\n>> (c) allowing me to specify merge links from other previous commits.\n>>\n>> git commit -a passes (a) and (b) but not (c).\n>\n> git commit -a won't add new files, so you probably want to use git add\n> -A && git commit.  I'm not quite sure what you mean with \"merge links\",\n> but if you want to create merge commits the you'll need to resort to\n> plumbing: git add -A && git write-tree && git commit-tree && git\n> update-ref.\n\nI've done something similar, except that I used git hash-object\ninstead of git commit-tree so that I can specify every single detail\nabout the commit object.\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"202866","messageId":"20121111144722.GA3593@thyrsus.com","threadId":"32050","inReplyTo":"7vlie9pf96.fsf@alter.siamese.dyndns.org","subject":"Re: Help requested - trying to build a tool doing whole-tree commits","fromName":"Eric S. Raymond","fromEmail":"esr@thyrsus.com","sentAt":"2012-11-11T14:47:22Z","receivedAt":"2012-11-11T14:47:22Z","isPatch":false,"sender":{"key":"esr@thyrsus.com","avatar":"https://avatars.githubusercontent.com/u/727961?v=4"},"body":"Junio C Hamano <gitster@pobox.com>:\n> Perhaps not exactly what you are looking for, but don't we have\n> import-tar somewhere in contrib/fast-import hierarchy (sorry, not on\n> a machine yet, and I cannot give more details).\n\nIf I recall correctly, that can only be used for original import.\n\nI think Andreas Schwab's suggestion (git add -A && git write-tree &&\ngit commit-tree && git update-ref) is probably the right thing. I'm\ngoing to try that.\n-- \n\t\t<a href=\"http://www.catb.org/~esr/\">Eric S. Raymond</a>\n"}]}