{"thread":{"id":"52767","subject":"Re: Conversion of 'git submodule' to C: need some help","startedAt":"2020-02-09T15:00:27Z","lastAt":"2020-02-09T15:00:27Z","messageCount":1,"participants":["Abhishek Kumar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"391398","messageId":"CAHk66fte4Rv199jJ8xgrpkzyonyXdhtYzn4fPA7mWPrKA9v2zA@mail.gmail.com","threadId":"52767","inReplyTo":null,"subject":"Re: Conversion of 'git submodule' to C: need some help","fromName":"Abhishek Kumar","fromEmail":"abhishekkumar8222@gmail.com","sentAt":"2020-02-09T15:00:00Z","receivedAt":"2020-02-09T15:00:27Z","isPatch":false,"sender":{"key":"abhishekkumar8222@gmail.com","avatar":"https://avatars.githubusercontent.com/u/31231064?v=4"},"body":"Greetings Shourya\n\n> 1. What exactly are we aiming in [3]? To replace the function completely\n> or to just add some 'repo_submodule_init' functionality?\n\nWe are aiming to convert calls to use `repo_submodule_init` instead\nand remove this function.\n\nIf they differ in functionality, implement any changes to\n`repo_submodule_init` such that code that already uses it runs without\nany modifications.\n\n> 2. Something I inferred was that functions with names of the pattern 'strbuf_git_*'\n> are trying to 'create a path' (are they physically creating the path or just instructing git about them?)\n\n`strbuf_git_*` construct a path to the git directory and append it to\nthe string buffer passed. They are not physically creating folders,\njust creating a string variable that stores the path.\nIf anything, it returns -1 when the git directory does not exist already. [1]\n\n> while functions of the pattern 'git_*' are trying to check some conditions denoted\n> by their function names(for instance  'git_config_rename_section_in_file')?\n> Is this inference correct to some extent?\n\nWhile I cannot talk about whether your inference is correct,\n`git_config_rename_section_in_file` does not **just** check the\ncondition.\n\nIn the case of `remove_path_from_submodules` (where I am guessing you\nhad this doubt), it removes the section from `.gitmodules` and returns\na negative value on failure [2]\n\nIt's a common idiom in C - Functions with intended side effects return\nnon zero (usually negative) values on failure and zero otherwise. [3]\n\n3. Not sure what you mean. Do elaborate.\n\n4. Yes! Everyone has to begin at some point and learn. Feel free to\nask more questions when in doubt.\n\nRegards\nAbhishek\n\n[1]: https://github.com/git/git/blob/de93cc14ab7e8db7645d8dbe4fd2603f76d5851f/submodule.c#L2257\n[2]: https://github.com/git/git/blob/de93cc14ab7e8db7645d8dbe4fd2603f76d5851f/config.c#L3051\n[3]: https://wiki.c2.com/?CeeIdioms\n"}]}