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

[PATCH v3 00/13] submodule: convert parts of 'update' to C

From
Glen Choo <chooglen@google.com>
Date
Mar 3, 2022, 00:57 UTC
Message-ID
<20220303005727.69270-1-chooglen@google.com>
In-Reply-To
<20220301044132.39474-1-chooglen@google.com>

Original series: https://lore.kernel.org/git/20220210092833.55360-1-chooglen@google.com (I've trimmed the cc list down to the 'most interested' parties)

Thanks for the input, Ævar :) This just fixes up a few small issues in the previous version.

= Patch summary
- Patch 1 adds extra tests to "git submodule update" to make sure we
  don't break anything
- Patch 2 removes dead code that used to be part of "git submodule
  update"
- Patch 3 prepares for later changes by introducing the C function that
  will hold most of the newly converted code
- Patch 4 moves run-update-procedure's --suboid option into C
- Patch 5 moves ensure-core-worktree into C
- Patches 6-8 move run-update-procedure's --remote option into C
- Patches 9-11 move "git submodule update"'s --init into C
- Patches 12-13 move "git submodule update"'s --filter option into C
= Changes
Since v2:
- Patch 6: Fix a stale commit message that said 'in the next patch'.
- Patch 9: Fix an overly long line (spotted by Ævar in an older iteration of
  ar/submodule-update)
- Patch 12: Test for usage using test_expect_code
- Patch 13: Add missing spaces to the usage string
Since v1:
- Fix compilation error due to bad rebase
- Remove accidentally included tests
- Fix a NEEDSWORK (it was a leftover from ar/submodule-update)
Atharva Raykar (3):
  submodule--helper: get remote names from any repository
  submodule--helper: refactor get_submodule_displaypath()
  submodule--helper: allow setting superprefix for init_submodule()
Glen Choo (8):
  submodule--helper: remove update-module-mode
  submodule--helper: reorganize code for sh to C conversion
  submodule--helper run-update-procedure: remove --suboid
  submodule--helper: remove ensure-core-worktree
  submodule--helper run-update-procedure: learn --remote
  submodule--helper update-clone: learn --init
  submodule update: add tests for --filter
  submodule--helper update-clone: check for --filter and --init
Ævar Arnfjörð Bjarmason (2):
  submodule tests: test for init and update failure output
  submodule--helper: don't use bitfield indirection for parse_options()
 builtin/submodule--helper.c    | 248 +++++++++++++++++++--------------
 git-submodule.sh               |  54 +------
 t/t7406-submodule-update.sh    |  26 +++-
 t/t7408-submodule-reference.sh |  14 +-
 4 files changed, 183 insertions(+), 159 deletions(-)
Range-diff against v2:
 1:  6138f4682c =  1:  6138f4682c submodule tests: test for init and update failure output
 2:  6c83c78819 =  2:  6c83c78819 submodule--helper: remove update-module-mode
 3:  9524986096 =  3:  9524986096 submodule--helper: reorganize code for sh to C conversion
 4:  f42f3de2b7 =  4:  f42f3de2b7 submodule--helper run-update-procedure: remove --suboid
 5:  b0a0cae633 =  5:  b0a0cae633 submodule--helper: remove ensure-core-worktree
 6:  3bde7ccd61 !  6:  8dc7bc5894 submodule--helper: get remote names from any repository
    @@ Commit message
         submodule, all within the same process.
     
         We can now use this function to save an unnecessary subprocess spawn in
    -    `sync_submodule()`, and also in the next patch, which will require this
    -    functionality.
    +    `sync_submodule()`, and also in a subsequent patch, which will require
    +    this functionality.
     
         Mentored-by: Christian Couder <christian.couder@gmail.com>
         Mentored-by: Shourya Shukla <periperidip@gmail.com>
 7:  3b2caf7a35 =  7:  feaf9f45d8 submodule--helper: don't use bitfield indirection for parse_options()
 8:  81e9da8d42 =  8:  91e8e1a007 submodule--helper run-update-procedure: learn --remote
 9:  122da84ce4 !  9:  aba851e71e submodule--helper: refactor get_submodule_displaypath()
    @@ builtin/submodule--helper.c: static int resolve_relative_url_test(int argc, cons
      
     -/* the result should be freed by the caller. */
     -static char *get_submodule_displaypath(const char *path, const char *prefix)
    -+static char *do_get_submodule_displaypath(const char *path, const char *prefix, const char *super_prefix)
    ++static char *do_get_submodule_displaypath(const char *path,
    ++					  const char *prefix,
    ++					  const char *super_prefix)
      {
     -	const char *super_prefix = get_super_prefix();
     -
10:  fd52d6a2c3 = 10:  2155c049a2 submodule--helper: allow setting superprefix for init_submodule()
11:  9422c2ecac = 11:  03bbc39a06 submodule--helper update-clone: learn --init
12:  0a3e93998d ! 12:  e49b26ad94 submodule update: add tests for --filter
    @@ t/t7406-submodule-update.sh: test_expect_success 'submodule update --quiet passe
      '
      
     +test_expect_success 'submodule update --filter requires --init' '
    -+	test_must_fail git -C super submodule update --filter blob:none 2>err &&
    -+	grep "usage:" err
    ++	test_expect_code 129 git -C super submodule update --filter blob:none
     +'
     +
     +test_expect_success 'submodule update --filter sets partial clone settings' '
13:  6e1ef27191 ! 13:  c97c97948a submodule--helper update-clone: check for --filter and --init
    @@ builtin/submodule--helper.c: static int update_clone(int argc, const char **argv
      	const char *const git_submodule_helper_usage[] = {
     -		N_("git submodule--helper update-clone [--prefix=<path>] [<path>...]"),
     +		N_("git submodule [--quiet] update"
    -+		"[--init [--filter=<filter-spec>]] [--remote]"
    -+		"[-N|--no-fetch] [-f|--force]"
    -+		"[--checkout|--merge|--rebase]"
    -+		"[--[no-]recommend-shallow] [--reference <repository>]"
    -+		"[--recursive] [--[no-]single-branch] [--] [<path>...]"),
    ++		" [--init [--filter=<filter-spec>]] [--remote]"
    ++		" [-N|--no-fetch] [-f|--force]"
    ++		" [--checkout|--merge|--rebase]"
    ++		" [--[no-]recommend-shallow] [--reference <repository>]"
    ++		" [--recursive] [--[no-]single-branch] [--] [<path>...]"),
      		NULL
      	};
      	suc.prefix = prefix;
base-commit: 715d08a9e51251ad8290b181b6ac3b9e1f9719d7
-- 
2.33.GIT
Previous: Ævar Arnfjörð BjarmasonNext: Glen Choo
Message 40 of 75 in “submodule: convert parts of 'update' to C”
  1. 00/13 submodule: convert parts of 'update' to CGlen Choo, Mar 1, 2022
  2. 01/13 submodule tests: test for init and update failure outputGlen Choo, Mar 1, 2022
  3. 02/13 submodule--helper: remove update-module-modeGlen Choo, Mar 1, 2022
  4. 04/13 submodule--helper run-update-procedure: remove --suboidGlen Choo, Mar 1, 2022
  5. 03/13 submodule--helper: reorganize code for sh to C conversionGlen Choo, Mar 1, 2022
  6. 05/13 submodule--helper: remove ensure-core-worktreeGlen Choo, Mar 1, 2022
  7. 06/13 submodule--helper: get remote names from any repositoryGlen Choo, Mar 1, 2022
  8. Junio C HamanoMar 1, 2022
  9. Glen ChooMar 1, 2022
  10. 07/13 submodule--helper: don't use bitfield indirection for parse_options()Glen Choo, Mar 1, 2022
  11. 09/13 submodule--helper: refactor get_submodule_displaypath()Glen Choo, Mar 1, 2022
  12. 08/13 submodule--helper run-update-procedure: learn --remoteGlen Choo, Mar 1, 2022
  13. 10/13 submodule--helper: allow setting superprefix for init_submodule()Glen Choo, Mar 1, 2022
  14. 11/13 submodule--helper update-clone: learn --initGlen Choo, Mar 1, 2022
  15. 12/13 submodule update: add tests for --filterGlen Choo, Mar 1, 2022
  16. 13/13 submodule--helper update-clone: check for --filter and --initGlen Choo, Mar 1, 2022
  17. Glen ChooMar 1, 2022
  18. 00/13 submodule: convert parts of 'update' to CGlen Choo, Mar 1, 2022
  19. 01/13 submodule tests: test for init and update failure outputGlen Choo, Mar 1, 2022
  20. 02/13 submodule--helper: remove update-module-modeGlen Choo, Mar 1, 2022
  21. 03/13 submodule--helper: reorganize code for sh to C conversionGlen Choo, Mar 1, 2022
  22. 04/13 submodule--helper run-update-procedure: remove --suboidGlen Choo, Mar 1, 2022
  23. 05/13 submodule--helper: remove ensure-core-worktreeGlen Choo, Mar 1, 2022
  24. 06/13 submodule--helper: get remote names from any repositoryGlen Choo, Mar 1, 2022
  25. Ævar Arnfjörð BjarmasonMar 1, 2022
  26. 07/13 submodule--helper: don't use bitfield indirection for parse_options()Glen Choo, Mar 1, 2022
  27. 08/13 submodule--helper run-update-procedure: learn --remoteGlen Choo, Mar 1, 2022
  28. 09/13 submodule--helper: refactor get_submodule_displaypath()Glen Choo, Mar 1, 2022
  29. Ævar Arnfjörð BjarmasonMar 1, 2022
  30. 10/13 submodule--helper: allow setting superprefix for init_submodule()Glen Choo, Mar 1, 2022
  31. 12/13 submodule update: add tests for --filterGlen Choo, Mar 1, 2022
  32. Ævar Arnfjörð BjarmasonMar 1, 2022
  33. Glen ChooMar 1, 2022
  34. 11/13 submodule--helper update-clone: learn --initGlen Choo, Mar 1, 2022
  35. 13/13 submodule--helper update-clone: check for --filter and --initGlen Choo, Mar 1, 2022
  36. Ævar Arnfjörð BjarmasonMar 1, 2022
  37. Junio C HamanoMar 1, 2022
  38. Glen ChooMar 1, 2022
  39. Ævar Arnfjörð BjarmasonMar 3, 2022
  40. 00/13 submodule: convert parts of 'update' to CGlen Choo, Mar 3, 2022
  41. 01/13 submodule tests: test for init and update failure outputGlen Choo, Mar 3, 2022
  42. 03/13 submodule--helper: reorganize code for sh to C conversionGlen Choo, Mar 3, 2022
  43. 02/13 submodule--helper: remove update-module-modeGlen Choo, Mar 3, 2022
  44. 04/13 submodule--helper run-update-procedure: remove --suboidGlen Choo, Mar 3, 2022
  45. Junio C HamanoMar 3, 2022
  46. 05/13 submodule--helper: remove ensure-core-worktreeGlen Choo, Mar 3, 2022
  47. Junio C HamanoMar 3, 2022
  48. Glen ChooMar 4, 2022
  49. 06/13 submodule--helper: get remote names from any repositoryGlen Choo, Mar 3, 2022
  50. 07/13 submodule--helper: don't use bitfield indirection for parse_options()Glen Choo, Mar 3, 2022
  51. 08/13 submodule--helper run-update-procedure: learn --remoteGlen Choo, Mar 3, 2022
  52. Junio C HamanoMar 3, 2022
  53. Glen ChooMar 4, 2022
  54. 09/13 submodule--helper: refactor get_submodule_displaypath()Glen Choo, Mar 3, 2022
  55. 10/13 submodule--helper: allow setting superprefix for init_submodule()Glen Choo, Mar 3, 2022
  56. 11/13 submodule--helper update-clone: learn --initGlen Choo, Mar 3, 2022
  57. 12/13 submodule update: add tests for --filterGlen Choo, Mar 3, 2022
  58. 13/13 submodule--helper update-clone: check for --filter and --initGlen Choo, Mar 3, 2022
  59. Ævar Arnfjörð BjarmasonMar 3, 2022
  60. Junio C HamanoMar 3, 2022
  61. 00/13 submodule: convert parts of 'update' to CGlen Choo, Mar 5, 2022
  62. 01/13 submodule tests: test for init and update failure outputGlen Choo, Mar 5, 2022
  63. 04/13 submodule--helper run-update-procedure: remove --suboidGlen Choo, Mar 5, 2022
  64. 03/13 submodule--helper: reorganize code for sh to C conversionGlen Choo, Mar 5, 2022
  65. 02/13 submodule--helper: remove update-module-modeGlen Choo, Mar 5, 2022
  66. 05/13 submodule--helper: get remote names from any repositoryGlen Choo, Mar 5, 2022
  67. 06/13 submodule--helper: don't use bitfield indirection for parse_options()Glen Choo, Mar 5, 2022
  68. 07/13 submodule--helper run-update-procedure: learn --remoteGlen Choo, Mar 5, 2022
  69. 08/13 submodule--helper: refactor get_submodule_displaypath()Glen Choo, Mar 5, 2022
  70. 09/13 submodule--helper: allow setting superprefix for init_submodule()Glen Choo, Mar 5, 2022
  71. 10/13 submodule--helper update-clone: learn --initGlen Choo, Mar 5, 2022
  72. 11/13 submodule--helper: remove ensure-core-worktreeGlen Choo, Mar 5, 2022
  73. 13/13 submodule--helper update-clone: check for --filter and --initGlen Choo, Mar 5, 2022
  74. 12/13 submodule update: add tests for --filterGlen Choo, Mar 5, 2022
  75. Junio C HamanoMar 5, 2022

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.