[tor-commits] [rbm/master] Bug 25746: fix git_submodule option with submodule in subdirectory

gk at torproject.org gk at torproject.org
Wed Apr 11 09:06:27 UTC 2018


commit 8adbc46dc9e8358abad75ac81faf4646d8165b9e
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Mon Apr 9 18:54:04 2018 +0200

    Bug 25746: fix git_submodule option with submodule in subdirectory
    
    To create an archive containing all submodules, we were creating a
    temporary archive of each submodule before appending them to the main
    archive. We were using the submodule path in the temporary archive
    filename, which was failing if the submodule is in a subdirectory.
    To avoid that, we are removing the path from the temporary archive's
    filename and directly appending it to the main archive.
---
 lib/RBM.pm | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/RBM.pm b/lib/RBM.pm
index f987130..8875a7c 100644
--- a/lib/RBM.pm
+++ b/lib/RBM.pm
@@ -557,13 +557,9 @@ sub maketar {
             ($stdout, $stderr, $success, $exit_code)
                 = capture_exec('git', 'submodule', 'foreach',
                     "git archive --prefix=$project-$version/\$path/"
-                    . " --output=$tmpdir/submodule-\$name.tar \$sha1");
+                    . " --output=$tmpdir/submodule.tar \$sha1;"
+                    . "tar -Af \"$dest_dir/$tar_file\" $tmpdir/submodule.tar");
             exit_error 'Error running git archive on submodules.' unless $success;
-            foreach my $file (sort glob "$tmpdir/*.tar") {
-                ($stdout, $stderr, $success, $exit_code)
-                   = capture_exec('tar', '-Af', "$dest_dir/$tar_file", $file);
-                exit_error "Error appending submodule tar:\n$stderr" unless $success;
-            }
         }
     } else {
         system('hg', 'archive', '-r', $commit_hash, '-t', 'tar',



More information about the tor-commits mailing list