On Tuesday, March 30, 2021 at 7:28:50 PM UTC+5:30, Göran Weinholt wrote:
> Atharva Raykar <
rayka...@gmail.com> writes:
>
> > On Tuesday, March 30, 2021 at 1:12:24 PM UTC+5:30, Göran Weinholt wrote:
> >> Atharva Raykar <
rayka...@gmail.com> writes:
> >>
> >> [...]
> >> > For now I am only taking the following forms for the hunk headers:
> >> >
> >> > - `define`
> >> > - `define-syntax`
> >> > - `define-*` (any other define form that may have been introduced via macro)
> >> >
> >> > Is there any other form that would make a useful landmark for hunk
> >> > headers that I should include, that will work well across most Scheme
> >> > implementations?
> >> Perhaps `library` would be nice to have (`define-library` would already
> >> be covered by the above).
> >
> > Just to be clear, in the case where a change within a `define` that is inside a
> > `library`, would you prefer the hunk header showing the `library` line or the
> > `define` line in which the change was made?
> I believe that showing the `define` would be preferable.
>
> I've tried to think of anything else to match on, but nothing comes to
> mind. Will there be an opportunity for the community to try out these
> changes before they are included in git?
Here is a way to test the same functionality, without needing a
patched version of git:
1. In your repository's `.git/config` file add the following:
[diff "scheme"]
xfuncname = "^[\t ]*(\\(define[-* \t].*)$"
wordRegex = "([^][)(}{[ \t])+"
2. Add another file in the top level of your project called `.gitattributes` with
these contents:
*.scm diff=scheme
And now if you run `git diff` over your scheme files, you should see hunk headers
show up for your project. You can tweak the xfuncname regex to try out more
constructs if it seems fit to do so.
Another thing this would add is `git diff --word-diff` will show a diff for each
individual word, and it's a little more language aware than the default word diff,
as it will ignore parentheses.
I also have my own fork of git, which will have this feature here, before it gets
added in:
https://github.com/tfidfwastaken/git
I have not pushed all the changes yet, but either way I believe the first method
would be easier to do than trying to build my version of git from source just to
test this out.
--
Atharva