From c092238370e0437eb95722f28c79273244dc7f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Sun, 30 Sep 2018 16:13:45 -0700 Subject: [PATCH] Improve error reporting and recovery (#183) --- src/Common/CommonResources.resx | 3 + src/Common/GetSourceLinkUrlGitTask.cs | 7 +++ src/Common/xlf/CommonResources.cs.xlf | 5 ++ src/Common/xlf/CommonResources.de.xlf | 5 ++ src/Common/xlf/CommonResources.es.xlf | 5 ++ src/Common/xlf/CommonResources.fr.xlf | 5 ++ src/Common/xlf/CommonResources.it.xlf | 5 ++ src/Common/xlf/CommonResources.ja.xlf | 5 ++ src/Common/xlf/CommonResources.ko.xlf | 5 ++ src/Common/xlf/CommonResources.pl.xlf | 5 ++ src/Common/xlf/CommonResources.pt-BR.xlf | 5 ++ src/Common/xlf/CommonResources.ru.xlf | 5 ++ src/Common/xlf/CommonResources.tr.xlf | 5 ++ src/Common/xlf/CommonResources.zh-Hans.xlf | 5 ++ src/Common/xlf/CommonResources.zh-Hant.xlf | 5 ++ .../GitOperations.cs | 20 ++++-- .../RepositoryTasks.cs | 31 ++++++++-- .../GitOperationsTests.cs | 62 ++++++++++--------- .../LocateRepository.cs | 18 +----- .../RepositoryTask.cs | 1 - src/Microsoft.Build.Tasks.Git/Resources.resx | 12 +++- .../xlf/Resources.cs.xlf | 16 ++++- .../xlf/Resources.de.xlf | 16 ++++- .../xlf/Resources.es.xlf | 16 ++++- .../xlf/Resources.fr.xlf | 16 ++++- .../xlf/Resources.it.xlf | 16 ++++- .../xlf/Resources.ja.xlf | 16 ++++- .../xlf/Resources.ko.xlf | 16 ++++- .../xlf/Resources.pl.xlf | 16 ++++- .../xlf/Resources.pt-BR.xlf | 16 ++++- .../xlf/Resources.ru.xlf | 16 ++++- .../xlf/Resources.tr.xlf | 16 ++++- .../xlf/Resources.zh-Hans.xlf | 16 ++++- .../xlf/Resources.zh-Hant.xlf | 16 ++++- .../GenerateSourceLinkFileTests.cs | 5 +- .../GetSourceLinkUrlTests.cs | 21 ++++++- .../GenerateSourceLinkFile.cs | 12 +--- src/SourceLink.Common/Resources.resx | 4 +- src/SourceLink.Common/xlf/Resources.cs.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.de.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.es.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.fr.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.it.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.ja.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.ko.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.pl.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.pt-BR.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.ru.xlf | 10 +-- src/SourceLink.Common/xlf/Resources.tr.xlf | 10 +-- .../xlf/Resources.zh-Hans.xlf | 10 +-- .../xlf/Resources.zh-Hant.xlf | 10 +-- .../GitHubTests.cs | 9 ++- 52 files changed, 428 insertions(+), 180 deletions(-) diff --git a/src/Common/CommonResources.resx b/src/Common/CommonResources.resx index 9f8f4b84..876d8353 100644 --- a/src/Common/CommonResources.resx +++ b/src/Common/CommonResources.resx @@ -138,4 +138,7 @@ {0} item group is empty. At least one {1} repository host is required in order to generate SourceLink. + + Unable to determine repository url, the source code won't be available via source link. + \ No newline at end of file diff --git a/src/Common/GetSourceLinkUrlGitTask.cs b/src/Common/GetSourceLinkUrlGitTask.cs index 9c9b6b53..19a48049 100644 --- a/src/Common/GetSourceLinkUrlGitTask.cs +++ b/src/Common/GetSourceLinkUrlGitTask.cs @@ -71,6 +71,13 @@ private void ExecuteImpl() } var gitUrl = SourceRoot.GetMetadata(Names.SourceRoot.RepositoryUrl); + if (string.IsNullOrEmpty(gitUrl)) + { + SourceLinkUrl = NotApplicableValue; + Log.LogWarning(CommonResources.UnableToDetermineRepositoryUrl); + return; + } + if (!Uri.TryCreate(gitUrl, UriKind.Absolute, out var gitUri)) { Log.LogError(CommonResources.ValueOfWithIdentityIsInvalid, Names.SourceRoot.RepositoryUrlFullName, SourceRoot.ItemSpec, gitUrl); diff --git a/src/Common/xlf/CommonResources.cs.xlf b/src/Common/xlf/CommonResources.cs.xlf index 3365195d..7974cff8 100644 --- a/src/Common/xlf/CommonResources.cs.xlf +++ b/src/Common/xlf/CommonResources.cs.xlf @@ -12,6 +12,11 @@ Položka {0} ve skupině položek {1} musí uvádět metadata {2}. + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' Hodnota {0} s identitou {1} je neplatná: {2} diff --git a/src/Common/xlf/CommonResources.de.xlf b/src/Common/xlf/CommonResources.de.xlf index 6b7b5a3f..08696798 100644 --- a/src/Common/xlf/CommonResources.de.xlf +++ b/src/Common/xlf/CommonResources.de.xlf @@ -12,6 +12,11 @@ Das Element "{0}" der Elementgruppe "{1}" muss die Metadaten "{2}" angeben. + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' Der Wert von "{0}" mit der Identität "{1}" ist ungültig: "{2}" diff --git a/src/Common/xlf/CommonResources.es.xlf b/src/Common/xlf/CommonResources.es.xlf index 9d90a6ab..0d602d2a 100644 --- a/src/Common/xlf/CommonResources.es.xlf +++ b/src/Common/xlf/CommonResources.es.xlf @@ -12,6 +12,11 @@ El elemento "{0}" del grupo de elementos "{1}" debe especificar los metadatos "{2}" + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' El valor de {0} con la identidad "{1}" no es válido: "{2}" diff --git a/src/Common/xlf/CommonResources.fr.xlf b/src/Common/xlf/CommonResources.fr.xlf index 98f27200..3608a4f7 100644 --- a/src/Common/xlf/CommonResources.fr.xlf +++ b/src/Common/xlf/CommonResources.fr.xlf @@ -12,6 +12,11 @@ L'élément '{0}' du groupe d'éléments '{1}' doit spécifier les métadonnées '{2}' + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' La valeur de {0} avec l'identité '{1}' n’est pas valide : '{2}' diff --git a/src/Common/xlf/CommonResources.it.xlf b/src/Common/xlf/CommonResources.it.xlf index 2bbdc15b..260326e8 100644 --- a/src/Common/xlf/CommonResources.it.xlf +++ b/src/Common/xlf/CommonResources.it.xlf @@ -12,6 +12,11 @@ L'elemento '{0}' del gruppo di elementi '{1}' deve specificare i metadati '{2}' + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' Il valore di {0} con identità '{1}' non è valido: '{2}' diff --git a/src/Common/xlf/CommonResources.ja.xlf b/src/Common/xlf/CommonResources.ja.xlf index cd3943fc..43dbbf5d 100644 --- a/src/Common/xlf/CommonResources.ja.xlf +++ b/src/Common/xlf/CommonResources.ja.xlf @@ -12,6 +12,11 @@ 項目グループ '{1}' の項目 '{0}' には、メタデータ '{2}' を指定する必要があります + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' ID '{1}' の {0} の値が無効です: '{2}' diff --git a/src/Common/xlf/CommonResources.ko.xlf b/src/Common/xlf/CommonResources.ko.xlf index 87a4f584..4c871846 100644 --- a/src/Common/xlf/CommonResources.ko.xlf +++ b/src/Common/xlf/CommonResources.ko.xlf @@ -12,6 +12,11 @@ 항목 그룹 '{1}'의 '{0}' 항목은 '{2}' 메타데이터를 지정해야 합니다. + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' ID가 '{1}'인 {0}의 값은 잘못되었습니다. '{2}' diff --git a/src/Common/xlf/CommonResources.pl.xlf b/src/Common/xlf/CommonResources.pl.xlf index 9206e871..f2a5cc2a 100644 --- a/src/Common/xlf/CommonResources.pl.xlf +++ b/src/Common/xlf/CommonResources.pl.xlf @@ -12,6 +12,11 @@ Element „{0}” grupy elementów „{1}” musi określać metadane „{2}”. + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' Wartość {0} z tożsamością „{1}” jest nieprawidłowa: „{2}” diff --git a/src/Common/xlf/CommonResources.pt-BR.xlf b/src/Common/xlf/CommonResources.pt-BR.xlf index e7d16a59..507ae5df 100644 --- a/src/Common/xlf/CommonResources.pt-BR.xlf +++ b/src/Common/xlf/CommonResources.pt-BR.xlf @@ -12,6 +12,11 @@ Item '{0}' do grupo de item '{1}' deve especificar metadados '{2}' + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' O valor de {0} com identidade '{1}' é inválido: '{2}' diff --git a/src/Common/xlf/CommonResources.ru.xlf b/src/Common/xlf/CommonResources.ru.xlf index 99203c47..baa8e9d4 100644 --- a/src/Common/xlf/CommonResources.ru.xlf +++ b/src/Common/xlf/CommonResources.ru.xlf @@ -12,6 +12,11 @@ Необходимо указать метаданные '{2}' для элемента '{0}' в группе элементов '{1}' + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' Значение {0} с идентификатором '{1}' является недопустимым: '{2}' diff --git a/src/Common/xlf/CommonResources.tr.xlf b/src/Common/xlf/CommonResources.tr.xlf index ef30d98c..d4cd113a 100644 --- a/src/Common/xlf/CommonResources.tr.xlf +++ b/src/Common/xlf/CommonResources.tr.xlf @@ -12,6 +12,11 @@ '{1}' öğe grubunun '{0}' öğesi, '{2}' meta verilerini belirtmelidir + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' {1} kimliğine sahip {0} değeri geçerli değil: '{2}' diff --git a/src/Common/xlf/CommonResources.zh-Hans.xlf b/src/Common/xlf/CommonResources.zh-Hans.xlf index 39f2d5a9..0c846c7c 100644 --- a/src/Common/xlf/CommonResources.zh-Hans.xlf +++ b/src/Common/xlf/CommonResources.zh-Hans.xlf @@ -12,6 +12,11 @@ 项组 "{1}" 的项 "{0}" 必须指定元数据 "{2}" + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' 具有标识 "{1}" 的 {0} 的值无效: "{2}" diff --git a/src/Common/xlf/CommonResources.zh-Hant.xlf b/src/Common/xlf/CommonResources.zh-Hant.xlf index 9a468c9e..a1c3b5d3 100644 --- a/src/Common/xlf/CommonResources.zh-Hant.xlf +++ b/src/Common/xlf/CommonResources.zh-Hant.xlf @@ -12,6 +12,11 @@ 項目群組 '{1}' 的項目 '{0}' 必須指定中繼資料 '{2}' + + Unable to determine repository url, the source code won't be available via source link. + Unable to determine repository url, the source code won't be available via source link. + + The value of {0} with identity '{1}' is invalid: '{2}' 識別碼為 '{1}' 的 {0} 值無效: '{2}' diff --git a/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs b/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs index 4624b0cf..df479681 100644 --- a/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs +++ b/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using LibGit2Sharp; using Microsoft.Build.Framework; using Microsoft.Build.Tasks.SourceControl; @@ -16,6 +17,7 @@ internal static class GitOperations { private const string SourceControlName = "git"; + [MethodImpl(MethodImplOptions.NoInlining)] public static string LocateRepository(string directory) { // Repository.Discover returns the path to .git directory for repositories with a working directory. @@ -24,16 +26,23 @@ public static string LocateRepository(string directory) return Repository.Discover(directory); } - public static string GetRepositoryUrl(IRepository repository, string remoteName = null) + public static string GetRepositoryUrl(IRepository repository, Action logWarning = null, string remoteName = null) { var remotes = repository.Network.Remotes; var remote = string.IsNullOrEmpty(remoteName) ? (remotes["origin"] ?? remotes.FirstOrDefault()) : remotes[remoteName]; if (remote == null) { + logWarning?.Invoke(Resources.RepositoryHasNoRemote, Array.Empty()); return null; } - return NormalizeUrl(remote.Url, repository.Info.WorkingDirectory); + var url = NormalizeUrl(remote.Url, repository.Info.WorkingDirectory); + if (url == null) + { + logWarning?.Invoke(Resources.InvalidRepositoryRemoteUrl, new[] { remote.Name, remote.Url }); + } + + return url; } internal static string NormalizeUrl(string url, string root) @@ -140,15 +149,18 @@ public static ITaskItem[] GetSourceRoots(IRepository repository, Action()); + logWarning(Resources.RepositoryHasNoCommit, Array.Empty()); } if (SubmodulesSupported(repository, fileExists)) diff --git a/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs b/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs index a6fdaefa..79469fd5 100644 --- a/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs +++ b/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs @@ -13,6 +13,12 @@ private static bool Execute(T task, Action action) { var log = task.Log; + // Unable to determine repository root, warning has already been reported. + if (string.IsNullOrEmpty(task.Root)) + { + return true; + } + Repository repo; try { @@ -26,8 +32,8 @@ private static bool Execute(T task, Action action) if (repo.Info.IsBare) { - log.LogError(Resources.BareRepositoriesNotSupported, task.Root); - return false; + log.LogWarning(Resources.BareRepositoriesNotSupported, task.Root); + return true; } using (repo) @@ -47,11 +53,26 @@ private static bool Execute(T task, Action action) public static bool LocateRepository(LocateRepository task) { - task.Id = GitOperations.LocateRepository(task.Directory); + try + { + task.Id = GitOperations.LocateRepository(task.Directory); + } + catch (Exception e) + { +#if NET461 + foreach (var message in TaskImplementation.GetLog()) + { + task.Log.LogMessage(message); + } +#endif + task.Log.LogWarningFromException(e, showStackTrace: true); + + return true; + } if (task.Id == null) { - task.Log.LogError(Resources.UnableToLocateRepository, task.Directory); + task.Log.LogWarning(Resources.UnableToLocateRepository, task.Directory); } return !task.Log.HasLoggedErrors; @@ -60,7 +81,7 @@ public static bool LocateRepository(LocateRepository task) public static bool GetRepositoryUrl(GetRepositoryUrl task) => Execute(task, (repo, t) => { - t.Url = GitOperations.GetRepositoryUrl(repo, t.RemoteName); + t.Url = GitOperations.GetRepositoryUrl(repo, t.Log.LogWarning, t.RemoteName); }); public static bool GetSourceRevisionId(GetSourceRevisionId task) => diff --git a/src/Microsoft.Build.Tasks.Git.UnitTests/GitOperationsTests.cs b/src/Microsoft.Build.Tasks.Git.UnitTests/GitOperationsTests.cs index f47e5ebb..c702f284 100644 --- a/src/Microsoft.Build.Tasks.Git.UnitTests/GitOperationsTests.cs +++ b/src/Microsoft.Build.Tasks.Git.UnitTests/GitOperationsTests.cs @@ -1,4 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -55,7 +56,26 @@ public void GetRevisionId_RepoWithCommit() public void GetRepositoryUrl_NoRemotes() { var repo = new TestRepository(workingDir: s_root, commitSha: "1111111111111111111111111111111111111111"); - Assert.Null(GitOperations.GetRepositoryUrl(repo)); + + var warnings = new List>(); + Assert.Null(GitOperations.GetRepositoryUrl(repo, (message, args) => warnings.Add(KVP(message, args)))); + AssertEx.Equal(new[] { Resources.RepositoryHasNoRemote }, warnings.Select(InspectDiagnostic)); + } + + private void ValidateGetRepositoryUrl(string workingDir, string actualUrl, string expectedUrl) + { + var testRemote = new TestRemote("origin", actualUrl); + + var repo = new TestRepository(workingDir, commitSha: "1111111111111111111111111111111111111111", + remotes: new[] { testRemote }); + + var expectedWarnings = (expectedUrl != null) ? + Array.Empty() : + new[] { string.Format(Resources.InvalidRepositoryRemoteUrl, testRemote.Name, testRemote.Url) }; + + var warnings = new List>(); + Assert.Equal(expectedUrl, GitOperations.GetRepositoryUrl(repo, (message, args) => warnings.Add(KVP(message, args)))); + AssertEx.Equal(expectedWarnings, warnings.Select(InspectDiagnostic)); } [Theory] @@ -64,25 +84,20 @@ public void GetRepositoryUrl_NoRemotes() [InlineData("http://github.com:102/org/repo")] [InlineData("ssh://user@github.com/org/repo")] [InlineData("abc://user@github.com/org/repo")] - public void GetRepositoryUrl_Agnostic1(string url) + public void GetRepositoryUrl_PlatformAgnostic1(string url) { - var repo = new TestRepository(workingDir: s_root, commitSha: "1111111111111111111111111111111111111111", - remotes: new[] { new TestRemote("origin", url) }); - - Assert.Equal(url, GitOperations.GetRepositoryUrl(repo)); + ValidateGetRepositoryUrl(s_root, url, url); } [Theory] + [InlineData("http://?", null)] [InlineData("https://github.com/org/repo/./.", "https://github.com/org/repo/")] [InlineData("ssh://github.com/org/../repo", "ssh://github.com/repo")] [InlineData("ssh://github.com/%32/repo", "ssh://github.com/2/repo")] [InlineData("ssh://github.com/%3F/repo", "ssh://github.com/%3F/repo")] - public void GetRepositoryUrl_Agnostic2(string originUrl, string expectedUrl) + public void GetRepositoryUrl_PlatformAgnostic2(string url, string expectedUrl) { - var repo = new TestRepository(workingDir: s_root, commitSha: "1111111111111111111111111111111111111111", - remotes: new[] { new TestRemote("origin", originUrl) }); - - Assert.Equal(expectedUrl, GitOperations.GetRepositoryUrl(repo)); + ValidateGetRepositoryUrl(s_root, url, expectedUrl); } [ConditionalTheory(typeof(WindowsOnly))] @@ -108,12 +123,9 @@ public void GetRepositoryUrl_Agnostic2(string originUrl, string expectedUrl) [InlineData(@".:/../../relative/path", "ssh://./relative/path")] [InlineData(@"..:/../../relative/path", "ssh://../relative/path")] [InlineData(@"@:org/repo", "file:///C:/src/a/b/@:org/repo")] - public void GetRepositoryUrl_Windows(string originUrl, string expectedUrl) + public void GetRepositoryUrl_Windows(string url, string expectedUrl) { - var repo = new TestRepository(workingDir: @"C:\src\a\b", commitSha: "1111111111111111111111111111111111111111", - remotes: new[] { new TestRemote("origin", originUrl) }); - - Assert.Equal(expectedUrl, GitOperations.GetRepositoryUrl(repo)); + ValidateGetRepositoryUrl(@"C:\src\a\b", url, expectedUrl); } [ConditionalTheory(typeof(UnixOnly))] @@ -130,12 +142,9 @@ public void GetRepositoryUrl_Windows(string originUrl, string expectedUrl) [InlineData(@".:/../../relative/path", "ssh://./relative/path")] [InlineData(@"..:/../../relative/path", "ssh://../relative/path")] [InlineData(@"@:org/repo", @"file:///usr/src/a/b/@:org/repo")] - public void GetRepositoryUrl_Unix(string originUrl, string expectedUrl) + public void GetRepositoryUrl_Unix(string url, string expectedUrl) { - var repo = new TestRepository(workingDir: "/usr/src/a/b", commitSha: "1111111111111111111111111111111111111111", - remotes: new[] { new TestRemote("origin", originUrl) }); - - Assert.Equal(expectedUrl, GitOperations.GetRepositoryUrl(repo)); + ValidateGetRepositoryUrl("/usr/src/a/b", url, expectedUrl); } [Theory] @@ -145,12 +154,9 @@ public void GetRepositoryUrl_Unix(string originUrl, string expectedUrl) [InlineData("git@github.com:org/repo", "ssh://git@github.com/org/repo")] [InlineData("@github.com:org/repo", "ssh://@github.com/org/repo")] [InlineData("http:x//y", "ssh://http/x//y")] - public void GetRepositoryUrl_ScpSyntax(string originUrl, string expectedUrl) + public void GetRepositoryUrl_ScpSyntax(string url, string expectedUrl) { - var repo = new TestRepository(workingDir: s_root, commitSha: "1111111111111111111111111111111111111111", - remotes: new[] { new TestRemote("origin", originUrl) }); - - Assert.Equal(expectedUrl, GitOperations.GetRepositoryUrl(repo)); + ValidateGetRepositoryUrl(s_root, url, expectedUrl); } [Fact] @@ -162,7 +168,7 @@ public void GetSourceRoots_RepoWithoutCommits() var items = GitOperations.GetSourceRoots(repo, (message, args) => warnings.Add(KVP(message, args)), fileExists: null); Assert.Empty(items); - AssertEx.Equal(new[] { Resources.RepositoryWithoutCommit_SourceLink }, warnings.Select(InspectDiagnostic)); + AssertEx.Equal(new[] { Resources.RepositoryHasNoCommit }, warnings.Select(InspectDiagnostic)); } [Fact] @@ -186,7 +192,7 @@ public void GetSourceRoots_RepoWithoutCommitsWithSubmodules() $@"'{s_root}{s}sub{s}2{s}' SourceControl='git' RevisionId='2222222222222222222222222222222222222222' NestedRoot='sub/2/' ContainingRoot='{s_root}{s}' ScmRepositoryUrl='http://2.com/'", }, items.Select(InspectSourceRoot)); - AssertEx.Equal(new[] { Resources.RepositoryWithoutCommit_SourceLink }, warnings.Select(InspectDiagnostic)); + AssertEx.Equal(new[] { Resources.RepositoryHasNoCommit }, warnings.Select(InspectDiagnostic)); } [Fact] diff --git a/src/Microsoft.Build.Tasks.Git/LocateRepository.cs b/src/Microsoft.Build.Tasks.Git/LocateRepository.cs index 7802ace3..d536f6bd 100644 --- a/src/Microsoft.Build.Tasks.Git/LocateRepository.cs +++ b/src/Microsoft.Build.Tasks.Git/LocateRepository.cs @@ -15,22 +15,6 @@ public class LocateRepository : Task [Output] public string Id { get; set; } - public override bool Execute() - { - try - { - return TaskImplementation.LocateRepository(this); - } - catch - { -#if NET461 - foreach (var message in TaskImplementation.GetLog()) - { - Log.LogMessage(message); - } -#endif - throw; - } - } + public override bool Execute() => TaskImplementation.LocateRepository(this); } } diff --git a/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs b/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs index 3936e11d..b5530d41 100644 --- a/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs +++ b/src/Microsoft.Build.Tasks.Git/RepositoryTask.cs @@ -7,7 +7,6 @@ namespace Microsoft.Build.Tasks.Git { public abstract class RepositoryTask : Task { - [Required] public string Root { get; set; } } } diff --git a/src/Microsoft.Build.Tasks.Git/Resources.resx b/src/Microsoft.Build.Tasks.Git/Resources.resx index a3276bf5..97751139 100644 --- a/src/Microsoft.Build.Tasks.Git/Resources.resx +++ b/src/Microsoft.Build.Tasks.Git/Resources.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Repository doesn't have any commit, the source code won't be available via source link. - Submodule '{0}' doesn't have any commit, the source code won't be available via source link. @@ -129,6 +126,15 @@ The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. + + Repository has no commit. + + + Repository has no remote. + + + The URL of repository remote '{0}' is invalid: '{1}'. + Unable to locate repository containing directory '{0}'. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.cs.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.cs.xlf index 9c67d3fb..97e887ac 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.cs.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.cs.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. Cesta dílčího modulu {0} je neplatná: {1}, zdrojový kód nebude přes zdrojový odkaz dostupný. @@ -12,9 +17,14 @@ Adresa URL dílčího modulu {0} je neplatná: {1}, zdrojový kód nebude přes zdrojový odkaz dostupný. - - Repository doesn't have any commit, the source code won't be available via source link. - Úložiště nemá žádné potvrzení, zdrojový kód nebude přes zdrojový odkaz dostupný. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + Úložiště nemá žádné potvrzení, zdrojový kód nebude přes zdrojový odkaz dostupný. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.de.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.de.xlf index 1bedb200..25e17253 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.de.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.de.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. Der Pfad von Untermodul "{0}" ist ungültig: "{1}". Der Quellcode steht nicht über den Quelllink zur Verfügung. @@ -12,9 +17,14 @@ Die URL von Untermodul "{0}" ist ungültig: "{1}". Der Quellcode steht nicht über den Quelllink zur Verfügung. - - Repository doesn't have any commit, the source code won't be available via source link. - Es liegt kein Commit für das Repository vor, der Quellcode steht nicht über den Quelllink zur Verfügung. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + Es liegt kein Commit für das Repository vor, der Quellcode steht nicht über den Quelllink zur Verfügung. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.es.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.es.xlf index 43ee95a6..a664b1ab 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.es.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.es.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. La ruta de acceso del submódulo "{0}" no es válida: "{1}", el código fuente no estará disponible mediante el vínculo de origen. @@ -12,9 +17,14 @@ La dirección URL del submódulo "{0}" no es válida: "{1}", el código fuente no estará disponible mediante el vínculo de origen. - - Repository doesn't have any commit, the source code won't be available via source link. - El repositorio no tiene ninguna confirmación, el código fuente no estará disponible mediante el vínculo de origen. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + El repositorio no tiene ninguna confirmación, el código fuente no estará disponible mediante el vínculo de origen. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.fr.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.fr.xlf index a33c1040..52093154 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.fr.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.fr.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. Le chemin du sous-module '{0}' n'est pas valide : '{1}', le code source ne sera pas disponible via le lien source. @@ -12,9 +17,14 @@ L'URL du sous-module '{0}' n'est pas valide : '{1}', le code source ne sera pas disponible via le lien source. - - Repository doesn't have any commit, the source code won't be available via source link. - Le référentiel ne présente aucune validation, le code source ne sera pas disponible via le lien source. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + Le référentiel ne présente aucune validation, le code source ne sera pas disponible via le lien source. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.it.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.it.xlf index 2f607d91..7feb2118 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.it.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.it.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. Il percorso del modulo secondario '{0}' non è valido: '{1}'. Il codice sorgente non sarà disponibile tramite il collegamento all'origine. @@ -12,9 +17,14 @@ L'URL del modulo secondario '{0}' non è valido: '{1}'. Il codice sorgente non sarà disponibile tramite il collegamento all'origine. - - Repository doesn't have any commit, the source code won't be available via source link. - Non esiste alcun commit per il repository. Il codice sorgente non sarà disponibile tramite il collegamento all'origine. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + Non esiste alcun commit per il repository. Il codice sorgente non sarà disponibile tramite il collegamento all'origine. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.ja.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.ja.xlf index d1ed6363..41459e36 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.ja.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.ja.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. サブモジュール '{0}' のパスが無効です: '{1}'。ソース リンクを使用してソース コードを使用することはできません。 @@ -12,9 +17,14 @@ サブモジュール '{0}' の URL が無効です: '{1}'。ソース リンクを使用してソース コードを使用することはできません。 - - Repository doesn't have any commit, the source code won't be available via source link. - リポジトリにコミットがありません。ソース リンクを使用してソース コードを使用することはできません。 + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + リポジトリにコミットがありません。ソース リンクを使用してソース コードを使用することはできません。 diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.ko.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.ko.xlf index 6c634ab5..651d50c5 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.ko.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.ko.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. 하위 모듈의 경로 '{0}'이(가) 잘못되었습니다. '{1}', 소스 링크를 통해 소스 코드를 사용할 수 없습니다. @@ -12,9 +17,14 @@ 하위 모듈의 URL '{0}'이(가) 잘못되었습니다. '{1}', 소스 링크를 통해 소스 코드를 사용할 수 없습니다. - - Repository doesn't have any commit, the source code won't be available via source link. - 리포지토리에 커밋이 없으며, 소스 링크를 통해 소스 코드를 사용할 수 없습니다. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + 리포지토리에 커밋이 없으며, 소스 링크를 통해 소스 코드를 사용할 수 없습니다. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.pl.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.pl.xlf index a5d02aa2..888175cf 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.pl.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.pl.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. Ścieżka modułu podrzędnego „{0}” jest nieprawidłowa: „{1}”. Kod źródłowy nie będzie dostępny za pośrednictwem linku do źródła. @@ -12,9 +17,14 @@ Adres URL modułu podrzędnego „{0}” jest nieprawidłowy: „{1}”. Kod źródłowy nie będzie dostępny za pośrednictwem linku do źródła. - - Repository doesn't have any commit, the source code won't be available via source link. - Repozytorium nie zawiera żadnego zatwierdzenia. Kod źródłowy nie będzie dostępny za pośrednictwem linku do źródła. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + Repozytorium nie zawiera żadnego zatwierdzenia. Kod źródłowy nie będzie dostępny za pośrednictwem linku do źródła. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.pt-BR.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.pt-BR.xlf index ab6f1a09..b4d11d3a 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.pt-BR.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. O caminho do submódulo '{0}' é inválido: '{1}'. O código-fonte não estará disponível por meio do link de origem. @@ -12,9 +17,14 @@ A URL do submódulo '{0}' é inválido: '{1}'. O código-fonte não estará disponível por meio do link de origem. - - Repository doesn't have any commit, the source code won't be available via source link. - O repositório não tem nenhuma confirmação. O código-fonte não estará disponível por meio do link de origem. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + O repositório não tem nenhuma confirmação. O código-fonte não estará disponível por meio do link de origem. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.ru.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.ru.xlf index a35884c4..806c1f40 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.ru.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.ru.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. Подмодуль "{0}" имеет недопустимый путь: "{1}". Исходный код по ссылке будет недоступен. @@ -12,9 +17,14 @@ Подмодуль "{0}" имеет недопустимый URL: "{1}". Исходный код по ссылке будет недоступен. - - Repository doesn't have any commit, the source code won't be available via source link. - В репозитории нет фиксаций. Исходный код по ссылке будет недоступен. + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + В репозитории нет фиксаций. Исходный код по ссылке будет недоступен. diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.tr.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.tr.xlf index 16cd36bf..4cb4a149 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.tr.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.tr.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. '{0}' alt modülünün yolu geçersiz: '{1}', kaynak koda kaynak bağlantısı aracılığıyla ulaşılamayacak. @@ -12,9 +17,14 @@ '{0}' alt modülünün URL’si geçersiz: '{1}', kaynak koda kaynak bağlantısı aracılığıyla ulaşılamayacak. - - Repository doesn't have any commit, the source code won't be available via source link. - Depoda işleme yok, kaynak koda kaynak bağlantısı aracılığıyla ulaşılamayacak + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + Depoda işleme yok, kaynak koda kaynak bağlantısı aracılığıyla ulaşılamayacak diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hans.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hans.xlf index 6c28e641..b52b5d81 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hans.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. 子模块 '{0}' 的路径无效: '{1}',不可通过源链接访问源代码。 @@ -12,9 +17,14 @@ 子模块 '{0}' 的 URL 无效: '{1}',不可通过源链接访问源代码。 - - Repository doesn't have any commit, the source code won't be available via source link. - 存储库不含任何提交,不可通过源链接访问源代码。 + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + 存储库不含任何提交,不可通过源链接访问源代码。 diff --git a/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hant.xlf b/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hant.xlf index e4095eac..f46a503d 100644 --- a/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.Build.Tasks.Git/xlf/Resources.zh-Hant.xlf @@ -2,6 +2,11 @@ + + The URL of repository remote '{0}' is invalid: '{1}'. + The URL of repository remote '{0}' is invalid: '{1}'. + + The path of submodule '{0}' is invalid: '{1}', the source code won't be available via source link. 子模組 '{0}' 的路徑無效: '{1}'。來源連結中的原始程式碼將無法使用。 @@ -12,9 +17,14 @@ 子模組 '{0}' 的 URL 無效: '{1}'。來源連結中的原始程式碼將無法使用。 - - Repository doesn't have any commit, the source code won't be available via source link. - 存放庫中不具任何認可。來源連結中的原始程式碼將無法使用。 + + Repository has no remote. + Repository has no remote. + + + + Repository has no commit. + 存放庫中不具任何認可。來源連結中的原始程式碼將無法使用。 diff --git a/src/SourceLink.Common.UnitTests/GenerateSourceLinkFileTests.cs b/src/SourceLink.Common.UnitTests/GenerateSourceLinkFileTests.cs index 560cb4c6..b0676691 100644 --- a/src/SourceLink.Common.UnitTests/GenerateSourceLinkFileTests.cs +++ b/src/SourceLink.Common.UnitTests/GenerateSourceLinkFileTests.cs @@ -26,7 +26,7 @@ public void Empty() var content = task.GenerateSourceLinkContent(); AssertEx.AssertEqualToleratingWhitespaceDifferences( - "WARNING : " + string.Format(Resources.NoItemsSpecifiedSourceLinkEmpty, "SourceRoot"), engine.Log); + "WARNING : " + string.Format(Resources.SourceControlInformationIsNotAvailableGeneratedSourceLinkEmpty), engine.Log); AssertEx.AreEqual(@"{""documents"":{}}", content); } @@ -112,7 +112,7 @@ public void Errors() BuildEngine = engine, SourceRoots = new[] { - // error: missing SourceLinkUrl in source-controlled root: + // skipped: missing SourceLinkUrl in source-controlled root: new MockItem(@"C:\src\", KVP("SourceControl", "git")), // skipped: missing SourceLinkUrl in non-source-controlled root @@ -131,7 +131,6 @@ public void Errors() var content = task.GenerateSourceLinkContent(); AssertEx.AssertEqualToleratingWhitespaceDifferences( - "ERROR : " + string.Format(Resources.IsEmpty, "SourceRoot.SourceLinkUrl", MockItem.AdjustSeparators(@"C:\src\")) + Environment.NewLine + "ERROR : " + string.Format(Resources.MustNotContainWildcard, "SourceRoot", MockItem.AdjustSeparators(@"C:\x\b\*\")) + Environment.NewLine + "ERROR : " + string.Format(Resources.MustEndWithDirectorySeparator, "SourceRoot", MockItem.AdjustSeparators(@"C:\x\c")) + Environment.NewLine + "ERROR : " + string.Format(Resources.MustContainSingleWildcard, "SourceRoot.SourceLinkUrl", "http://a/**"), engine.Log); diff --git a/src/SourceLink.Common.UnitTests/GetSourceLinkUrlTests.cs b/src/SourceLink.Common.UnitTests/GetSourceLinkUrlTests.cs index fb63ecd8..98913b6c 100644 --- a/src/SourceLink.Common.UnitTests/GetSourceLinkUrlTests.cs +++ b/src/SourceLink.Common.UnitTests/GetSourceLinkUrlTests.cs @@ -88,7 +88,6 @@ public void HostsContentUrl_Errors(string url) [Theory] [InlineData("a/b")] - [InlineData("")] [InlineData("http://")] public void RepositoryUrl_Errors(string url) { @@ -170,6 +169,26 @@ public void SourceRootNotApplicable_SourceLinkUrlSet() Assert.True(result); } + [Fact] + public void SourceRootNotApplicable_SourceLinkUrlEmpty() + { + var engine = new MockEngine(); + + var task = new MockGetSourceLinkUrlGitTask() + { + BuildEngine = engine, + SourceRoot = new MockItem("x", KVP("RepositoryUrl", ""), KVP("SourceControl", "git")), + }; + + bool result = task.Execute(); + + AssertEx.AssertEqualToleratingWhitespaceDifferences( + "WARNING : " + string.Format(CommonResources.UnableToDetermineRepositoryUrl), engine.Log); + + Assert.Equal("N/A", task.SourceLinkUrl); + Assert.True(result); + } + [Fact] public void SourceRootNotApplicable_RepositoryUrlNotMatchingHost() { diff --git a/src/SourceLink.Common/GenerateSourceLinkFile.cs b/src/SourceLink.Common/GenerateSourceLinkFile.cs index 3d579a14..90ec5612 100644 --- a/src/SourceLink.Common/GenerateSourceLinkFile.cs +++ b/src/SourceLink.Common/GenerateSourceLinkFile.cs @@ -62,14 +62,8 @@ string JsonEscape(string str) var url = root.GetMetadata(Names.SourceRoot.SourceLinkUrl); if (string.IsNullOrEmpty(url)) { - // Only report an error if the root comes from source control. - // SourceRoots can be specified by the project to make other features like deterministic paths. - if (!string.IsNullOrEmpty(root.GetMetadata(Names.SourceRoot.SourceControl))) - { - Log.LogError(Resources.IsEmpty, Names.SourceRoot.SourceLinkUrlFullName, root.ItemSpec); - success = false; - } - + // Do not report any diagnostic. If the source root comes from source control a warning has already been reported. + // SourceRoots can be specified by the project to make other features like deterministic paths, and they don't need source link URL. continue; } @@ -108,7 +102,7 @@ string JsonEscape(string str) if (first) { - Log.LogWarning(Resources.NoItemsSpecifiedSourceLinkEmpty, Names.SourceRoot.Name); + Log.LogWarning(Resources.SourceControlInformationIsNotAvailableGeneratedSourceLinkEmpty); } return result.ToString(); diff --git a/src/SourceLink.Common/Resources.resx b/src/SourceLink.Common/Resources.resx index bf3bb8d7..9bf26dfb 100644 --- a/src/SourceLink.Common/Resources.resx +++ b/src/SourceLink.Common/Resources.resx @@ -126,8 +126,8 @@ {0} must contain a single wildcard '*': '{1}'" - - No {0} items specified - the generated source link is empty. + + Source control information is not available - the generated source link is empty. {0} is empty: '{1}' diff --git a/src/SourceLink.Common/xlf/Resources.cs.xlf b/src/SourceLink.Common/xlf/Resources.cs.xlf index 08a7b1ee..d6c05367 100644 --- a/src/SourceLink.Common/xlf/Resources.cs.xlf +++ b/src/SourceLink.Common/xlf/Resources.cs.xlf @@ -17,11 +17,6 @@ {0} musí obsahovat jeden zástupný znak *: {1}" - - No {0} items specified - the generated source link is empty. - Nejsou zadané žádné položky {0}, vygenerovaný zdrojový odkaz je prázdný. - - {0} is empty: '{1}' {0} je prázdný: {1} @@ -32,6 +27,11 @@ Chyba při zápisu do zdrojového souboru propojení {0}: {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.de.xlf b/src/SourceLink.Common/xlf/Resources.de.xlf index c5e1d2f5..e400cfd1 100644 --- a/src/SourceLink.Common/xlf/Resources.de.xlf +++ b/src/SourceLink.Common/xlf/Resources.de.xlf @@ -17,11 +17,6 @@ "{0}" muss einen einzelnen Platzhalter "*" enthalten: "{1}" - - No {0} items specified - the generated source link is empty. - Keine {0}-Elemente angegeben: Der generierte Quelllink ist leer. - - {0} is empty: '{1}' "{0}" ist leer: "{1}" @@ -32,6 +27,11 @@ Fehler beim Schreiben in die Quelllinkdatei "{0}": {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.es.xlf b/src/SourceLink.Common/xlf/Resources.es.xlf index b758d1b6..b9ddef56 100644 --- a/src/SourceLink.Common/xlf/Resources.es.xlf +++ b/src/SourceLink.Common/xlf/Resources.es.xlf @@ -17,11 +17,6 @@ {0} debe contener un solo comodín '*': '{1}'" - - No {0} items specified - the generated source link is empty. - No se han especificado {0} elementos: el vínculo de origen generado está vacío. - - {0} is empty: '{1}' {0} está vacío: "{1}" @@ -32,6 +27,11 @@ Error al escribir en el archivo de vínculo de origen "{0}": {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.fr.xlf b/src/SourceLink.Common/xlf/Resources.fr.xlf index 42b76710..8d0d44a0 100644 --- a/src/SourceLink.Common/xlf/Resources.fr.xlf +++ b/src/SourceLink.Common/xlf/Resources.fr.xlf @@ -17,11 +17,6 @@ {0} doit contenir un seul caractère générique '*' : '{1}'" - - No {0} items specified - the generated source link is empty. - Aucun élément {0} spécifié - le lien source généré est vide. - - {0} is empty: '{1}' {0} est vide : '{1}' @@ -32,6 +27,11 @@ Erreur d'écriture dans le fichier de liaison source '{0}' : {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.it.xlf b/src/SourceLink.Common/xlf/Resources.it.xlf index 242a15f9..6c2a7948 100644 --- a/src/SourceLink.Common/xlf/Resources.it.xlf +++ b/src/SourceLink.Common/xlf/Resources.it.xlf @@ -17,11 +17,6 @@ {0} deve contenere un singolo carattere jolly '*': '{1}'" - - No {0} items specified - the generated source link is empty. - Non sono stati specificati elementi {0}. Il collegamento all'origine generato è vuoto. - - {0} is empty: '{1}' {0} è vuoto: '{1}' @@ -32,6 +27,11 @@ Errore di scrittura nel file del collegamento all'origine '{0}': {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.ja.xlf b/src/SourceLink.Common/xlf/Resources.ja.xlf index a0d197a8..928a258e 100644 --- a/src/SourceLink.Common/xlf/Resources.ja.xlf +++ b/src/SourceLink.Common/xlf/Resources.ja.xlf @@ -17,11 +17,6 @@ {0} には 1 つのワイルドカード '*' を含める必要があります: '{1}' - - No {0} items specified - the generated source link is empty. - {0} 項目は指定されていません - 生成されたソース リンクが空です。 - - {0} is empty: '{1}' {0} が空です: '{1}' @@ -32,6 +27,11 @@ ソース リンク ファイル '{0}' への書き込みエラー: {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.ko.xlf b/src/SourceLink.Common/xlf/Resources.ko.xlf index 3ab518da..52faceaf 100644 --- a/src/SourceLink.Common/xlf/Resources.ko.xlf +++ b/src/SourceLink.Common/xlf/Resources.ko.xlf @@ -17,11 +17,6 @@ {0}에는 단일 와일드카드 '*'가 포함되어야 합니다. '{1}'" - - No {0} items specified - the generated source link is empty. - {0}개 항목을 지정하지 않았습니다. 생성되는 소스 링크가 비어 있습니다. - - {0} is empty: '{1}' {0}이(가) 비어 있습니다. '{1}' @@ -32,6 +27,11 @@ 소스 링크 파일 '{0}'에 쓰는 동안 오류가 발생했습니다. {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.pl.xlf b/src/SourceLink.Common/xlf/Resources.pl.xlf index c3366284..4ce7d475 100644 --- a/src/SourceLink.Common/xlf/Resources.pl.xlf +++ b/src/SourceLink.Common/xlf/Resources.pl.xlf @@ -17,11 +17,6 @@ Element {0} musi zawierać jeden symbol wieloznaczny „*”: „{1}”" - - No {0} items specified - the generated source link is empty. - Nie określono elementu {0} — wygenerowany link do źródła jest pusty. - - {0} is empty: '{1}' Element {0} jest pusty: „{1}” @@ -32,6 +27,11 @@ Błąd podczas zapisywania do pliku linku źródłowego „{0}”: {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.pt-BR.xlf b/src/SourceLink.Common/xlf/Resources.pt-BR.xlf index 65230000..4d45c633 100644 --- a/src/SourceLink.Common/xlf/Resources.pt-BR.xlf +++ b/src/SourceLink.Common/xlf/Resources.pt-BR.xlf @@ -17,11 +17,6 @@ {0} precisa conter um único curinga '*': '{1}' - - No {0} items specified - the generated source link is empty. - Nenhum item {0} especificado – o link de origem gerado está vazio. - - {0} is empty: '{1}' {0} está vazio: '{1}' @@ -32,6 +27,11 @@ Erro ao gravar para o arquivo do link de origem '{0}': {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.ru.xlf b/src/SourceLink.Common/xlf/Resources.ru.xlf index a238b733..248f417c 100644 --- a/src/SourceLink.Common/xlf/Resources.ru.xlf +++ b/src/SourceLink.Common/xlf/Resources.ru.xlf @@ -17,11 +17,6 @@ В {0} должен быть один подстановочный знак "*": "{1}" - - No {0} items specified - the generated source link is empty. - Элементы {0} не указаны — созданная ссылка на источник пуста. - - {0} is empty: '{1}' В {0} пусто: "{1}" @@ -32,6 +27,11 @@ Ошибка при записи в исходный файл ссылок '{0}': {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.tr.xlf b/src/SourceLink.Common/xlf/Resources.tr.xlf index c3c7ae70..807c2436 100644 --- a/src/SourceLink.Common/xlf/Resources.tr.xlf +++ b/src/SourceLink.Common/xlf/Resources.tr.xlf @@ -17,11 +17,6 @@ {0} tek bir '*' joker karakterini içermelidir: '{1}' - - No {0} items specified - the generated source link is empty. - {0} öğesi belirtilmedi. Oluşturulan kaynak bağlantısı boş. - - {0} is empty: '{1}' {0} boş: '{1}' @@ -32,6 +27,11 @@ '{0}' kaynak bağlantı dosyasına yazılırken bir hata oluştu: {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.zh-Hans.xlf b/src/SourceLink.Common/xlf/Resources.zh-Hans.xlf index 6f90a5b8..e688c538 100644 --- a/src/SourceLink.Common/xlf/Resources.zh-Hans.xlf +++ b/src/SourceLink.Common/xlf/Resources.zh-Hans.xlf @@ -17,11 +17,6 @@ {0} 必须包含单个通配符 '*': '{1}' - - No {0} items specified - the generated source link is empty. - 未指定 {0} 项目 - 生成的源链接为空。 - - {0} is empty: '{1}' {0}为空: '{1}' @@ -32,6 +27,11 @@ 写入源链接文件 "{0}" 时出错: {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Common/xlf/Resources.zh-Hant.xlf b/src/SourceLink.Common/xlf/Resources.zh-Hant.xlf index b8be4a53..1b186f27 100644 --- a/src/SourceLink.Common/xlf/Resources.zh-Hant.xlf +++ b/src/SourceLink.Common/xlf/Resources.zh-Hant.xlf @@ -17,11 +17,6 @@ {0} 必須包含一個萬用字元 '*': '{1}'" - - No {0} items specified - the generated source link is empty. - 未指定任何 {0} 項目 - 產生的來源連結是空的。 - - {0} is empty: '{1}' {0} 是空的: '{1}' @@ -32,6 +27,11 @@ 寫入來源連結檔案 '{0}' 時發生錯誤: {1} + + Source control information is not available - the generated source link is empty. + Source control information is not available - the generated source link is empty. + + \ No newline at end of file diff --git a/src/SourceLink.Git.IntegrationTests/GitHubTests.cs b/src/SourceLink.Git.IntegrationTests/GitHubTests.cs index 8047038d..88609f2a 100644 --- a/src/SourceLink.Git.IntegrationTests/GitHubTests.cs +++ b/src/SourceLink.Git.IntegrationTests/GitHubTests.cs @@ -40,11 +40,14 @@ public void EmptyRepository() }, expectedWarnings: new[] { - // Repository doesn't have any commit, the source code won't be available via source link. - string.Format(Build.Tasks.Git.Resources.RepositoryWithoutCommit_SourceLink), + // Repository has no remote. + string.Format(Build.Tasks.Git.Resources.RepositoryHasNoRemote), + + // Repository doesn't have any commit. + string.Format(Build.Tasks.Git.Resources.RepositoryHasNoCommit), // No SourceRoot items specified - the generated source link is empty. - string.Format(Common.Resources.NoItemsSpecifiedSourceLinkEmpty, "SourceRoot"), + string.Format(Common.Resources.SourceControlInformationIsNotAvailableGeneratedSourceLinkEmpty), }); }