git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GSOC][RFC] Add more builtin patterns for userdiff, as Mircroproject.

From
Christian Couder <christian.couder@gmail.com>
Date
Jan 10, 2024, 11:33 UTC
Message-ID
<CAP8UFD30h7D7D42Eiq3sk97v_ef8hi=K1qdy2wRczQ18JM++LA@mail.gmail.com>
In-Reply-To
<CANAnif95ux=vCNCKbVw0q_vYamQRkbFqSa9_-u6xRvK6r+2a+Q@mail.gmail.com>
Hi Sergius,
On Tue, Jan 9, 2024 at 8:59 PM Sergius Nyah <sergiusnyah@gmail.com> wrote:
Show 7 quoted lines
>
> Hello everyone,
> I'm Sergius, a Computer Science undergraduate student, and I want to
> begin Contributing to the Git project. So far, I've gone through
> Matheus' tutorial on First steps Contributing to Git, and I found it
> very helpful. I've also read the Contribution guidelines keenly and
> built Git from source.
Thanks for your interest in contributing to Git!
> In accordance to the contributor guidelines, I came across this
> Mircoproject idea from: https://git.github.io/SoC-2022-Microprojects/
s/Mircoproject/microproject/
There is a similar typo in the subject of your email too.
Show 8 quoted lines
> which I'm willing to work on. It talked about enhancing Git's
> "userdiff" feature in "userdiff.c" which is crucial for identifying
> function names in various programming languages, thereby improving the
> readability of "git diff" outputs.
>
> From my understanding, the project involves extending the `userdiff`
> feature to support additional programming languages that are currently
> not covered such as Shell, Swift, Go and the others.
As far as I can see in userdiff.c, Golang and Bash seem to be supported.
Show 25 quoted lines
> Here is a sample of how a language is defined in `userdiff.c`:
>
> > #define PATTERNS(lang, rx, wrx) { \
> > .name = lang, \
> > .binary = -1, \
> > .funcname = { \
> > .pattern = rx, \
> > .cflags = REG_EXTENDED, \
> > }, \
> > .word_regex = wrx "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+", \
> > .word_regex_multi_byte = wrx "|[^[:space:]]", \
> > }
>
> In this code, `lang` is the name of the language, `rx` is the regular
> expression for identifying function names, and `wrx` is the word
> regex.
>
> Approach: I Identified the Programming Languages that are not
> currently supported by the userdiff feature by reviewing the existing
> patterns in userdiff.c and comparing them with some popular
> programming languages.
> For each supported language, I would define a regular expression that
> could help identify function names in that language. This could
> include researching each language's syntax and testing their
> expressions to ensure that they work well.

In your microproject, you only need to add support for ONE language that is not supported yet. Please don't try to do more than that.

Show 5 quoted lines
> Also, I'd add a new IPATTERN definition for each language to the
> "userdiff.c" file, then rebuild Git and test the changes by creating a
> repo with files in the newly supported languages then run "git diff"
> to ensure the line @@ ... @@ produces their correct function names.
> Then submit a patch.
Except for my comments above, this looks like a good plan. Thanks.
Previous: Sergius NyahNext: Sergius Nyah
Message 2 of 33 in “[GSOC][RFC] Add more builtin patterns for userdiff, as Mircroproject.”
  1. Sergius NyahJan 9, 2024
  2. Christian CouderJan 10, 2024
  3. Fwd: [GSOC][RFC] Add more builtin patterns for userdiff, as Mircroproject.Sergius Nyah, Jan 11, 2024
  4. Christian CouderJan 11, 2024
  5. Sergius NyahJan 11, 2024
  6. [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject.Sergius Nyah, Feb 27, 2024
  7. 1/2 Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff.Sergius Nyah, Feb 27, 2024
  8. 2/2 Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffsSergius Nyah, Feb 27, 2024
  9. [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject.Sergius Nyah, Feb 27, 2024
  10. 1/2 Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff.Sergius Nyah, Feb 27, 2024
  11. 2/2 Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffsSergius Nyah, Feb 27, 2024
  12. [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject.Sergius Nyah, Feb 27, 2024
  13. 1/2 Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff.Sergius Nyah, Feb 27, 2024
  14. 2/2 Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffsSergius Nyah, Feb 27, 2024
  15. [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject.Sergius Nyah, Feb 27, 2024
  16. 1/2 Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff.Sergius Nyah, Feb 27, 2024
  17. Ghanshyam ThakkarFeb 27, 2024
  18. Sergius NyahFeb 27, 2024
  19. 2/2 Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffsSergius Nyah, Feb 27, 2024
  20. [GSOC][PATCH] Userdiff: add builtin patterns for JavaScript.Sergius Nyah, Feb 28, 2024
  21. Junio C HamanoFeb 28, 2024
  22. [GSOC][PATCH] userdiff: add builtin patterns for JavaScript.Sergius Nyah, Feb 29, 2024
  23. Ghanshyam ThakkarFeb 29, 2024
  24. [GSOC][PATCH] userdiff: Add JavaScript function patternsSergius Nyah, Mar 1, 2024
  25. Christian CouderMar 2, 2024
  26. Christian CouderMar 2, 2024
  27. Junio C HamanoMar 2, 2024
  28. Patrick SteinhardtMar 4, 2024
  29. [GSOC][PATCH v2 1/3]t4018-diff-funcname: use test_grep instead of test_i18ngrepSergius Nyah, Mar 12, 2024
  30. [GSOC][PATCH v2 2/3]t4034-diff-words: add javascript language driverSergius Nyah, Mar 12, 2024
  31. [GSOC][PATCH v2 3/3]userdiff: remove trailing whitespaces, fix multiline commentsSergius Nyah, Mar 12, 2024
  32. [GSOC][PATCH v2]userdiff: improve code quality and add JavaScript language driver.Sergius Nyah, Mar 19, 2024
  33. Junio C HamanoMar 19, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.