{"thread":{"id":"26162","subject":"custom diff - text file diary entries","startedAt":"2010-12-30T11:33:07Z","lastAt":"2010-12-30T13:47:27Z","messageCount":4,"participants":["Zenaan Harkness","Andreas Ericsson","Santi Béjar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"158752","messageId":"AANLkTimPTYEWr0qQwYM4jmJSLcrLRt27GC0nTVgVzHK2@mail.gmail.com","threadId":"26162","inReplyTo":null,"subject":"custom diff - text file diary entries","fromName":"Zenaan Harkness","fromEmail":"zen@freedbms.net","sentAt":"2010-12-30T11:33:07Z","receivedAt":"2010-12-30T11:33:07Z","isPatch":false,"sender":{"key":"zen@freedbms.net","avatar":null},"body":"Problem:\nSeparate text file diary entries, committed in separate repos,\ncause merge clash when pushed to central repo,\nsince git thinks the two entries are a single conflicting entry\n(since they begin at the same location in the same file).\n\nWhat we need is two diary entries automatically detected and inserted\ninto the one file, one above the other (ordering is not so important).\n\n\nDetail:\nI have a repo of diary text files;\neach diary entry is separated by three blank lines\nand has an asterisked + dated header, and a body.\nHere is an example diary file contents:\n----\n*20101230 by sarah, @~3:00pm\nPhoned James and asked why he took so long shopping.\nHe said he had planned a one day trip, but got lost in Bunnings.\nI told him 'yeah sure, like I believe that'. I asked him what he got.\n\nThis is the list he told me:\n - pliers\n - hammer\n - nails\n\n\n\n*20101229 by james\nToday I went shopping.\nBought some eggs.\n----\n\nEach new diary entry gets added in the appropriate diary file\nin reverse chronological order.\n\njames, sarah and others each share a few diary files\n(different diaries have different purposes).\n\nThe problem is:\njames and sarah, each in their own clone of the central repo;\nthey each add a new diary entry to the same file, then commit, then push;\n\nthe second person to push will fail,\nsince each new diary entry occurs in the same location, the top of the file;\nthis requires a pull: result is git gives me the following (james pushed 2nd)\nextract:\n\n<<<<<<< HEAD\n*20101231 by james\nI took a day off today.\nDidn't do much at all.\n=======\n*20101231 by sarah\nJames told me this morning he was taking a day off,\nso bugger it, I decided to take a day off too.\n\nI switched on the answering machine.\n>>>>>>> a55d55a7a074bed5dbc24416f20a1d9391f2bb40\n\n\nDesired outcome:\nTwo new diary entries - two separate insertions into the text file,\nnot the conflict.\n\nIs there an easy way I can automate this diary entry merging, so my\nusers don't have to manually resolve the conflict?\n\nPlease note: SOMETIMES, one user will go and correct spelling and/ or\ngrammar fixes in another person's diary entry, or in their own older\ndiary entry - this is quite common.\n\nTIA\nZen\n"},{"id":"158753","messageId":"4D1C7979.9050400@op5.se","threadId":"26162","inReplyTo":"AANLkTimPTYEWr0qQwYM4jmJSLcrLRt27GC0nTVgVzHK2@mail.gmail.com","subject":"Re: custom diff - text file diary entries","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2010-12-30T12:22:17Z","receivedAt":"2010-12-30T12:22:17Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 12/30/2010 12:33 PM, Zenaan Harkness wrote:\n> Problem:\n> Separate text file diary entries, committed in separate repos,\n> cause merge clash when pushed to central repo,\n> since git thinks the two entries are a single conflicting entry\n> (since they begin at the same location in the same file).\n> \n> What we need is two diary entries automatically detected and inserted\n> into the one file, one above the other (ordering is not so important).\n> \n> Desired outcome:\n> Two new diary entries - two separate insertions into the text file,\n> not the conflict.\n> \n> Is there an easy way I can automate this diary entry merging, so my\n> users don't have to manually resolve the conflict?\n> \n> Please note: SOMETIMES, one user will go and correct spelling and/ or\n> grammar fixes in another person's diary entry, or in their own older\n> diary entry - this is quite common.\n> \n\nIt seems like what you really need is a database backend for this that\nyou simply take normal backups from every once in a while, or a script\nthat produces the desired output on the fly from many different files.\n\nIf you really, really want to use git for this, you could create your\nown custom merge driver. How to do so is reasonably well documented in\nexamples and man-pages. You'll want to sneak a peak at the attributes\npage.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"158754","messageId":"AANLkTinAJ=Dzn6u7Xu=dqkzm+tiB2M_nGE2=EzRDnPEa@mail.gmail.com","threadId":"26162","inReplyTo":"4D1C7979.9050400@op5.se","subject":"Re: custom diff - text file diary entries","fromName":"Zenaan Harkness","fromEmail":"zen@freedbms.net","sentAt":"2010-12-30T12:36:15Z","receivedAt":"2010-12-30T12:36:15Z","isPatch":false,"sender":{"key":"zen@freedbms.net","avatar":null},"body":"On Thu, Dec 30, 2010 at 23:22, Andreas Ericsson <ae@op5.se> wrote:\n> On 12/30/2010 12:33 PM, Zenaan Harkness wrote:\n>> Problem:\n>> Separate text file diary entries, committed in separate repos,\n>> cause merge clash when pushed to central repo,\n>> since git thinks the two entries are a single conflicting entry\n>> (since they begin at the same location in the same file).\n>>\n>> What we need is two diary entries automatically detected and inserted\n>> into the one file, one above the other (ordering is not so important).\n...\n> If you really, really want to use git for this, you could create your\n> own custom merge driver. How to do so is reasonably well documented in\n> examples and man-pages. You'll want to sneak a peak at the attributes\n> page.\n\n\"custom merge driver .. attributes page\"\n\nThank you very much for these pointers,\nZen\n"},{"id":"158757","messageId":"AANLkTinzKdQbMt+4uod05aAWfeK5xJ_JBhQhDaMFsLzy@mail.gmail.com","threadId":"26162","inReplyTo":"AANLkTinAJ=Dzn6u7Xu=dqkzm+tiB2M_nGE2=EzRDnPEa@mail.gmail.com","subject":"Re: custom diff - text file diary entries","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2010-12-30T13:47:27Z","receivedAt":"2010-12-30T13:47:27Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Thu, Dec 30, 2010 at 1:36 PM, Zenaan Harkness <zen@freedbms.net> wrote:\n> On Thu, Dec 30, 2010 at 23:22, Andreas Ericsson <ae@op5.se> wrote:\n>> On 12/30/2010 12:33 PM, Zenaan Harkness wrote:\n>>> Problem:\n>>> Separate text file diary entries, committed in separate repos,\n>>> cause merge clash when pushed to central repo,\n>>> since git thinks the two entries are a single conflicting entry\n>>> (since they begin at the same location in the same file).\n>>>\n>>> What we need is two diary entries automatically detected and inserted\n>>> into the one file, one above the other (ordering is not so important).\n> ...\n>> If you really, really want to use git for this, you could create your\n>> own custom merge driver. How to do so is reasonably well documented in\n>> examples and man-pages. You'll want to sneak a peak at the attributes\n>> page.\n>\n> \"custom merge driver .. attributes page\"\n\nMaybe you are interested also in these ChangeLog merge driver for git:\n\nhttps://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#git-merge-changelog\n\nHTH,\nSanti\n"}]}