{"thread":{"id":"3345","subject":"Use case: GIT to manage transactions in a CMS?","startedAt":"2006-02-15T10:44:18Z","lastAt":"2006-02-17T11:44:29Z","messageCount":4,"participants":["J. David Ibáñez","Andreas Ericsson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16208","messageId":"43F30602.500@itaapy.com","threadId":"3345","inReplyTo":null,"subject":"Use case: GIT to manage transactions in a CMS?","fromName":"J. David Ibáñez","fromEmail":"jdavid@itaapy.com","sentAt":"2006-02-15T10:44:18Z","receivedAt":"2006-02-15T10:44:18Z","isPatch":false,"sender":{"key":"jdavid@itaapy.com","avatar":null},"body":"\nHello,\n\nI am working on a project (a content management system) where the data\nis stored as files and folders.\n\nCurrently, for persistance and transactions we use the ZODB [1] object\ndatabase. But our goal is to move away from the ZODB and use directly\nthe file system, as it will allow us to use all the good unix tools.\n\nWe are using git to manage the source code. And now we are exploring git\nto see if it can do the job of transactions, so that each transaction in\nthe system will be a git commit.\n\nOne problem we have found is that we can not commit empty directories (what\nwe need to do). Any idea how to solve or work-around this constraint?\n\nAny suggestions and input on this exotic use case for git will be very\nwelcomed.\n\n\n\n[1] http://www.zope.org/Wikis/ZODB/FrontPage\n\n-- \nJ. David Ibáñez\nItaapy <http://www.itaapy.com>         Tel +33 (0)1 42 23 67 45\n9 rue Darwin, 75018 Paris              Fax +33 (0)1 53 28 27 88 \n"},{"id":"16213","messageId":"43F31454.8060704@op5.se","threadId":"3345","inReplyTo":"43F30602.500@itaapy.com","subject":"Re: Use case: GIT to manage transactions in a CMS?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-02-15T11:45:24Z","receivedAt":"2006-02-15T11:45:24Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"J. David Ibáñez wrote:\n> Hello,\n> \n> I am working on a project (a content management system) where the data\n> is stored as files and folders.\n> \n> Currently, for persistance and transactions we use the ZODB [1] object\n> database. But our goal is to move away from the ZODB and use directly\n> the file system, as it will allow us to use all the good unix tools.\n> \n> We are using git to manage the source code. And now we are exploring git\n> to see if it can do the job of transactions, so that each transaction in\n> the system will be a git commit.\n> \n> One problem we have found is that we can not commit empty directories (what\n> we need to do). Any idea how to solve or work-around this constraint?\n> \n\n$ touch empty/dir/.placeholder\n\n\n> Any suggestions and input on this exotic use case for git will be very\n> welcomed.\n> \n\nSounds cool. I'll have to give it a whirl when you've got something to show.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"16310","messageId":"43F5AF3C.5050507@itaapy.com","threadId":"3345","inReplyTo":"43F31454.8060704@op5.se","subject":"Re: Use case: GIT to manage transactions in a CMS?","fromName":"J. David Ibáñez","fromEmail":"jdavid@itaapy.com","sentAt":"2006-02-17T11:10:52Z","receivedAt":"2006-02-17T11:10:52Z","isPatch":false,"sender":{"key":"jdavid@itaapy.com","avatar":null},"body":"Andreas Ericsson wrote:\n\n> J. David Ibáñez wrote:\n>\n>> Hello,\n>>\n>> I am working on a project (a content management system) where the data\n>> is stored as files and folders.\n>>\n>> Currently, for persistance and transactions we use the ZODB [1] object\n>> database. But our goal is to move away from the ZODB and use directly\n>> the file system, as it will allow us to use all the good unix tools.\n>>\n>> We are using git to manage the source code. And now we are exploring git\n>> to see if it can do the job of transactions, so that each transaction in\n>> the system will be a git commit.\n>>\n>> One problem we have found is that we can not commit empty directories\n>> (what\n>> we need to do). Any idea how to solve or work-around this constraint?\n>>\n>\n> $ touch empty/dir/.placeholder\n>\n>\n\nI would like to have something better, no so much of a work-around.\n\nMaybe I could hack something, are there some docs explaining the\ninternal format of git objects? or, where to look in the source to\nfind this info?\n\n\n>> Any suggestions and input on this exotic use case for git will be very\n>> welcomed.\n>>\n\nAnother point, the application is written in Python, right now I\nhave to open a shell to run the git commands.\n\nIt would be nice if the core functionality was implemented in a C\nlibrary, then with a Python wrapper I could use git without going\nthrough the shell.\n\nIs this something to be expected? There will be a \"libgit\" sometime\nin the future?\n\n\n> Sounds cool. I'll have to give it a whirl when you've got something to\n> show.\n>\n\nProbably I will have to hack something else to have ACID transactions,\nin the short-term. But \"git\" is at least interesting, since it could\nopen a world of possibilities. If I ever have something to show, I will\ntell you.\n\n\n-- \nJ. David Ibáñez\nItaapy <http://www.itaapy.com>         Tel +33 (0)1 42 23 67 45\n9 rue Darwin, 75018 Paris              Fax +33 (0)1 53 28 27 88 \n"},{"id":"16311","messageId":"7v7j7u43c2.fsf@assigned-by-dhcp.cox.net","threadId":"3345","inReplyTo":"43F5AF3C.5050507@itaapy.com","subject":"Re: Use case: GIT to manage transactions in a CMS?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-17T11:44:29Z","receivedAt":"2006-02-17T11:44:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"J. David Ibáñez\" <jdavid@itaapy.com> writes:\n\n> Maybe I could hack something, are there some docs explaining the\n> internal format of git objects? or, where to look in the source to\n> find this info?\n\nThe index file is mostly dealt with by read-cache.c (despite its\nname, it has both read and write routines).  The easiest way to\nunderstand the tree object format is by reading write-tree.c.\n\nBut the format is the easiest part.  You have to realize that\nthis is a nontrivial task.\n\nThe merge algorithm assumes that it can detect a presense of\ndirectory by finding a blob under that.  You need to teach\n'read-tree -m' that sometimes there is an empty directory\nrecorded in the index file.  This is very important to avoid\ndirectory-file conflicts during the merge.\n\nTree object side is probably easier because we _can_ write an\nempty tree object, and presumably three tree-walker\nimplementations (one used in read-tree and object layer, one in\ndiff-tree and another in merge-tree) should all handle empty\ntrees gracefully, but still its callers need to be verified.\n\n> Another point, the application is written in Python, right now\n> I have to open a shell to run the git commands.\n\nI always have a shell open so it does not sound a big deal to me\n;-).\n\n> It would be nice if the core functionality was implemented in a C\n> library, then with a Python wrapper I could use git without going\n> through the shell.\n>\n> Is this something to be expected? There will be a \"libgit\" sometime\n> in the future?\n\nYes, read the list archive.\n\nBut not yet.  The core level has been fluctuating quite a bit.  The\nlatest round being the object layer bookkeeping changes.\n"}]}