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

Conversion of 'git submodule' to C: need some help

From
Shourya Shukla <shouryashukla.oo@gmail.com>
Date
Feb 9, 2020, 11:13 UTC
Message-ID
<20200209111349.20472-1-shouryashukla.oo@gmail.com>
Hello everyone,

I was trying to understand the code of 'git submodule'[1]. This is also in reference to this conversation I had before[2].

I read the code and stumbled across a function with a 'TODO' tag[3]. Here we want to change the aforementioned function into a 'repo_submodule_init' function I suppose.

I am facing some problems and would love some insight on them:
	
	1. What exactly are we aiming in [3]? To replace the function completely
	   or to just add some 'repo_submodule_init' functionality?
	2. Something I inferred was that functions with names of the pattern 'strbuf_git_*'
	   are trying to 'create a path'(are they physically creating the path or just
	   instructing git about them?) while functions of the pattern 'git_*' are trying
	   to check some conditions denoted by their function names(for instance
	   'git_config_rename_section_in_file')? Is this inference correct to some extent?
	3. How does one check which all parts of a command have been completed? Is it checked
	   by looking at the file history or by comparing with the shell script of the command
	   or are there any other means?
	
	4. Is it fine if I am not able to understand the purpose of certain functions right now(such as
	   'add_submodule_odb')? I am able to get a rough idea of what the functions are doing but I am
	   not able to decode certain functions line-by-line.

Currently, I am studying in depth about 'git objects' and the submodule command on the git Documentation. What else do would you advise me to strengthen my understanding of the code and git in general?

Regards, Shourya Shukla

[1]: https://github.com/periperidip/git/blob/v2.25.0/submodule.c [2]: https://lore.kernel.org/git/20200201173841.13760-1-shouryashukla.oo@gmail.com/ [3]: https://github.com/periperidip/git/blob/v2.25.0/submodule.c#L168

Next: Johannes Schindelin
Message 1 of 2 in “Conversion of 'git submodule' to C: need some help”
  1. Shourya ShuklaFeb 9, 2020
  2. Johannes SchindelinFeb 13, 2020

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.