emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Samuel Wales <samologist@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [OT] org and diff
Date: Sun, 13 Nov 2022 05:32:09 +0000	[thread overview]
Message-ID: <87zgcv773a.fsf@localhost> (raw)
In-Reply-To: <CAJcAo8vJ8DXDgJzr15ESXQ3s0ifZja3vJ7wTFDu9x-TguWOiMg@mail.gmail.com>

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>


  reply	other threads:[~2022-11-13  5:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13  5:15 [OT] org and diff Samuel Wales
2022-11-13  5:32 ` Ihor Radchenko [this message]
2022-11-13  6:06   ` Samuel Wales
2022-11-15 16:58     ` Max Nikulin
2022-11-13  5:38 ` Samuel Wales
2022-11-13  9:32 ` Marcin Borkowski
2022-11-22  3:06 ` Samuel Wales
2022-11-22  3:17   ` Samuel Wales
2022-12-17  2:06     ` Samuel Wales
2022-12-17  8:36       ` Marcin Borkowski
2022-12-17  8:41         ` Ihor Radchenko
2022-12-28  2:30         ` Samuel Wales
2022-12-28  2:32           ` Samuel Wales
2022-12-28  6:35           ` Marcin Borkowski

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=87zgcv773a.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=samologist@gmail.com \
    /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).