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

[RFC][PATCH 0/2] submodule: port 'set-url' from shell to C

From
Shourya Shukla <shouryashukla.oo@gmail.com>
Date
Apr 16, 2020, 21:04 UTC
Message-ID
<20200416210456.19122-1-shouryashukla.oo@gmail.com>
Hello all,

This is my very first attempt at the conversion of subcommand 'set-url' from shell to C, thus making the subcommand a builtin.

I have based my conversion by looking at the way other subcommands have been implemented in 'submodule--helper.c' as well as the subcommand 'set-url' in 'remote.c'. The approach I have taken is as follows:

1. Create a helper function 'update_url_in_gitmodules()' in 'submodule.c'
   to update the URL of an entry in '.gitmodules'.
2. Port the function 'cmd_set_url()' in 'git-submodule.sh' to 'module_set_url()'
   in 'submodule--helper.c'.
The issues I am facing are:
1. The patch fails test #2 in t7420, i.e., the test to verify the working of 'set-url'
   subcommand.
2. Though not an issue affecting the patch, but the 'usage' prompt of 'git submodule'
   does not show the subcommands 'set-url' and 'set-branch'.

Also, I am aware that the patch does not support the '--quiet' option. This is something I intended to add after ensuring that the patch works in the first place.

I understand that the patch is in a weak condition right now. How can this patch be improved? Any guidance from the community would be appreciated! :)

Thanks, Shourya Shukla

Shourya Shukla (2):
  submodule.c: update URL in .gitmodules using update_url_in_gitmodules
  submodule: port subcommand 'set-url' from shell to C
 builtin/submodule--helper.c | 38 +++++++++++++++++++++++++++++++++++++
 git-submodule.sh            | 23 ++--------------------
 submodule.c                 | 33 ++++++++++++++++++++++++++++++++
 submodule.h                 |  2 ++
 4 files changed, 75 insertions(+), 21 deletions(-)
-- 
2.20.1
Next: Shourya Shukla
Message 1 of 8 in “submodule: port 'set-url' from shell to C”
  1. Shourya ShuklaApr 16, 2020
  2. 1/2 submodule.c: update URL in .gitmodules using update_url_in_gitmodulesShourya Shukla, Apr 16, 2020
  3. 2/2 submodule: port subcommand 'set-url' from shell to CShourya Shukla, Apr 16, 2020
  4. Christian CouderApr 17, 2020
  5. Christian CouderApr 17, 2020
  6. Denton LiuApr 20, 2020
  7. Shourya ShuklaApr 27, 2020
  8. Denton LiuApr 27, 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.