Subject: Re: [GSoC] microproject: builtin patterns for userdiff

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 21 Mar 2024 13:12:10 +0100

On Sun, Mar 17, 2024 at 02:46:18AM +0530, Utsav Parmar wrote:
> Hello,
> 
> I am Utsav, a Computer Engineering graduate, with 2.5+ years of
> experience in the technical industry.
> 
> I am writing to express my interest in contributing to the Git project
> as part of the GSoC internship. While I have had some experience
> contributing to open-source projects, Git had felt a bit daunting to
> start. I am happy to use GSoC as a reason to introduce myself to the
> Git community and start contributing via microprojects initially. I am
> aware that I am far late in starting with this but I'd like to use
> this opportunity to learn and contribute more even if my proposal is
> not accepted.
> 
> I am passionate about TDD and work at an organization that fosters a
> culture for writing tests first and continuously improving tests and
> thus, naturally, the project idea "Move existing tests to a unit
> testing framework" caught my interest. While I have some ideas around
> this, I've been focused on choosing a microproject and implementing it
> lately.

Thanks for your interest in the Git project, and welcome to the
community :)

> I have been working on "Add more builtin patterns for userdiff" for
> Haskell language but a regex for checking the beginning of a function
> definition here is tricky.
> 
> Haskell has function definitions that look like - 
> ```haskell
> main = do
> 	putStrLn "The addition of the two numbers is:"
> 	print(add 2 5)
> ```
> This is fairly easy to implement and I have been successful is doing so as well with verifying them with tests.
> 
> However, Haskell also has function definitions that look like - 
> ```haskell
> zip (x:xs) (y:ys) = (x,y) : zip xs ys
> zip  xs     ys    = []
> ```
> Notice how the function name is repeated on every line. (and this is perfectly legal in Haskell!)
> I couldn't think of a way around this. Please let me know if you have any ideas on this.

I cannot be of much help with regards to this, and I assume that most
everybody who is frequenting this mailing list is likely not all that
familiar with Haskell, either. But I saw that you've instead moved on to
provide support for TypeScript instead, so that's fine, too.

> I'd like to know if there are any criteria for selecting languages to
> write built-in drivers for the hunk header as I only see a small
> subset of languages already added. Is it left open as a
> good-first-contribution for beginners and so can we add any
> language/s?

I don't really think we have any specific criteria for adding languages
to the userdiff intrastructure. It should probably have more than one
user so that it's actually useful to somebody, but other than that you
are basically to add whatever you think makes sense.

> I am asking this because I noticed a pattern for css and instantly
> thought of it for writing for scss files and would like to understand
> any implications of this before I send a patch.
> 
> I observed that javascript and typescript have not been added yet
> despite being popular languages. It seems that someone else has
> already been working on javascript, so I'll implement it for
> typescript language.

These seem to be good candidates then :)

> Upon implement this locally, I got confused a bit about `t/t4034/`
> directory. Could you tell me more about it please and especially
> `expect` files here? Are these auto generated? How can I trace these?

I assume you already figured this out by now given that your patch
contains tests in t4034 for TypeScript. Let me know in case things are
still unclear though.

Patrick