Merge branch 'rz/worktree-no-checkout'
[gitweb.git] / builtin / apply.c
index 0db6d14cc2eeaf3a08fb08301ab02af1b22fc8f8..c993333f9f6bd397d32c8cdc299100930a37de24 100644 (file)
@@ -4383,6 +4383,8 @@ static int apply_patch(int fd, const char *filename, int options)
                        listp = &patch->next;
                }
                else {
+                       if (apply_verbosely)
+                               say_patch_name(stderr, _("Skipped patch '%s'."), patch);
                        free_patch(patch);
                        skipped_patch++;
                }
@@ -4464,16 +4466,6 @@ static int option_parse_p(const struct option *opt,
        return 0;
 }
 
-static int option_parse_z(const struct option *opt,
-                         const char *arg, int unset)
-{
-       if (unset)
-               line_termination = '\n';
-       else
-               line_termination = 0;
-       return 0;
-}
-
 static int option_parse_space_change(const struct option *opt,
                          const char *arg, int unset)
 {
@@ -4546,9 +4538,9 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
                         N_( "attempt three-way merge if a patch does not apply")),
                OPT_FILENAME(0, "build-fake-ancestor", &fake_ancestor,
                        N_("build a temporary index based on embedded index information")),
-               { OPTION_CALLBACK, 'z', NULL, NULL, NULL,
-                       N_("paths are separated with NUL character"),
-                       PARSE_OPT_NOARG, option_parse_z },
+               /* Think twice before adding "--nul" synonym to this */
+               OPT_SET_INT('z', NULL, &line_termination,
+                       N_("paths are separated with NUL character"), '\0'),
                OPT_INTEGER('C', NULL, &p_context,
                                N_("ensure at least <n> lines of context match")),
                { OPTION_CALLBACK, 0, "whitespace", &whitespace_option, N_("action"),