【问题标题】:Changes from stash are not applied to working copy. Why? [duplicate]stash 中的更改不会应用于工作副本。为什么? [复制]
【发布时间】:2018-12-12 18:41:38
【问题描述】:

我确实更改了我的文件:

--- a/lib/Mojolicious/Plugin/OpenAPI3.pm
+++ b/lib/Mojolicious/Plugin/OpenAPI3.pm
@@ -396,6 +396,7 @@ sub _check_response {
     # Here we do not know what to do with all of this.
     # Thus we just say: Not Implemented
     # $c->stash->{ status } //=  404;
+    DB::x;
     $c->render( status => 501, data => '' );
 }

当尝试应用 stash 时出现错误:

error: Your local changes to the following files would be overwritten by merge:
    lib/Mojolicious/Plugin/OpenAPI3.pm
Please commit your changes or stash them before you merge.

但 stash 对同一行没有交叉更改:

$ git stash show -p
--- a/lib/Mojolicious/Plugin/OpenAPI3.pm
+++ b/lib/Mojolicious/Plugin/OpenAPI3.pm
@@ -452,6 +463,7 @@ sub validate_response {
     # NOTICE: Depending on status we will check normal or error response
     my $status =  $stash->{ status } //=  200;
     my $schema =  $stash->{ 'openapi3.schema' }{ responses };
+    $status =  'default'   if !$schema->{ $status };
     # TODO: Schema also not found for not found request:
     # Request which come to not defined path. In this case we should provide
     # something like default response, should not?

为什么会出现上述错误?为什么 stash 中的更改只是合并到工作目录中?

【问题讨论】:

    标签: git git-merge git-stash


    【解决方案1】:

    我认为这里的问题是您的工作目录中的文件OpenAPI3.pm 有未完成的更改。直接应用存储会覆盖其中的一些更改,因此会出现错误消息:

    您对以下文件的本地更改将被合并覆盖:

    解决方案遵循上述消息:

    请在合并之前提交您的更改或存储它们。

    您可以提交更改,也可以进行另一个存储。或者,也许您不需要更改,第三种选择是将文件 OpenAPI3.pm 重置为最新提交。

    【讨论】:

    • 这似乎是多余的。更改没有冲突,因此我希望它像patch 实用程序一样工作。我们从脏工作目录中创建该补丁。而且我认为将该补丁应用于干净或脏目录没有任何问题
    猜你喜欢
    • 1970-01-01
    • 2020-11-26
    • 1970-01-01
    • 2013-08-17
    • 2020-10-04
    • 2020-09-24
    • 2019-11-29
    • 1970-01-01
    • 2023-02-25
    相关资源
    最近更新 更多