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

Re: GSOC proposal

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Mar 25, 2011, 10:08 UTC
Message-ID
<20110325100835.GB30376@paksenarrion.iveqy.com>
In-Reply-To
<4D8BD358.1030603@web.de>
On Fri, Mar 25, 2011 at 12:27:20AM +0100, Jens Lehmann wrote:
Show 22 quoted lines
> > == Threat every module alike ==
> > When failing fetching a submodule, continue fetching the next one
> > instead of dying. There's no need to prevent fetching a submodule
> > beginning at 'z' just because a failing in fetching a submodule
> > beginning at 'a'. The submodules should not be alphabetically dependant
> > as they are now.
> 
> I assume you are talking about the implicit fetch done by "git submodule
> update" here. The recursive submodule fetch that "git fetch" learned
> recently continues to fetch other submodules even if one or more fetches
> failed. But you are right that "git submodule update" should attempt to
> continue updating the remaining submodules too even if one of those
> updates failed along the way (This should be achieved with even less
> effort than the push issue mentioned above, so it would be an even
> easier starting point for people who want to get involved).
> 
> /* snip */
> 
> (And, as every year, it's a good idea for a prospective student to get
> involved in the git community before his application is accepted ...
> sending some patches is a good way to do that, maybe regarding one of
> the first two issues raised here? ;-)

I've attached a patch solving the submodule update-problem. A thing I though about is if it's a good idéa to end the output with an error summary. A git submodule update with 40-50 modules would easily let an error go by undetected with this patch.

-- 
Med vänliga hälsningar
Fredrik Gustafsson

tel: 0733-608274
e-post: iveqy@iveqy.com


>From 1bc9a5e69f7b3296bad6dd0449054de8501be5bd Mon Sep 17 00:00:00 2001
From: iveqy <iveqy@iveqy.com>
Date: Fri, 25 Mar 2011 10:43:42 +0100
Subject: [PATCH] When one submodule fails, continue to the next

---
 git-submodule.sh |   60 ++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 3a13397..ae3abd1 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -342,8 +342,11 @@ cmd_init()
 		test -z "$url" || continue
 
 		url=$(git config -f .gitmodules submodule."$name".url)
-		test -z "$url" &&
-		die "No url found for submodule path '$path' in .gitmodules"
+		if test -z "$url" 
+		then
+			say "No url found for submodule path '$path' in .gitmodules"
+			continue
+		fi
 
 		# Possibly a url relative to parent
 		case "$url" in
@@ -352,13 +355,17 @@ cmd_init()
 			;;
 		esac
 
-		git config submodule."$name".url "$url" ||
-		die "Failed to register url for submodule path '$path'"
+		if !(git config submodule."$name".url "$url")
+		then
+			say "Failed to register url for submodule path '$path'"
+		fi
 
 		upd="$(git config -f .gitmodules submodule."$name".update)"
-		test -z "$upd" ||
-		git config submodule."$name".update "$upd" ||
-		die "Failed to register update mode for submodule path '$path'"
+		if !(test -z "$upd" || git config submodule."$name".update "$upd")
+		then
+			say "Failed to register update mode for submodule path '$path'"
+			continue
+		fi
 
 		say "Submodule '$name' ($url) registered for path '$path'"
 	done
@@ -446,9 +453,11 @@ cmd_update()
 			cloned_modules="$cloned_modules;$name"
 			subsha1=
 		else
-			subsha1=$(clear_local_git_env; cd "$path" &&
-				git rev-parse --verify HEAD) ||
-			die "Unable to find current revision in submodule path '$path'"
+			if !(subsha1=$(clear_local_git_env; cd "$path" && git rev-parse --verify HEAD))
+			then
+				say "Unable to find current revision in submodule path '$path'"
+				continue
+			fi
 		fi
 
 		if ! test -z "$update"
@@ -466,9 +475,11 @@ cmd_update()
 
 			if test -z "$nofetch"
 			then
-				(clear_local_git_env; cd "$path" &&
-					git-fetch) ||
-				die "Unable to fetch in submodule path '$path'"
+				if !(clear_local_git_env; cd "$path" && git-fetch)
+				then
+					say "Unable to fetch in submodule path '$path'"
+					continue
+				fi
 			fi
 
 			# Is this something we just cloned?
@@ -496,15 +507,21 @@ cmd_update()
 				;;
 			esac
 
-			(clear_local_git_env; cd "$path" && $command "$sha1") ||
-			die "Unable to $action '$sha1' in submodule path '$path'"
+			if !(clear_local_git_env; cd "$path" && $command "$sha1")
+			then
+				say "Unable to $action '$sha1' in submodule path '$path'"
+				continue;
+			fi
 			say "Submodule path '$path': $msg '$sha1'"
 		fi
 
 		if test -n "$recursive"
 		then
-			(clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags") ||
-			die "Failed to recurse into submodule path '$path'"
+			if !(clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags") 
+			then
+				say "Failed to recurse into submodule path '$path'"
+				continue;
+			fi
 		fi
 	done
 }
@@ -790,13 +807,16 @@ cmd_status()
 
 		if test -n "$recursive"
 		then
-			(
+			if ! (
 				prefix="$displaypath/"
 				clear_local_git_env
 				cd "$path" &&
 				eval cmd_status "$orig_args"
-			) ||
-			die "Failed to recurse into submodule path '$path'"
+			) 
+			then
+				say "Failed to recurse into submodule path '$path'"
+				continue
+			fi
 		fi
 	done
 }
-- 
1.7.4.1.433.gcd306.dirty
Previous: Jens Lehmann
Message 6 of 6 in “GSOC proposal”
  1. Fredrik GustafssonMar 24, 2011
  2. Jens LehmannMar 24, 2011
  3. Junio C HamanoMar 24, 2011
  4. Fredrik GustafssonMar 25, 2011
  5. Jens LehmannMar 25, 2011
  6. Fredrik GustafssonMar 25, 2011

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.