control: tags -1 patch

hello, I'm attaching something that might be considered as a patch, the problem 
was not in the checkout itself, but more in the version log.

--- a/lib/Devscripts/Uscan/git.pm       2023-04-03 01:03:04.000000000 +0200
+++ b/lib/Devscripts/Uscan/git.pm       2024-01-10 09:25:20.808129993 +0100
@@ -83,18 +83,37 @@ sub git_search {
         } else {
             my $tmp = $ENV{TZ};
             $ENV{TZ} = 'UTC';
-            spawn(
-                exec => [
-                    'git',
-"--git-dir=$self->{downloader}->{destdir}/$self->{gitrepo_dir}",
-                    'log',
-                    '-1',
-                    "--date=format-local:$self->{date}",
-                    "--pretty=$self->{pretty}"
-                ],
-                wait_child => 1,
-                to_string  => \$newversion
-            );
+            $newfile = $self->parse_result->{filepattern}; # HEAD or 
heads/<branch>
+            if ($self->parse_result->{filepattern} eq 'HEAD') {
+                spawn(
+                    exec => [
+                        'git',
+    "--git-dir=$self->{downloader}->{destdir}/$self->{gitrepo_dir}",
+                        'log',
+                        '-1',
+                        "--date=format-local:$self->{date}",
+                        "--pretty=$self->{pretty}"
+                    ],
+                    wait_child => 1,
+                    to_string  => \$newversion
+                );
+           } else {
+                $newfile =~ s&^heads/&&;    # Set to <branch>
+                spawn(
+                    exec => [
+                        'git',
+    "--git-dir=$self->{downloader}->{destdir}/$self->{gitrepo_dir}",
+                        'log',
+                        '-1',
+                        '-b',
+                        "$newfile",
+                        "--date=format-local:$self->{date}",
+                        "--pretty=$self->{pretty}"
+                    ],
+                    wait_child => 1,
+                    to_string  => \$newversion
+                );
+           }
             $ENV{TZ} = $tmp;
             chomp($newversion);
         }

On Mon, 19 Jun 2023 17:40:46 +0200 Fab Stz <fabstz...@yahoo.fr> wrote:
Hello,

I'm facing this too.

```d/watch
version=4
options=uversionmangle=s/-?([^\d.]+)/~$1/;tr/A-Z/a-z/,\
mode=git,gitmode=full,gitexport=all \
https://github.com/bcit-ci/CodeIgniter \
heads/master
```

Upstream's main branch is "develop". uscan takes this one instead of the requested "master" branch

```$ uscan --debug --safe
uscan info: uscan (version 2.23.4) See uscan(1) for help
uscan info: Scan watch files in .
uscan debug: Found ./debian
uscan info: Check debian/watch and debian/changelog in .
uscan info: package="php-codeigniter-framework" version="0.0~git20230407.63d037565-1" (as seen in debian/changelog) uscan info: package="php-codeigniter-framework" version="0.0~git20230407.63d037565" (no epoch/revision) uscan info: ./debian/changelog sets package="php-codeigniter-framework" version="0.0~git20230407.63d037565"
uscan info: Process watch file at: debian/watch
    package = php-codeigniter-framework
    version = 0.0~git20230407.63d037565
    pkg_dir = .
uscan debug: parse line options=uversionmangle=s/-?([^\d.]+)/~$1/;tr/A-Z/a-
z/,mode=git,gitmode=full,gitexport=all https://github.com/bcit-ci/CodeIgniter heads/master
uscan info: opts: uversionmangle=s/-?([^\d.]+)/~$1/;tr/A-Z/a-
z/,mode=git,gitmode=full,gitexport=all
uscan info: line: https://github.com/bcit-ci/CodeIgniter heads/master
uscan info: Parsing uversionmangle=s/-?([^\d.]+)/~$1/;tr/A-Z/a-z/
uscan info: Parsing mode=git
uscan info: Parsing gitmode=full
uscan info: Parsing gitexport=all
uscan info: line: https://github.com/bcit-ci/CodeIgniter heads/master
uscan debug: $self->{'pgpmode'}=default, $self->{'pgpsigurlmangle'}=undef
uscan info: Last orig.tar.* tarball version (from debian/changelog): 0.0~git20230407.63d037565 uscan info: Last orig.tar.* tarball version (dversionmangled): 0.0~git20230407.63d037565
uscan debug: watch file has:
    $base        = https://github.com/bcit-ci/CodeIgniter
    $filepattern = heads/master
    $lastversion = 0.0~git20230407.63d037565
$action = mode = git
    pgpmode      = default
    versionmode  = newer
    $site        = https://github.com/bcit-ci/CodeIgniter
$basedir = uscan debug: line: search()
uscan debug: Execute: git clone --quiet --bare https://github.com/bcit-ci/
CodeIgniter ../php-codeigniter-framework-temporary.2454317.git...
uscan info: Looking at $base = https://github.com/bcit-ci/CodeIgniter with
--- ./lib/Devscripts/Uscan/git.pm       2023-04-03 01:03:04.000000000 +0200
+++ ./git.pm    2024-01-10 09:25:20.808129993 +0100
@@ -83,18 +83,37 @@ sub git_search {
         } else {
             my $tmp = $ENV{TZ};
             $ENV{TZ} = 'UTC';
-            spawn(
-                exec => [
-                    'git',
-"--git-dir=$self->{downloader}->{destdir}/$self->{gitrepo_dir}",
-                    'log',
-                    '-1',
-                    "--date=format-local:$self->{date}",
-                    "--pretty=$self->{pretty}"
-                ],
-                wait_child => 1,
-                to_string  => \$newversion
-            );
+            $newfile = $self->parse_result->{filepattern}; # HEAD or 
heads/<branch>
+            if ($self->parse_result->{filepattern} eq 'HEAD') {
+                spawn(
+                    exec => [
+                        'git',
+    "--git-dir=$self->{downloader}->{destdir}/$self->{gitrepo_dir}",
+                        'log',
+                        '-1',
+                        "--date=format-local:$self->{date}",
+                        "--pretty=$self->{pretty}"
+                    ],
+                    wait_child => 1,
+                    to_string  => \$newversion
+                );
+           } else {
+                $newfile =~ s&^heads/&&;    # Set to <branch>
+                spawn(
+                    exec => [
+                        'git',
+    "--git-dir=$self->{downloader}->{destdir}/$self->{gitrepo_dir}",
+                        'log',
+                        '-1',
+                        '-b',
+                        "$newfile",
+                        "--date=format-local:$self->{date}",
+                        "--pretty=$self->{pretty}"
+                    ],
+                    wait_child => 1,
+                    to_string  => \$newversion
+                );
+           }
             $ENV{TZ} = $tmp;
             chomp($newversion);
         }

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to