From 1dad57d47614546240061fd942d1ff8e6e54eb64 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 28 Jul 2021 15:16:30 +0100 Subject: Handle git remotes that aren't called origin in _repository_name() I was seeing `error: No such remote 'origin'` in the cmake output. This commit avoids hardcoding `origin` as the upstream URL and instead uses the `git rev-parse @{u}` to get the configured upstream. As a follow-up we may want to check if this should be executed by default, but for now this fixes a warning that I'm seeing with various projects. --- toolchain/generate-fastlane-metadata.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toolchain/generate-fastlane-metadata.py') diff --git a/toolchain/generate-fastlane-metadata.py b/toolchain/generate-fastlane-metadata.py index f39acc3a..642a76d3 100755 --- a/toolchain/generate-fastlane-metadata.py +++ b/toolchain/generate-fastlane-metadata.py @@ -339,7 +339,9 @@ def processAppstreamFile(appstreamFileName, desktopFileName, iconBaseName): # Try to figure out the source repository if arguments.source and os.path.exists(os.path.join(arguments.source, '.git')): - output = subprocess.check_output('git remote show -n origin', shell=True, cwd = arguments.source).decode('utf-8') + upstream_ref = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'], cwd=arguments.source).decode('utf-8') + remote = upstream_ref.split('/')[2] + output = subprocess.check_output(['git', 'remote', 'show', '-n', remote], cwd=arguments.source).decode('utf-8') result = re.search(' Fetch URL: (.*)\n', output) data['source-repo'] = result.group(1) -- cgit v1.2.1