public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michal Gorny (mgorny)" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog git-r3.eclass
Date: Sun,  2 Mar 2014 11:48:05 +0000 (UTC)	[thread overview]
Message-ID: <20140302114805.A9F2C2004C@flycatcher.gentoo.org> (raw)

mgorny      14/03/02 11:48:05

  Modified:             ChangeLog git-r3.eclass
  Log:
  Support EGIT_CLONE_TYPE=shallow.

Revision  Changes    Path
1.1158               eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1158&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1158&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1157&r2=1.1158

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1157
retrieving revision 1.1158
diff -u -r1.1157 -r1.1158
--- ChangeLog	2 Mar 2014 11:47:41 -0000	1.1157
+++ ChangeLog	2 Mar 2014 11:48:05 -0000	1.1158
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1157 2014/03/02 11:47:41 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1158 2014/03/02 11:48:05 mgorny Exp $
+
+  02 Mar 2014; Michał Górny <mgorny@gentoo.org> git-r3.eclass:
+  Support EGIT_CLONE_TYPE=shallow.
 
   02 Mar 2014; Michał Górny <mgorny@gentoo.org> git-r3.eclass:
   Support EGIT_CLONE_TYPE=single.



1.33                 eclass/git-r3.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-r3.eclass?rev=1.33&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-r3.eclass?rev=1.33&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-r3.eclass?r1=1.32&r2=1.33

Index: git-r3.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- git-r3.eclass	2 Mar 2014 11:47:41 -0000	1.32
+++ git-r3.eclass	2 Mar 2014 11:48:05 -0000	1.33
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.32 2014/03/02 11:47:41 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.33 2014/03/02 11:48:05 mgorny Exp $
 
 # @ECLASS: git-r3.eclass
 # @MAINTAINER:
@@ -29,13 +29,13 @@
 if [[ ! ${_GIT_R3} ]]; then
 
 if [[ ! ${_INHERITED_BY_GIT_2} ]]; then
-	DEPEND="dev-vcs/git"
+	DEPEND=">=dev-vcs/git-1.8.2.1"
 fi
 
 # @ECLASS-VARIABLE: EGIT_CLONE_TYPE
 # @DESCRIPTION:
 # Type of clone that should be used against the remote repository.
-# This can be either of: 'mirror', 'single'.
+# This can be either of: 'mirror', 'single', 'shallow'.
 #
 # The 'mirror' type clones all remote branches and tags with complete
 # history and all notes. EGIT_COMMIT can specify any commit hash.
@@ -50,6 +50,12 @@
 # in the current branch. No purging of old references is done (if you
 # often switch branches, you may need to remove stale branches
 # yourself). This mode is suitable for general use.
+#
+# The 'shallow' type clones only the newest commit on requested branch
+# or tag. EGIT_COMMIT can only specify tags, and since the history is
+# unavailable calls like 'git describe' will not reference prior tags.
+# No purging of old references is done. This mode is intended mostly for
+# embedded systems with limited disk space.
 : ${EGIT_CLONE_TYPE:=single}
 
 # @ECLASS-VARIABLE: EGIT3_STORE_DIR
@@ -129,7 +135,7 @@
 
 	# check the clone type
 	case "${EGIT_CLONE_TYPE}" in
-		mirror|single)
+		mirror|single|shallow)
 			;;
 		*)
 			die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}"
@@ -249,10 +255,6 @@
 	fi
 
 	addwrite "${EGIT3_STORE_DIR}"
-	if [[ -e ${GIT_DIR}/shallow ]]; then
-		einfo "${GIT_DIR} was a shallow clone, recreating..."
-		rm -r "${GIT_DIR}" || die
-	fi
 	if [[ ! -d ${GIT_DIR} ]]; then
 		mkdir "${GIT_DIR}" || die
 		git init --bare || die
@@ -428,7 +430,7 @@
 				# (we keep it in refs/git-r3 since otherwise --prune interferes)
 				HEAD:refs/git-r3/HEAD
 			)
-		else # single
+		else # single or shallow
 			local fetch_l fetch_r
 
 			if [[ ${remote_ref} == HEAD ]]; then
@@ -468,6 +470,18 @@
 			)
 		fi
 
+		if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
+			# use '--depth 1' when fetching a new branch
+			if [[ ! $(git rev-parse --quiet --verify "${fetch_r}") ]]
+			then
+				fetch_command+=( --depth 1 )
+			fi
+		else # non-shallow mode
+			if [[ -f ${GIT_DIR}/shallow ]]; then
+				fetch_command+=( --unshallow )
+			fi
+		fi
+
 		set -- "${fetch_command[@]}"
 		echo "${@}" >&2
 		if "${@}"; then
@@ -477,7 +491,7 @@
 					"$(_git-r3_find_head refs/git-r3/HEAD \
 						< <(git show-ref --heads || die))" \
 						|| die "Unable to update HEAD"
-			else # single
+			else # single or shallow
 				if [[ ${fetch_l} == HEAD ]]; then
 					# find out what branch we fetched as HEAD
 					local head_branch=$(_git-r3_find_head \
@@ -620,6 +634,10 @@
 
 		# (no need to copy HEAD, we will set it via checkout)
 
+		if [[ -f ${orig_repo}/shallow ]]; then
+			cp "${orig_repo}"/shallow "${GIT_DIR}"/ || die
+		fi
+
 		set -- git checkout --quiet
 		if [[ ${remote_ref} ]]; then
 			set -- "${@}" "${remote_ref#refs/heads/}"





             reply	other threads:[~2014-03-02 11:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 11:48 Michal Gorny (mgorny) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-08  9:32 [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog git-r3.eclass Michal Gorny (mgorny)
2015-07-09 20:21 Michal Gorny (mgorny)
2015-06-22  8:39 Manuel Rueger (mrueg)
2014-07-28 14:13 Michal Gorny (mgorny)
2014-07-28 14:12 Michal Gorny (mgorny)
2014-07-07 14:41 Michal Gorny (mgorny)
2014-06-20 11:40 Michal Gorny (mgorny)
2014-06-01 22:07 Michal Gorny (mgorny)
2014-05-23  7:09 Michal Gorny (mgorny)
2014-04-17 20:28 Michal Gorny (mgorny)
2014-03-24 21:32 Michal Gorny (mgorny)
2014-03-03 21:45 Michal Gorny (mgorny)
2014-03-02 11:50 Michal Gorny (mgorny)
2014-03-02 11:50 Michal Gorny (mgorny)
2014-03-02 11:49 Michal Gorny (mgorny)
2014-03-02 11:49 Michal Gorny (mgorny)
2014-03-02 11:48 Michal Gorny (mgorny)
2014-03-02 11:47 Michal Gorny (mgorny)
2014-03-02 11:47 Michal Gorny (mgorny)
2014-03-02 11:46 Michal Gorny (mgorny)
2014-03-02 11:46 Michal Gorny (mgorny)
2014-03-02 11:45 Michal Gorny (mgorny)
2014-03-02 11:44 Michal Gorny (mgorny)
2014-02-25 13:01 Michal Gorny (mgorny)
2014-02-24  8:43 Michal Gorny (mgorny)
2014-02-23 22:05 Michal Gorny (mgorny)
2013-11-15 23:03 Michal Gorny (mgorny)
2013-10-30 19:21 Michal Gorny (mgorny)
2013-10-27 13:44 Michal Gorny (mgorny)
2013-10-27 13:33 Michal Gorny (mgorny)
2013-10-26  6:19 Michal Gorny (mgorny)
2013-10-13  7:14 Michal Gorny (mgorny)
2013-10-09 17:14 Michal Gorny (mgorny)
2013-10-05 16:48 Michal Gorny (mgorny)
2013-09-27 16:22 Michal Gorny (mgorny)
2013-09-26 21:04 Michal Gorny (mgorny)
2013-09-26 12:38 Michal Gorny (mgorny)
2013-09-25 11:19 Michal Gorny (mgorny)
2013-09-25 10:49 Michal Gorny (mgorny)
2013-09-19  9:42 Michal Gorny (mgorny)
2013-09-19  9:37 Michal Gorny (mgorny)
2013-09-13 15:08 Michal Gorny (mgorny)
2013-09-13 15:04 Michal Gorny (mgorny)
2013-09-09 16:01 Michal Gorny (mgorny)
2013-09-05 22:40 Michal Gorny (mgorny)
2013-09-05 20:24 Michal Gorny (mgorny)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140302114805.A9F2C2004C@flycatcher.gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox