🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #7027

Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote

#7027
From: Agustin Martin
Date: Tue, 01 Dec 2026 16:40
103 lines
6288 bytes
--D1NNyyKw5nvwsHNl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Control: tags -1 + patch

On Thu, Nov 12, 2026 at 12:32:44PM +0900, Simon Richter wrote:
> Hi,
> 
> On 11/12/26 8:12 AM, Agustin Martin wrote:
> 
> The problem seems to be that uscan tries to avoid using the working
> directory, except during submodule handling, where it uses whatever is
> currently checked out (so if upstream changes the list of submodules, that
> is ignored as well).
> 
> > So, seems that intially submodules were not declared as submodules, but
> > present in the repo. This did not happen when using upstream git repo (what
> > happens when there is no remote defined). If I now add the remote and run
> > "uscan --download-current-version" created upstream tarball contains
> > tests/ contents, but not the contents for other submodules.
> Yes, because now tests/ is a submodule in the current working directory --
> but that is local state influencing the output of uscan, when all we want is
> to use the cached objects -- and what's probably worse, uscan also changes
> local state by attempting to deinitialize and reinitialize the submodules.

Hi, Simon,

Seems you are completely right. With all the above info I think that the
sensible choice is to always use a cloned git repo if submodules are
requested in debian/watch. As you say, even in the best case local state
will be changed.

I have done some approaches and I am attaching a patch with the approach
that seems to be working with plain uscan and makes devscripts build tests
succeed.

What do you think?

Regards,

-- 
Agustin

--D1NNyyKw5nvwsHNl
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename=0001-uscan-Git.pm-Clone-git-repo-if-submodules-are-reques.patch

From 69c84a5ebee965f338a8c1c19ff7b9a068a837c5 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <agmartin@debian.org>
Date: Tue, 1 Dec 2026 14:56:50 +0100
Subject: [PATCH] uscan::Git.pm: Clone git repo if submodules are requested,
 even with remote.

Otherwise changes in local state are required to properly handle
submodules together with a remote.

Closes: #1145549

Signed-off-by: Agustin Martin Domingo <agmartin@debian.org>
---
 lib/Devscripts/Uscan/Modes/Git.pm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/Devscripts/Uscan/Modes/Git.pm b/lib/Devscripts/Uscan/Modes/Git.pm
index 451ebd79..21245eb8 100644
--- a/lib/Devscripts/Uscan/Modes/Git.pm
+++ b/lib/Devscripts/Uscan/Modes/Git.pm
@@ -29,11 +29,15 @@ sub git_search {
           . "========\n";
 
         # Check whether any remote repository URLs match debian/watch Source
-        if ($out and $out =~ /^(\S+)\s+\Q$self->{parse_result}->{base}\E/m) {
+        # and no submodules are requested (will clone git repo otherwise)
+        if (    $out
+            and $out =~ /^(\S+)\s+\Q$self->{parse_result}->{base}\E/m
+            and not $self->git->{modules}) {
             my $remote = $1;
             $self->downloader->git_upstream($remote);
             uscan_verbose join ' ',
-              "'$self->{parse_result}->{base}' matches debian/watch;",
+              "'$self->{parse_result}->{base}' matches debian/watch",
+              "and no submodules requested;",
               "using remote '$remote'";
 
             # Run `git fetch` to update the repository
@@ -46,6 +50,10 @@ sub git_search {
             );
 
             $newfile = "$remote/HEAD" if $self->versionless;
+        } else {
+            uscan_verbose join ' ',
+              "Submodules requested or no match for remote;",
+              "not using remote";
         }
     }
 
-- 
2.55.0


--D1NNyyKw5nvwsHNl--
Technical Details
Message-ID: <O5z3z-fmZk-11@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
References: <Nw1g5-dc1o-15@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NA2Qi-fnN2-23@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NO4pb-5rsB-15@gated-at.bofh.it> <NYpLH-bjAF-1@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NYtPk-blRW-9@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NYtPk-blRW-9@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
From: Agustin Martin <agmartin@debian.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1145549: fails to download submodules if run from git checkout and upstream is configured as remote
Date: Tue, 01 Dec 2026 17:40:01 +0100
Message-ID: <O5z3z-fmZk-11@gated-at.bofh.it>
References: <Nw1g5-dc1o-15@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NA2Qi-fnN2-23@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NO4pb-5rsB-15@gated-at.bofh.it> <NYpLH-bjAF-1@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NYtPk-blRW-9@gated-at.bofh.it> <Nw1g5-dc1o-15@gated-at.bofh.it> <NYtPk-blRW-9@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Tue Dec  1 16:33:11 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Agustin Martin <agmartin@debian.org>, 1145549@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: devscripts@packages.debian.org
X-Debian-Pr-Message: followup 1145549
X-Debian-Pr-Package: devscripts
X-Debian-Pr-Source: devscripts
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="D1NNyyKw5nvwsHNl"
Content-Disposition: inline
X-Debian-User: agmartin
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2006332
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 103
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: Hugh McMaster <hmc@debian.org>
X-Original-Date: Tue, 1 Dec 2026 17:30:32 +0100
X-Original-Message-ID: <aw72KJqLfjIyCy4F@lenovo-sid.aq.upm.es>
X-Original-References: <178767150187.15208.1608292962938188952.reportbug@lime.hogyros.de> <178767150187.15208.1608292962938188952.reportbug@lime.hogyros.de> <apxXj2N9z25BgYKI@lenovo-sid.aq.upm.es> <178767150187.15208.1608292962938188952.reportbug@lime.hogyros.de> <as9XMjxEAvzLPMt1@lenovo-sid.aq.upm.es> <avT2ZCp6JjLeY2cS@lenovo-sid.aq.upm.es> <178767150187.15208.1608292962938188952.reportbug@lime.hogyros.de> <dc404f34-c781-47d3-a54f-147a3e62f696@debian.org> <178767150187.15208.1608292962938188952.reportbug@lime.hogyros.de> <dc404f34-c781-47d3-a54f-147a3e62f696@debian.org>