From: Fredrik Gustafsson <iveqy@iveqy.com>
To: git@vger.kernel.org
Subject: [PATCH] submodule update: continue when an update fails
Date: Thu, 21 Apr 2011 10:53:21 +0200 [thread overview]
Message-ID: <20110421085321.GA14057@paksenarrion.iveqy.com> (raw)
Hi,
when running git submodule update the scripts stop after failing to
fetch an submodule. This is errornous because this implies that if a
submodule 'a' isn't availiable then submodule 'x' shouldn't be loaded.
This implies a relationship that isn't definied within git.
There's three different ways to solve this (because the script is runned
as a childprocess of the git-submodule.sh script):
1. use a global variable (via the export command) to share data between
processes.
2. Print outdata from the childprocess to stdout and read it via a pipe
in the parent process.
3. Do all error handling in the child process
I've choosen alternative 3 as it seams to have the smallest impact.
From 7ba07dcfdd99c14522946e923ec63bd0bcd60021 Mon Sep 17 00:00:00 2001
From: Fredrik Gustafsson <iveqy@iveqy.com>
Date: Mon, 18 Apr 2011 23:08:59 +0200
Subject: [PATCH] submodule update: continue when an update fails
git submodule update dies when a remote reference isn't a tree. Instead
of dying, print an error message and continue update the next submodule
(and die when all modules are done if there was any errors).
Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
---
git-submodule.sh | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index b010a67..06ff7f2 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -441,7 +441,8 @@ cmd_update()
fi
cloned_modules=
- module_list "$@" |
+ err=
+ module_list "$@" | {
while read mode sha1 stage path
do
if test "$stage" = U
@@ -521,17 +522,32 @@ cmd_update()
;;
esac
- (clear_local_git_env; cd "$path" && $command "$sha1") ||
- die "Unable to $action '$sha1' in submodule path '$path'"
- say "Submodule path '$path': $msg '$sha1'"
+ if (clear_local_git_env; cd "$path" && $command "$sha1")
+ then
+ say "Submodule path '$path': $msg '$sha1'"
+ else
+ say "Unable to $action '$sha1' in submodule path '$path'"
+ err="Failed to $action one or more submodule(s)"
+ continue
+ fi
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
+
+ if test -n "$err"
+ then
+ die $err
+ fi
+
+ }
}
set_name_rev () {
--
1.7.5.rc0.133.gcc4dd.dirty
--
Med vänliga hälsningar
Fredrik Gustafsson
tel: 0733-608274
e-post: iveqy@iveqy.com
next reply other threads:[~2011-04-21 8:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-21 8:53 Fredrik Gustafsson [this message]
2011-04-21 18:28 ` [PATCH] submodule update: continue when an update fails Junio C Hamano
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=20110421085321.GA14057@paksenarrion.iveqy.com \
--to=iveqy@iveqy.com \
--cc=git@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).