From 47861ac654dfe4a9b9ddb698b97e806ae42bd1ad Mon Sep 17 00:00:00 2001
From: Dimitris Lampridis <dimitris.lampridis@cern.ch>
Date: Thu, 10 Jan 2019 10:47:15 +0100
Subject: [PATCH] tools/sdb_desc_gen.tcl: try to figure out remote url when
 remote name is not "origin"

---
 tools/sdb_desc_gen.tcl | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/sdb_desc_gen.tcl b/tools/sdb_desc_gen.tcl
index 96721ff1..88a35c77 100644
--- a/tools/sdb_desc_gen.tcl
+++ b/tools/sdb_desc_gen.tcl
@@ -120,8 +120,17 @@ if { [catch { set inf_user [exec git config --get user.name] }] } {
 if { [catch { set inf_commit_id [exec git log -1 --format=%H] }] } {
     set inf_commit_id "unknown commit"
 }
-if { [catch { set inf_repo_url [exec git config --get remote.origin.url] }] } {
-    set inf_repo_url "unknown url"
+
+if { [catch { set branch_name [exec git rev-parse --abbrev-ref HEAD] }] } {
+    set branch_name "unknown branch"
+}
+
+if { [catch { set remote_name [exec git config --get branch.$branch_name.remote] }] } {
+    set remote_name "unknown remote"
+}
+
+if { [catch { set inf_repo_url [exec git config --get remote.$remote_name.url] }] } {
+    set inf_repo_url "unknown url (possibly built from a local commit/branch)"
 }
 if { [catch { set dirty_repo [exec git describe --all --dirty | grep -c dirty] }] } {
     set dirty_repo "0"
-- 
GitLab