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

Re: [PATCH 7/7] submodule: implement `module_clone` as a builtin helper

From
Stefan Beller <sbeller@google.com>
Date
Aug 19, 2015, 19:20 UTC
Message-ID
<CAGZ79kYHOb_PJFT3x=RrnfSRFGgizw=jxHG1FhSBBx3dTgZhiQ@mail.gmail.com>
In-Reply-To
<xmqqy4h785af.fsf@gitster.dls.corp.google.com>
On Wed, Aug 19, 2015 at 12:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> `module_clone` is part of the update command, which I want to convert
>> to C next.
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>>
>> This is the only patch that broke by a last minute fix,
>> so this replaces the previous PATCH 7/7.
>
> ... which still breaks 7400.82, though.
because I messed up the resending. :(

Squashing in this fixes it: ---8<---

diff --git a/git-submodule.sh b/git-submodule.sh
index e50451b..e7d221e 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -338,7 +338,7 @@ Use -f if you really want to add it." >&2
                                echo "$(eval_gettext "Reactivating
local git directory for submodule '\$sm_name'.")"
                        fi
                fi
-               git submodule--helper module_clone --prefix
"$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo"
--reference "$reference_path" --depth "$depth" || exit
+               git submodule--helper module_clone --prefix
"$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo"
"$reference_path" "$depth" || exit
                (
                        clear_local_git_env
                        cd "$sm_path" &&
@@ -634,7 +634,7 @@ cmd_update()
                        shift
                        ;;
                --depth=*)
-                       depth=$1
+                       depth="$1"
                        ;;
                --)
                        shift
---
because both depth and reference are either empty string or containing
both key and value
(i.e. $depth will be "--depth=5" and we should not pass --depth into
submodule--helper module_clone
twice)

I can resend the patch as a whole if you'd like. I'd send it together
 in the next series later today, which will demonstrate a possible
implementation of  `git submodule foreach-parallel`


>
> Output from running it with "-i -v" ends like this:
>
> expecting success:
>         mkdir super &&
>         pwd=$(pwd) &&
>         (
>                 cd super &&
>                 git init &&
>                 git submodule add --depth=1 file://"$pwd"/example2 submodule &&
>                 (
>                         cd submodule &&
>                         test 1 = $(git log --oneline | wc -l)
>                 )
>         )
>
> Initialized empty Git repository in /home/gitster/w/git.git/t/trash directory.t7400-submodule-basic/super/.git/
> fatal: Clone of 'file:///home/gitster/w/git.git/t/trash directory.t7400-submodule-basic/example2' into submodule path 'submodule' failed
> not ok 82 - submodule add clone shallow submodule
> #
> #               mkdir super &&
> #               pwd=$(pwd) &&
> #               (
> #                       cd super &&
> #                       git init &&
> #                       git submodule add --depth=1 file://"$pwd"/example2 submodule &&
> #                       (
> #                               cd submodule &&
> #                               test 1 = $(git log --oneline | wc -l)
> #                       )
> #               )
> #
Previous: Junio C HamanoNext: Jeff King
Message 17 of 19 in “Submodule improvements”
  1. 0/7 Submodule improvementsStefan Beller, Aug 18, 2015
  2. 1/7 submodule: implement a config API for lookup of .gitmodules valuesStefan Beller, Aug 18, 2015
  3. 2/7 submodule: extract functions for config set and lookupStefan Beller, Aug 18, 2015
  4. 3/7 submodule: use new config API for worktree configurationsStefan Beller, Aug 18, 2015
  5. 4/7 submodule: Allow errornous values for the fetchrecursesubmodules optionStefan Beller, Aug 18, 2015
  6. Junio C HamanoAug 19, 2015
  7. 5/7 submodule: implement `module_list` as a builtin helperStefan Beller, Aug 18, 2015
  8. Junio C HamanoAug 19, 2015
  9. Junio C HamanoAug 19, 2015
  10. Stefan BellerAug 19, 2015
  11. Stefan BellerAug 19, 2015
  12. 6/7 submodule: implement `module_name` as a builtin helperStefan Beller, Aug 18, 2015
  13. 7/7 submodule: implement `module_clone` as a builtin helperStefan Beller, Aug 18, 2015
  14. Stefan BellerAug 18, 2015
  15. 7/7 submodule: implement `module_clone` as a builtin helperStefan Beller, Aug 18, 2015
  16. Junio C HamanoAug 19, 2015
  17. Stefan BellerAug 19, 2015
  18. Jeff KingAug 21, 2015
  19. Stefan BellerAug 18, 2015

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.