错误:"补丁不适用"编辑挂起补丁模式时

时间:2016-04-11 23:14:22

标签: git add edit patch interactive

我想通过编辑来交互式地添加它:

@@ -55,3 +50,28 @@
   {
-    if(n_arguments == 1)
+    inputed_command = get_line(); //gets the user's input line from the stdin.
+
+    //we edit the user's input as needed according to qtp rules.
+    /*STRING EDITING FUNCTIONS*/
+    replace_string_chars(inputed_command, 9, ' ');
+    remove_char(inputed_command, 13);
+    remove_comments(inputed_command);
+    remove_extra_spaces(inputed_command);
+    uncapitalize(inputed_command);
+    /*END OF STRING EDITING FUNCTIONS*/
+
+    //the command gets seperated from the user's input ex. playmove w c3, here the command is playmove.
+    command = command_decode(inputed_command);
+    //the arguments are seperated from the user's input in an 2D array ex. playmove w c3, here the arguments are w and c3.
+    arguments = arguments_decode(inputed_command, &n_arguments);
+
+    //the user specified command is executed by matching the user's command with the engine's available commands. if the user's command is not one of the engine's known commands then a descriptive error is printed.
+    if(strcmp(command, "name") == 0)
+      name();
+    else if(strcmp(command, "known_command") == 0)
+      known_command(arguments, n_arguments);
+    else if(strcmp(command, "list_commands") == 0)
+      list_commands();
+    else if(strcmp(command, "quit") == 0)
+      quit(&quit_game);
+    else if(strcmp(command, "boardsize") == 0)
     {

我想只发布这部分内容:

@@ -55,3 +50,28 @@
   {
-    if(n_arguments == 1)
+    inputed_command = get_line(); //gets the user's input line from the stdin.
+
+    //we edit the user's input as needed according to qtp rules.
+    /*STRING EDITING FUNCTIONS*/
+    replace_string_chars(inputed_command, 9, ' ');
+    remove_char(inputed_command, 13);
+    remove_comments(inputed_command);
+    remove_extra_spaces(inputed_command);
+    uncapitalize(inputed_command);
+    /*END OF STRING EDITING FUNCTIONS*/
+
+    //the command gets seperated from the user's input ex. playmove w c3, here the command is playmove.
+    command = command_decode(inputed_command);
+    //the arguments are seperated from the user's input in an 2D array ex. playmove w c3, here the arguments are w and c3.
+    arguments = arguments_decode(inputed_command, &n_arguments);
+
     {

但是当我保存&退出此错误发生"补丁不适用"。

我读过我需要编辑@@字符之间的数字,但我从来没有把它弄好。请描述如何解决此错误,谢谢。

1 个答案:

答案 0 :(得分:1)

这看起来只是从补丁中删除“+”行的简单情况。我看到的唯一可能导致你的补丁失败的是你的两个帅哥中最后一个花括号的缩进方式不同。

编辑补丁时,编辑是否应用了自动格式化规则?