[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [OT] org and diff
From: |
Ihor Radchenko |
Subject: |
Re: [OT] org and diff |
Date: |
Sun, 13 Nov 2022 05:32:09 +0000 |
Samuel Wales <samologist@gmail.com> writes:
> someplace in it, is an entry with a 234-item plain list. if i try to
> move this entry, and make no other changes, diff goes insane. if i
> try to refile this entry to a different org file, diff similarly goes
> insane, with the - part. only that change.
>
> ok, what it does is, intersperse or mingle entries. so suppose i want
> to stage this one tiny little change, namely moving one entry [the one
> with the large plain list] to a different location in the same file.
> even if i move it really distantly.
>
> i.e. i want to put the - and the + of the move to the staging area in
> magit. unstaged changes should then not have this file in it at all
> after the staging operations.
>
> then, basically, staged changes will have this move.
>
> as a user, i want diff to make this two hunks, a big - and a big +.
> but diff mingles parts of another entry or entries with this list, so
> that it is scattered all over the diff. to get the result i want
> requires tons of intra-hunk stage operations. at best.
>
> so, what aspect of diff or org is triggering this kind of behavior?
> what is it that diff needs to understand about org, or what minimality
> etc. settings does it want to create a better diff?
Most likely, the default git's grouping of chunks is not good enough for
your case.
I have the following in my ~/.gitconfig:
[diff "org"]
xfuncname = "^(\\*+ +.*)$"
[core]
attributesfile = /home/yantar92/.gitattributes
And ~/.gitattributes:
*.org diff=org
This will help grouping changes under the same heading.
Source: https://protesilaos.com/codelog/2021-01-26-git-diff-hunk-elisp-org/
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>