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

Re: [PATCH] [submodule] Add depth to submodule update

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 25, 2013, 05:07 UTC
Message-ID
<7vtxkm4w2c.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130624224925.GC32270@paksenarrion.iveqy.com>
Summoning area experts ;-)
Thanks.
Fredrik Gustafsson <iveqy@iveqy.com> writes:
Show 61 quoted lines
> Used only when a clone is initialized. This is useful when the submodule(s)
> are huge and you're not really interested in anything but the latest commit.
>
> Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
> ---
>  git-submodule.sh | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 79bfaac..b102fa8 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -211,12 +211,18 @@ module_clone()
>  	name=$2
>  	url=$3
>  	reference="$4"
> +	depth=$5
>  	quiet=
>  	if test -n "$GIT_QUIET"
>  	then
>  		quiet=-q
>  	fi
>
> +	if test -n "$depth"
> +	then
> +		depth="--depth=$depth"
> +	fi
> +
>  	gitdir=
>  	gitdir_base=
>  	base_name=$(dirname "$name")
> @@ -233,7 +239,7 @@ module_clone()
>  		mkdir -p "$gitdir_base"
>  		(
>  			clear_local_git_env
> -			git clone $quiet -n ${reference:+"$reference"} \
> +			git clone $quiet $depth -n ${reference:+"$reference"} \
>  				--separate-git-dir "$gitdir" "$url" "$sm_path"
>  		) ||
>  		die "$(eval_gettext "Clone of '\$url' into submodule path '\$sm_path' failed")"
> @@ -676,6 +682,9 @@ cmd_update()
>  		--checkout)
>  			update="checkout"
>  			;;
> +		--depth)
> +			depth=$2
> +			;;
>  		--)
>  			shift
>  			break
> @@ -735,7 +744,7 @@ Maybe you want to use 'update --init'?")"
>
>  		if ! test -d "$sm_path"/.git -o -f "$sm_path"/.git
>  		then
> -			module_clone "$sm_path" "$name" "$url" "$reference" || exit
> +			module_clone "$sm_path" "$name" "$url" "$reference" "$depth" || exit
>  			cloned_modules="$cloned_modules;$name"
>  			subsha1=
>  		else
> --
> 1.8.0
Previous: Fredrik GustafssonNext: Heiko Voigt
Message 3 of 14 in “[RFC] [submodule] Add depth to submodule update”
  1. Fredrik GustafssonJun 23, 2013
  2. [submodule] Add depth to submodule updateFredrik Gustafsson, Jun 24, 2013
  3. Junio C HamanoJun 25, 2013
  4. Heiko VoigtJun 25, 2013
  5. Fredrik GustafssonJun 26, 2013
  6. Junio C HamanoJun 26, 2013
  7. Jens LehmannJun 27, 2013
  8. Heiko VoigtJun 28, 2013
  9. Junio C HamanoJun 28, 2013
  10. Jens LehmannJun 28, 2013
  11. Junio C HamanoJun 28, 2013
  12. Fredrik GustafssonJun 28, 2013
  13. Junio C HamanoJun 30, 2013
  14. Junio C HamanoJun 26, 2013

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.