Messages in this thread Patch in this message | | | From | ross@lug ... | Date | Fri, 8 Apr 2005 03:17:20 -0400 | Subject | Re: Kernel SCM saga.. |
| |
On Thu, Apr 07, 2005 at 09:42:04PM -0700, Linus Torvalds wrote: > In the meantime (and because monotone really _is_ that slow), here's a > quick challenge for you, and any crazy hacker out there: if you want to > play with something _really_ nasty (but also very _very_ fast), take a > look at kernel.org:/pub/linux/kernel/people/torvalds/.
Interesting. I like it, with one modification (see below).
> First one to send me the changelog tree of sparse-git (and a tool to > commit and push/pull further changes) gets a gold star, and an honorable > mention. I've put a hell of a lot of clues in there (*).
Here's a partial solution. It does depend on a modified version of cat-file that behaves like cat. I found it easier to have cat-file just dump the object indicated on stdout. Trivial patch for that is included.
Two scripts are included:
1) makechlog.sh takes an object and generates a ChangeLog file consisting of all the parents of the given object. It's probably breakable, but correctly outputs the sparse-git changes when run on HEAD. Handles multiple parents and breaks cycles.
This adds a line to each object "me <sha1>". This lets a change identify itself.
It takes 35 seconds to produce all the change history on my box. It produces a single file named "ChangeLog".
2) chkchlog.sh uses the "me" entries to verify that #1 didn't miss any parents. It's mostly to prove my solution reasonably correct ::-)
The patch is below, the scripts are attached, and everything is available here:
http://lug.udel.edu/~ross/git/
Now to see what I come up with for commit, push, and pull...
-- Ross Vandegrift ross@lug.udel.edu
"The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell." --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37
--- cat-file.orig.c 2005-04-08 01:53:54.000000000 -0400 +++ cat-file.c 2005-04-08 01:57:51.000000000 -0400 @@ -11,18 +11,11 @@ char type[20]; void *buf; unsigned long size; - char template[] = "temp_git_file_XXXXXX"; - int fd; if (argc != 2 || get_sha1_hex(argv[1], sha1)) usage("cat-file: cat-file <sha1>"); buf = read_sha1_file(sha1, type, &size); if (!buf) exit(1); - fd = mkstemp(template); - if (fd < 0) - usage("unable to create tempfile"); - if (write(fd, buf, size) != size) - strcpy(type, "bad"); - printf("%s: %s\n", template, type); + printf ("%s", buf); } [unhandled content-type:application/x-sh][unhandled content-type:application/x-sh] | |