GSoC Week 1



A warm entrance

It has been a good week. The Google Summer of Code '20 results were announced and I along with two fellow countrymen Hariom and Abhishek made it. Congratulations to all! ;)

I had intended to start my project before the results were announced irrespective of my selection, and so far things seem good! I am done with the porting of set-url from shell to C and it is in its final stages of review by Christian, Junio and Denton (at the time of writing the blog it has entered the pu branch of git/git).

In the premier week I have been:

  1. Working on gitfaq. As the name suggests, it consists of various commonly asked questions about the Git suite. 2 out of 4 commits have been queued and now my goal lies in working out the rest 2 commits so that they are queued as well.
  2. Working on set-branch subcommand of git submodule.

Let’s explore (2) a bit more:

What is set-branch?

Quoting from the official Documentation:

Sets the default remote tracking branch for the submodule. The --branch option allows the remote branch to be specified. The --default option removes the submodule..branch configuration key, which causes the tracking branch to default to master.

Hence, it helps to set the branch of the submodule in question. My job here is to convert the subcommand from shell to C. The test responsible to check the correct functioning of the command is t7419.

What is my progress?

At the time of writing this blog (May 9, 2330h IST), my progress is as follows:

  • Created the basic scaffolding for the command (declaring the required variables & argument parsing)
  • Implemented (or did I? More on that below) the branch option.
  • Implemented (or did I? More on that below) the default option.
  • Removed the shell script part of the subcommand from .gitsubmodule.sh.
  • Added the subcommand in the cmd_struct[] structure.

The difficulties

Alright, so the problem which I am facing is as follows (I will describe it in terms of the test so that it is easy to understand as well as explain). t7419 has the following 6 tests:

  1. submodule config cache setup
  2. ensure submodule branch is unset
  3. test submodule set-branch --branch
  4. test submodule set-branch --default
  5. test submodule set-branch -b
  6. test submodule set-branch -d

Tests 1&2 are responsible for setting up the repository and hence pass irrespective of the set-branch implementation. Only tests 3&5 are failing (surprising it may seem?). The thing is that, the core function which being used to set the config in .gitmodules, config_set_in_gitmodules_file_gently, sets the value of a configuration only if it exists in the first place. I discovered this while debugging the errors, by doing a cat .gitmodules, observing that an entry was never even made in the first place for the branch. Hilariously, this is the exact reason tests 4&6 are passing. The default option’s goal is to remove the submodule.<name>.branch section, thus making the branch as master by default. Now, as my implementation of the branch option is not actually inserting any entry, the default option does not get the chance to see any entry in fact, thus passing the tests.

Next steps

Thankfully, as I have discovered the root cause of the problem here, my goal now is to create a mechanism which will make a submodule.<name>.branch entry in .gitmodules if one does not exist and update it with the branch desired in the arguments of the subcommand. Similarly, I will have to ensure that the default option deletes the aforementioned entry if it exists.

The community has been very welcoming with support coming in from so many people. Feels at home! :’)

Thank you Git! Looking forward to tons of contributions ;)

Over and out,
Shourya Shukla

Comments

Popular posts from this blog

The Final Report

GSoC Week 15

GSoC Week 4 [One month special]