Code

Merge branch 'fg/submodule-keep-updating'
authorJunio C Hamano <gitster@pobox.com>
Wed, 13 Jul 2011 21:31:35 +0000 (14:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Jul 2011 21:31:35 +0000 (14:31 -0700)
* fg/submodule-keep-updating:
  git-submodule.sh: clarify the "should we die now" logic
  submodule update: continue when a checkout fails
  git-sh-setup: add die_with_status

Conflicts:
git-submodule.sh

1  2 
git-submodule.sh
t/t7406-submodule-update.sh

index c571d320d012067fe7c1d4c6248546d0679d0335,066d6b57160ab93f65bf5893cc8d355fbf237982..cfd5aa60491a88534aeacb7fe70141aa391675a9
@@@ -514,13 -512,15 +516,15 @@@ Maybe you want to use 'update --init'?"
                        case "$update_module" in
                        rebase)
                                command="git rebase"
 -                              action="rebase"
 -                              msg="rebased onto"
 +                              die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$path'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$path': rebased into '\$sha1'")"
+                               must_die_on_failure=yes
                                ;;
                        merge)
                                command="git merge"
 -                              action="merge"
 -                              msg="merged in"
 +                              die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$path'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$path': merged in '\$sha1'")"
+                               must_die_on_failure=yes
                                ;;
                        *)
                                command="git checkout $subforce -q"
                                ;;
                        esac
  
-                       (clear_local_git_env; cd "$path" && $command "$sha1") || die $die_msg
-                       say $say_msg
+                       if (clear_local_git_env; cd "$path" && $command "$sha1")
+                       then
 -                              say "Submodule path '$path': $msg '$sha1'"
++                              say "$say_msg"
+                       elif test -n "$must_die_on_failure"
+                       then
 -                              die_with_status 2 "Unable to $action '$sha1' in submodule path '$path'"
++                              die_with_status 2 "$die_msg"
+                       else
 -                              err="${err};Failed to $action in submodule path '$path'"
++                              err="${err};$die_msg"
+                               continue
+                       fi
                fi
  
                if test -n "$recursive"
                then
-                       (clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags") ||
-                       die "$(eval_gettext "Failed to recurse into submodule path '\$path'")"
+                       (clear_local_git_env; cd "$path" && eval cmd_update "$orig_flags")
+                       res=$?
+                       if test $res -gt 0
+                       then
++                              die_msg="$(eval_gettext "Failed to recurse into submodule path '\$path'")"
+                               if test $res -eq 1
+                               then
 -                                      err="${err};Failed to recurse into submodule path '$path'"
++                                      err="${err};$die_msg"
+                                       continue
+                               else
 -                                      die_with_status $res "Failed to recurse into submodule path '$path'"
++                                      die_with_status $res "$die_msg"
+                               fi
+                       fi
                fi
        done
+       if test -n "$err"
+       then
+               OIFS=$IFS
+               IFS=';'
+               for e in $err
+               do
+                       if test -n "$e"
+                       then
+                               echo >&2 "$e"
+                       fi
+               done
+               IFS=$OIFS
+               exit 1
+       fi
+       }
  }
  
  set_name_rev () {
Simple merge