From: "Derick W. de M. Frias" <derick.william.moraes@gmail.com>
To: git@vger.kernel.org
Subject: [GSoC PATCH 0/1] userdiff: add javascript diff driver
Date: Wed, 4 Jun 2025 06:35:45 -0300 [thread overview]
Message-ID: <20250604094100.80598-1-derick.william.moraes@gmail.com> (raw)
Hi, I'm Derick and this is one of my first contributions. I'm a CS
undergrad student and I'm really excited to start learning more about
Git's internals.
As it is in 2025, javascript is amongst the most prevalent programming
languages and yet it it not beeing supported by a diff driver in Git.
I do believe that the addition of this functionality is a good
contribution that will benefit tons of developers that work with
javascript.
For me, it was a surprise to discover that javascript isn't supported
yet, so the first thing that came to mind was if someone had already
tried to work on the problem. Searching at Git's lore, I found some
previous atempts at tacking it and I tried to learn from them and to
guide my work along what I believe were good paths taken.
The pattern I added to userdiff.c to recognize functions groups them in
some categories, that are: conventional functions (Those that are
declared in outer scope, and not assigned to any variable), assigned
functions (those that ARE assigned to a variable), arrow functions and
functions declared inside classes or objects.
For js literals, the regex matches valid alphanumerical literals that
are valid in javascript. It also matches numerical literals in binary,
octal, decimal and hexadecimal bases, and punctuations.
I also added test cases for instances of function declarations.
I tried to keep things simple, my idea is to make it work well while
thinking 'vanilla' javascript-first. I'm quite sure the contribution
still can be improved so I'm looking foward for feedback on what is
important/interesting to be made.
Derick W. de M. Frias (1):
userdiff: add javascript diff driver
.../javascript-anonymous-function-assigned | 4 +++
t/t4018/javascript-arrow-function-assigned | 4 +++
t/t4018/javascript-arrow-function-assigned-2 | 1 +
t/t4018/javascript-async-function | 4 +++
t/t4018/javascript-async-function-assigned | 4 +++
t/t4018/javascript-class-function | 6 ++++
t/t4018/javascript-function | 4 +++
t/t4018/javascript-function-assigned | 4 +++
t/t4018/javascript-generator-function | 5 ++++
t/t4018/javascript-generator-function-2 | 5 ++++
.../javascript-generator-function-assigned | 5 ++++
.../javascript-generator-function-assigned-2 | 5 ++++
t/t4018/javascript-method-function | 6 ++++
userdiff.c | 28 +++++++++++++++++++
14 files changed, 85 insertions(+)
create mode 100644 t/t4018/javascript-anonymous-function-assigned
create mode 100644 t/t4018/javascript-arrow-function-assigned
create mode 100644 t/t4018/javascript-arrow-function-assigned-2
create mode 100644 t/t4018/javascript-async-function
create mode 100644 t/t4018/javascript-async-function-assigned
create mode 100644 t/t4018/javascript-class-function
create mode 100644 t/t4018/javascript-function
create mode 100644 t/t4018/javascript-function-assigned
create mode 100644 t/t4018/javascript-generator-function
create mode 100644 t/t4018/javascript-generator-function-2
create mode 100644 t/t4018/javascript-generator-function-assigned
create mode 100644 t/t4018/javascript-generator-function-assigned-2
create mode 100644 t/t4018/javascript-method-function
--
2.50.0.rc0.62.g658f0ae201.dirty
next reply other threads:[~2025-06-04 9:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 9:35 Derick W. de M. Frias [this message]
2025-06-04 9:35 ` [GSoC PATCH 1/1] userdiff: add javascript diff driver Derick W. de M. Frias
2025-06-04 21:19 ` D. Ben Knoble
2025-06-05 5:51 ` Johannes Sixt
2025-06-23 6:35 ` [PATCH v2 0/4] diff: create pattern for javascript language Derick W. de M. Frias
2025-06-23 6:35 ` [PATCH v2 1/4] userdiff: add javascript diff driver Derick W. de M. Frias
2025-06-23 18:09 ` Junio C Hamano
2025-06-23 6:35 ` [PATCH v2 2/4] t4034: add tests for javascript word literals Derick W. de M. Frias
2025-06-23 6:35 ` [PATCH v2 3/4] t4018: add tests for recognizing javascript function syntax Derick W. de M. Frias
2025-06-23 6:35 ` [PATCH v2 4/4] t4018: add tests for javascript export type function declarations Derick W. de M. Frias
2025-06-26 6:21 ` Johannes Sixt
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250604094100.80598-1-derick.william.moraes@gmail.com \
--to=derick.william.moraes@gmail.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).