git/list[1] front-page[2] threads[3] people[4] search[5] about
 

custom diff - text file diary entries

From
ZHZenaan Harkness <zen@freedbms.net>
Date
Dec 30, 2010, 11:33 UTC
Message-ID
<AANLkTimPTYEWr0qQwYM4jmJSLcrLRt27GC0nTVgVzHK2@mail.gmail.com>

Problem: Separate text file diary entries, committed in separate repos, cause merge clash when pushed to central repo, since git thinks the two entries are a single conflicting entry (since they begin at the same location in the same file).

What we need is two diary entries automatically detected and inserted into the one file, one above the other (ordering is not so important).

Detail: I have a repo of diary text files; each diary entry is separated by three blank lines and has an asterisked + dated header, and a body. Here is an example diary file contents: ---- *20101230 by sarah, @~3:00pm Phoned James and asked why he took so long shopping. He said he had planned a one day trip, but got lost in Bunnings. I told him 'yeah sure, like I believe that'. I asked him what he got.

This is the list he told me:
 - pliers
 - hammer
 - nails

*20101229 by james Today I went shopping. Bought some eggs. ----

Each new diary entry gets added in the appropriate diary file in reverse chronological order.

james, sarah and others each share a few diary files (different diaries have different purposes).

The problem is: james and sarah, each in their own clone of the central repo; they each add a new diary entry to the same file, then commit, then push;

the second person to push will fail, since each new diary entry occurs in the same location, the top of the file; this requires a pull: result is git gives me the following (james pushed 2nd) extract:

<<<<<<< HEAD *20101231 by james I took a day off today. Didn't do much at all. ======= *20101231 by sarah James told me this morning he was taking a day off, so bugger it, I decided to take a day off too.

I switched on the answering machine.
>>>>>>> a55d55a7a074bed5dbc24416f20a1d9391f2bb40

Desired outcome: Two new diary entries - two separate insertions into the text file, not the conflict.

Is there an easy way I can automate this diary entry merging, so my users don't have to manually resolve the conflict?

Please note: SOMETIMES, one user will go and correct spelling and/ or grammar fixes in another person's diary entry, or in their own older diary entry - this is quite common.

TIA Zen

Next: Andreas Ericsson
Message 1 of 4 in “custom diff - text file diary entries”
  1. Zenaan HarknessDec 30, 2010
  2. Andreas EricssonDec 30, 2010
  3. Zenaan HarknessDec 30, 2010
  4. Santi BéjarDec 30, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.