[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [rbm/master] Bug 28466: fix issue with git submodule URL changes



commit eb500fa9467fb4d7229c9ca87f202ef18603d023
Author: Nicolas Vigier <boklm@xxxxxxxxxxxxxx>
Date:   Mon Nov 26 11:49:25 2018 +0100

    Bug 28466: fix issue with git submodule URL changes
    
    We replace a call to:
      git submodule update --init
    with calls to:
      git submodule init
      git submodule sync
      git submodule update
    
    The call to `git submodule sync` is solving the issue that could occur
    when a submodule URL is changing.
---
 lib/RBM.pm | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/RBM.pm b/lib/RBM.pm
index 8875a7c..3ef20ae 100644
--- a/lib/RBM.pm
+++ b/lib/RBM.pm
@@ -474,10 +474,12 @@ sub execute {
                 = capture_exec('git', 'checkout', $git_hash);
         exit_error "Cannot checkout $git_hash:\n$stderr" unless $success;
         if (project_config($project, 'git_submodule', $options)) {
-            ($stdout, $stderr, $success, $exit_code)
-                = capture_exec('git', 'submodule', 'update', '--init');
-            exit_error "Error running git submodule update:\n$stderr"
-                unless $success;
+            foreach my $action (qw(init sync update)) {
+                ($stdout, $stderr, $success, $exit_code)
+                    = capture_exec('git', 'submodule', $action);
+                exit_error "Error running git submodule $action\n$stderr"
+                    unless $success;
+            }
         }
     } elsif (project_config($project, 'hg_url', $options)) {
         my $hg_hash = project_config($project, 'hg_hash', $options)
@@ -550,10 +552,12 @@ sub maketar {
             my ($stdout, $stderr, $success, $exit_code)
                 = capture_exec('git', 'checkout', $commit_hash);
             exit_error "Cannot checkout $commit_hash: $stderr" unless $success;
-            ($stdout, $stderr, $success, $exit_code)
-                = capture_exec('git', 'submodule', 'update', '--init');
-            exit_error "Error running git submodule update:\n$stderr"
-                unless $success;
+            foreach my $action (qw(init sync update)) {
+                ($stdout, $stderr, $success, $exit_code)
+                    = capture_exec('git', 'submodule', $action);
+                exit_error "Error running git submodule $action\n$stderr"
+                    unless $success;
+            }
             ($stdout, $stderr, $success, $exit_code)
                 = capture_exec('git', 'submodule', 'foreach',
                     "git archive --prefix=$project-$version/\$path/"

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits