git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* custom diff - text file diary entries
@ 2010-12-30 11:33 Zenaan Harkness
  2010-12-30 12:22 ` Andreas Ericsson
  0 siblings, 1 reply; 4+ messages in thread
From: Zenaan Harkness @ 2010-12-30 11:33 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom diff - text file diary entries
  2010-12-30 11:33 custom diff - text file diary entries Zenaan Harkness
@ 2010-12-30 12:22 ` Andreas Ericsson
  2010-12-30 12:36   ` Zenaan Harkness
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Ericsson @ 2010-12-30 12:22 UTC (permalink / raw)
  To: Zenaan Harkness; +Cc: git

On 12/30/2010 12:33 PM, Zenaan Harkness wrote:
> 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).
> 
> 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.
> 

It seems like what you really need is a database backend for this that
you simply take normal backups from every once in a while, or a script
that produces the desired output on the fly from many different files.

If you really, really want to use git for this, you could create your
own custom merge driver. How to do so is reasonably well documented in
examples and man-pages. You'll want to sneak a peak at the attributes
page.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom diff - text file diary entries
  2010-12-30 12:22 ` Andreas Ericsson
@ 2010-12-30 12:36   ` Zenaan Harkness
  2010-12-30 13:47     ` Santi Béjar
  0 siblings, 1 reply; 4+ messages in thread
From: Zenaan Harkness @ 2010-12-30 12:36 UTC (permalink / raw)
  To: git

On Thu, Dec 30, 2010 at 23:22, Andreas Ericsson <ae@op5.se> wrote:
> On 12/30/2010 12:33 PM, Zenaan Harkness wrote:
>> 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).
...
> If you really, really want to use git for this, you could create your
> own custom merge driver. How to do so is reasonably well documented in
> examples and man-pages. You'll want to sneak a peak at the attributes
> page.

"custom merge driver .. attributes page"

Thank you very much for these pointers,
Zen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: custom diff - text file diary entries
  2010-12-30 12:36   ` Zenaan Harkness
@ 2010-12-30 13:47     ` Santi Béjar
  0 siblings, 0 replies; 4+ messages in thread
From: Santi Béjar @ 2010-12-30 13:47 UTC (permalink / raw)
  To: Zenaan Harkness; +Cc: git

On Thu, Dec 30, 2010 at 1:36 PM, Zenaan Harkness <zen@freedbms.net> wrote:
> On Thu, Dec 30, 2010 at 23:22, Andreas Ericsson <ae@op5.se> wrote:
>> On 12/30/2010 12:33 PM, Zenaan Harkness wrote:
>>> 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).
> ...
>> If you really, really want to use git for this, you could create your
>> own custom merge driver. How to do so is reasonably well documented in
>> examples and man-pages. You'll want to sneak a peak at the attributes
>> page.
>
> "custom merge driver .. attributes page"

Maybe you are interested also in these ChangeLog merge driver for git:

https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#git-merge-changelog

HTH,
Santi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-30 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-30 11:33 custom diff - text file diary entries Zenaan Harkness
2010-12-30 12:22 ` Andreas Ericsson
2010-12-30 12:36   ` Zenaan Harkness
2010-12-30 13:47     ` Santi Béjar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).