{"thread":{"id":"1166","subject":"patches to support working without the object database","startedAt":"2005-07-08T10:37:24Z","lastAt":"2005-07-08T20:09:45Z","messageCount":4,"participants":["Bryan Larsen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"5816","messageId":"42CE5764.9010405@gmail.com","threadId":"1166","inReplyTo":null,"subject":"patches to support working without the object database","fromName":"Bryan Larsen","fromEmail":"bryan.larsen@gmail.com","sentAt":"2005-07-08T10:37:24Z","receivedAt":"2005-07-08T10:37:24Z","isPatch":false,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"Sometimes you may wish to keep an audit trail of what changed, where, \nand by whom.  You do not need to know the exact details of the change, \nand the files are so large that keeping an extra copy of the data in the \nobject database cache is prohibitively expensive.\n\nGit is (almost) ideally suited for this.  There's very little out there \nthat is faster than git-diff-cache.\n\nThe design of git also facilitates this.  git-update-cache --cacheinfo \nallows the index to be updated without an object in the database, and \noperations can then be performed around the index.  However, there are \nsome things that are inconvenient and one show stopper.\n\nI will separately mail a series of patches.  The first will address the \nshow stopper, the rest the inconveniences.  Once applied, cg-init, \ncg-commit and cg-add will all take the \"-N\" option to update the index \nwithout moving the objects into the database.  Operations that don't \nrequire the database such as cg-status and cg-log -f work fine and are \nvery useful.\n\nI don't expect the patches to be accepted as is.  One was designed to be \nminimally intrusive, but I suspect that there is a better way to do it: \nsuggestions are welcome.  The controversial one switches \ngit-update-cache --refresh to rely on the SHA1 being unique rather than \ndoing a byte comparison against the (possibly missing) object database. \n  It could be made an option, but I think that's ugly.\n\nAll patches are against cogito-0.12.\n\ncheers,\nBryan\n"},{"id":"5830","messageId":"7vwto16t6h.fsf@assigned-by-dhcp.cox.net","threadId":"1166","inReplyTo":"42CE5764.9010405@gmail.com","subject":"Re: patches to support working without the object database","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-08T18:36:54Z","receivedAt":"2005-07-08T18:36:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"BL\" == Bryan Larsen <bryan.larsen@gmail.com> writes:\n\nBL> Sometimes you may wish to keep an audit trail of what changed, where,\nBL> and by whom.  You do not need to know the exact details of the change,\nBL> and the files are so large that keeping an extra copy of the data in\nBL> the object database cache is prohibitively expensive.\n\nI am basically OK with this patch series, except I have one\nminor problem about interface detail, and more seriously, that\nthe patch is whitespace mangled and would not apply.  E.g.\n\ndiff --git a/cache.h b/cache.h\n--- a/cache.h\n+++ b/cache.h\n@@ -139,7 +139,7 @@ extern int remove_cache_entry_at(int pos\n  extern int remove_file_from_cache(char *path);\n  extern int ce_same_name(struct cache_entry *a, struct cache_entry *b);\n  extern int ce_match_stat(struct cache_entry *ce, struct stat *st);\n-extern int index_fd(unsigned char *sha1, int fd, struct stat *st);\n+extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int \ninfo_only);\n\nNotice the \"info_only\" folded, and other unchanged lines\nindented by two spaces instead of one?\n\nPlease retry.  I especially like what [PATCH 4/7] does and do\nnot want to see this patch go to dustbin due to technicalities.\n\nAlso please make sure that core GIT part patch applies against\nLinus tip (especially [PATCH 2/7]) as well. I think it does, but\nplease double check.\n\nI would also suggest adding the same --info-only logic to\nwrite-blob (perhaps give it a short and sweet name like \"-n\"),\nin order to get the hash information out of it without actually\nregistering the blob.\n\nThis would make things more useful in general.  One immediate\nbenefit of it is that we would have a standalone checksum\nprogram we can reuse, by just saying \"write-blob -n\".  Once you\nhave it, you _could_ even drop --info-only from git-update-cache\nand use normal --cacheinfo instead.\n\nWhile you are at it, you might also want to add an option to\nwrite-blob to specify the type of the object you are hashing, so\nthat would make [*1*]:\n\n    git-write-blob [-n] [-t <type>] <file>...\n\nOne way to do this would be to add \"const char *type\" argument\nto index_fd(), which is usually \"blob\" in the traditional use.\nThen, the change to index_fd() would become:\n\n-\tret = write_sha1_file(buf, size, \"blob\", sha1);\n+\tif (info_only) {\n+\t\t(void) write_sha1_file_prepare(buf, size, type, sha1, hdr, &hdrlen);\n+\t\tret = 0;\n+\t} else ret = write_sha1_file(buf, size, type, sha1);\n\nBut first let's get the whitespace mangling fixed up ;-).\n\n[Footnote]\n\n*1* I considered this instead:\n\n    git-write-blob [-n | -t <type>] <file>...\n\nwhich means that if you specify type then -n is implied.  But\nmaking -t independent would let you have inverse of\ngit-cat-file; a silly example:\n\n    $ git-cat-file -t $FOO\n    tree\n    $ git-cat-file tree $FOO >tmp1\n    $ FOO1=$(git-write-blob -t tree tmp1)\n\nIf we go this route, we may also want to rename it to\nwrite-object, but I would want to have it as a separate patch\nafter this series settles down.\n"},{"id":"5839","messageId":"7vpstt6qi7.fsf@assigned-by-dhcp.cox.net","threadId":"1166","inReplyTo":"7vwto16t6h.fsf@assigned-by-dhcp.cox.net","subject":"Re: patches to support working without the object database","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-08T19:34:40Z","receivedAt":"2005-07-08T19:34:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Replying to myself...\n\nJCH> While you are at it, you might also want to add an option to\nJCH> write-blob to specify the type of the object you are hashing, so\nJCH> that would make [*1*]:\n\nJCH>     git-write-blob [-n] [-t <type>] <file>...\n\nJCH> [Footnote]\n\nJCH> *1* I considered this instead:\n\nJCH>     git-write-blob [-n | -t <type>] <file>...\n\nJCH> which means that if you specify type then -n is implied.  But\nJCH> making -t independent would let you have inverse of\nJCH> git-cat-file; a silly example:\n\nJCH>     $ git-cat-file -t $FOO\nJCH>     tree\nJCH>     $ git-cat-file tree $FOO >tmp1\nJCH>     $ FOO1=$(git-write-blob -t tree tmp1)\n\nJCH> If we go this route, we may also want to rename it to\nJCH> write-object, but I would want to have it as a separate patch\nJCH> after this series settles down.\n\nCome to think of it, there is only one in-tree user of\nwrite-blob remaining.  Renaming it to hash-object, changing the\ndefault behaviour to just hash without storing and instead give\nit --write (or just -w) flag would make more sense.  Without -t,\nthe type should default to \"blob\".\n\nThen, the above stupid example would then become:\n\n    $ git-cat-file -t $FOO\n    tree\n    $ git-cat-file tree $FOO >tmp1\n    $ FOO1=$(git-hash-object -t tree tmp1)\n\nAnd the only in-tree user git-cvsimport-script would be changed to:\n\n--- a/git-cvsimport-script\n+++ b/git-cvsimport-script\n@@ -683,7 +683,7 @@ while(<CVS>) {\n \t\t$fn =~ s#^/+##;\n \t\tmy ($tmpname, $size) = $cvs->file($fn,$rev);\n \t\tprint \"\".($init ? \"New\" : \"Update\").\" $fn: $size bytes.\\n\" if $opt_v;\n-\t\topen my $F, '-|', \"git-write-blob $tmpname\"\n+\t\topen my $F, '-|', \"git-hash-object -w $tmpname\"\n \t\t\tor die \"Cannot create object: $!\\n\";\n \t\tmy $sha = <$F>;\n \t\tchomp $sha;\n"},{"id":"5834","messageId":"42CEDD89.6010200@gmail.com","threadId":"1166","inReplyTo":"7vwto16t6h.fsf@assigned-by-dhcp.cox.net","subject":"Re: patches to support working without the object database","fromName":"Bryan Larsen","fromEmail":"bryan.larsen@gmail.com","sentAt":"2005-07-08T20:09:45Z","receivedAt":"2005-07-08T20:09:45Z","isPatch":false,"sender":{"key":"bryan@larsen.st","avatar":"https://avatars.githubusercontent.com/u/32073?v=4"},"body":"Junio C Hamano wrote:\n>>>>>>\"BL\" == Bryan Larsen <bryan.larsen@gmail.com> writes:\n> \n> \n> BL> Sometimes you may wish to keep an audit trail of what changed, where,\n> BL> and by whom.  You do not need to know the exact details of the change,\n> BL> and the files are so large that keeping an extra copy of the data in\n> BL> the object database cache is prohibitively expensive.\n> \n> I am basically OK with this patch series, except I have one\n> minor problem about interface detail, and more seriously, that\n> the patch is whitespace mangled and would not apply.  E.g.\n >\n* SNIP *\n> \n> Also please make sure that core GIT part patch applies against\n> Linus tip (especially [PATCH 2/7]) as well. I think it does, but\n> please double check.\n> \n> \nI had trouble getting tip.  That may be because I'm on OS X: I want to \ntry it on\na Linux box to narrow down the source of my problems.  Given that it's \ncurrently\n4PM on Friday, I don't think the IT staff is going to fix the firewall \nbefore Monday.\nSo please excuse me while I scrounge up another Linux box or two.\n\nAfter that happens, I'll fix up my patches as suggested by you and \nLinus, get\nmyself a real mailer and resubmit.\n\nthanks,\nBryan\n"}]}