emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stig Brautaset <stig@brautaset.org>
To: Karl Voit <news1142@Karl-Voit.at>
Cc: emacs-orgmode@gnu.org
Subject: Re: git and orgmode: teaching git a bit of orgmode syntax
Date: Tue, 24 Jan 2017 23:16:03 +0100	[thread overview]
Message-ID: <m2lgu03xzw.fsf@brautaset.org> (raw)
In-Reply-To: <2017-01-24T16-07-08@devnull.Karl-Voit.at>


Karl Voit <devnull@Karl-Voit.at> writes:

> Unfortunately, git does not handle diffs in a meaningful way. For
> example, when there are sub-hierarchies added or removed, it ends up
> with many diff-lines like the following:
>
> -***** NEXT test with DAVdroid
> +* Lesestoff [1/26]                                        :2read:
>  :PROPERTIES:
> -:CREATED:  [2016-05-08 Sun 12:51]
> +:CREATED: [2012-04-17 Tue 10:39]
> +:ARCHIVE:  %s_archive::* Lesestoff
> +:CATEGORY: reading
>  :END:
>
> The two headings being compared by git are totally unrelated. Git
> did find a match for the :PROPERTIES: and :END: lines and therefore
> assumed that I modified the level five heading "NEXT test with
> DAVdroid" into the first level heading "Lesestoff", not recognizing
> that in fact, there were many org-mode lines moved to the archive
> file, resulting in many deleted lines instead of modified ones.

You may want to try setting =diff.algorithm= (see =man git-config=) to
either =patience= or its variant =histogram=. This Stack Overflow answer
contains an example of how the effects of the diff created with the
patience algorithm, and it looks similar to the case you're describing:
http://stackoverflow.com/questions/4045017/what-is-git-diff-patience-for#4045087

You may also want to check out the option =diff.compactionHeuristic=,
which is described thus:

,----
| Set this option to true to enable an experimental heuristic that
| shifts the hunk boundary in an attempt to make the resulting patch
| easier to read.
`----

Stig

      parent reply	other threads:[~2017-01-24 22:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 15:17 git and orgmode: teaching git a bit of orgmode syntax Karl Voit
2017-01-24 15:34 ` Nick Dokos
2017-01-24 16:10   ` Michael Welle
2017-01-24 17:59     ` Nick Dokos
2017-01-24 18:30       ` Michael Welle
2017-01-24 16:02 ` Brett Viren
2017-01-24 22:16 ` Stig Brautaset [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2lgu03xzw.fsf@brautaset.org \
    --to=stig@brautaset.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@Karl-Voit.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).