From f48c2ac76bce4f1cc3f639d9a59035efa9d51927 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Mon, 22 Mar 2021 15:38:45 +0100 Subject: [PATCH] Use remote of local branch for publishing (#712) --- src/alire/alire-publish.adb | 5 ++++- src/alire/alire-vcss-git.adb | 22 +++++++++++++++++++--- src/alire/alire-vcss-git.ads | 8 ++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/alire/alire-publish.adb b/src/alire/alire-publish.adb index 8953c353..32889714 100644 --- a/src/alire/alire-publish.adb +++ b/src/alire/alire-publish.adb @@ -953,7 +953,10 @@ package body Alire.Publish is declare use Utils; - Raw_URL : constant String := Git.Fetch_URL (Root_Path); + Raw_URL : constant String := + Git.Fetch_URL + (Root_Path, + Origin => Git.Remote (Root_Path)); -- The one reported by the repo, in its public form Fetch_URL : constant String := diff --git a/src/alire/alire-vcss-git.adb b/src/alire/alire-vcss-git.adb index 4363d949..5605f939 100644 --- a/src/alire/alire-vcss-git.adb +++ b/src/alire/alire-vcss-git.adb @@ -67,12 +67,28 @@ package body Alire.VCSs.Git is From : URL; Into : Directory_Path) return Outcome + is (This.Clone (From, Into, Branch => "")); + + ----------- + -- Clone -- + ----------- + + not overriding + function Clone (This : VCS; + From : URL; + Into : Directory_Path; + Branch : String) + return Outcome is pragma Unreferenced (This); Extra : constant String_Vector := - Empty_Vector & (if Log_Level < Trace.Info - then "-q" - else "--progress"); + Empty_Vector + & (if Log_Level < Trace.Info + then "-q" + else "--progress") + & (if Branch /= "" + then Empty_Vector & "--branch" & Branch + else Empty_Vector); begin Trace.Detail ("Checking out [git]: " & From); diff --git a/src/alire/alire-vcss-git.ads b/src/alire/alire-vcss-git.ads index 59390e8b..b7021597 100644 --- a/src/alire/alire-vcss-git.ads +++ b/src/alire/alire-vcss-git.ads @@ -21,6 +21,14 @@ package Alire.VCSs.Git is Into : Directory_Path) return Outcome; + not overriding + function Clone (This : VCS; + From : URL; + Into : Directory_Path; + Branch : String) + return Outcome; + -- Specify a branch to check out after cloning + not overriding function Revision_Commit (This : VCS; Repo : Directory_Path; -- 2.39.5