小编MrH*_*Man的帖子

在带有 github 推送事件的代码构建中,git show -s 错误消息致命:无法解析提交 <sha>

当我收到来自 github 的推送事件时,我试图在我的代码构建脚本中读取提交消息。我的主要目标是使用skip ci包含 travis 或其他 ci 工具的消息跳过构建。

git show -s --format=%s(或git show任何选项)导致:

error: Could not read <previous SHA here> 
fatal: unable to parse commit <previous SHA here> 
Run Code Online (Sandbox Code Playgroud)

git log -1 --pretty=%s 也会导致错误。

我曾经git rev-parse --is-shallow-repository看到它是一个浅层存储库,我尝试使用git fetch --unshallow但导致此消息: error in object: unshallow <SHA from a couple months ago>.

我知道的一些 git 命令确实有效

  • git commit 和 git push (设置凭据后)
  • git checkout $branch_name
  • git pull(设置凭据后)
  • 状态

有谁知道如何从代码构建中的推送事件中读取提交消息?

我还要注意Source Versionaws 控制台中的提交 SHA。当我手动点击开始建设,并提供一个分支名 …

continuous-integration github xcodebuild aws-codebuild

4
推荐指数
1
解决办法
413
查看次数

具有多个构造函数参数和选项的 DelegatingHandler 依赖注入

我正在尝试对DelegatingHandler包含 2 个接口和 1 个字符串的a 使用依赖项注入。

public class MessageHandler : DelegatingHandler
{
    private readonly ILogger<MessageHandler> _logger;
    private readonly ISomeService _someService;
    public string Name { get; set; }

    public MessageHandler(ILogger<MessageHandler> logger, ISomeService someService)
    {
        _logger = logger;
        _someService = someService;
    }

    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
        CancellationToken cancellationToken)
    {
        Console.WriteLine($"Doing some other logic with {Name}");
        var response = await base.SendAsync(request, cancellationToken);

        _someService.DoSomething(Name);
        return response;
    }
}
Run Code Online (Sandbox Code Playgroud)

我将此添加DelegatingHandler到一个HttpClient通过IHttpClientFactory

services.AddHttpClient("github")
    .ConfigureHttpClient(c => { c.BaseAddress = …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection .net-core

3
推荐指数
1
解决办法
2281
查看次数