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
>From 69c84a5ebee965f338a8c1c19ff7b9a068a837c5 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
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 <[email protected]>
---
 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

Reply via email to