git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] stop it from failing silently when git apply patch and show err info
@ 2019-07-25 10:16 simon gao
  0 siblings, 0 replies; 3+ messages in thread
From: simon gao @ 2019-07-25 10:16 UTC (permalink / raw)
  To: git; +Cc: simon gao

Signed-off-by: simon gao <simon29rock@gmail.com>
---
 apply.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/apply.c b/apply.c
index 4992eca..f66a6ff 100644
--- a/apply.c
+++ b/apply.c
@@ -2094,6 +2094,7 @@ static int use_patch(struct apply_state *state, struct patch *p)
 	if (state->prefix && *state->prefix) {
 		const char *rest;
 		if (!skip_prefix(pathname, state->prefix, &rest) || !*rest)
+            error(_("%s doesn't contain the prefix(%s)"), pathname, state->prefix);
 			return 0;
 	}
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] stop it from failing silently when git apply patch and show err info
@ 2019-07-25 10:43 simon gao
  2019-07-25 12:15 ` simon gao
  0 siblings, 1 reply; 3+ messages in thread
From: simon gao @ 2019-07-25 10:43 UTC (permalink / raw)
  To: git; +Cc: simon gao

Signed-off-by: simon gao <simon29rock@gmail.com>
---
 apply.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/apply.c b/apply.c
index 4992eca..47b16aa 100644
--- a/apply.c
+++ b/apply.c
@@ -2093,8 +2093,10 @@ static int use_patch(struct apply_state *state, struct patch *p)
 	/* Paths outside are not touched regardless of "--include" */
 	if (state->prefix && *state->prefix) {
 		const char *rest;
-		if (!skip_prefix(pathname, state->prefix, &rest) || !*rest)
+		if (!skip_prefix(pathname, state->prefix, &rest) || !*rest){
+			error(_("%s doesn't contain the prefix(%s)"), pathname, state->prefix);
 			return 0;
+		}
 	}
 
 	/* See if it matches any of exclude/include rule */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] stop it from failing silently when git apply patch and show err info
  2019-07-25 10:43 simon gao
@ 2019-07-25 12:15 ` simon gao
  0 siblings, 0 replies; 3+ messages in thread
From: simon gao @ 2019-07-25 12:15 UTC (permalink / raw)
  To: git

I create 001.patch in dir, ceph_master

ceph_master
|--- .git
|--- src
|--- tools
|--- ...

local project directory:
storage
|---.git
|---ceph_**.*.**
    |--- src
    |--- tools
    |--- ...

I'm trying to apply the patch, and git apply patch doesn't give me any errors.
like this
cd storage/ceph_**.*.** && git apply 001.patch
I check code and I find that root directory need to be set using "--directory"
I think we need show some info about it.

thinks


simon gao <simon29rock@gmail.com> 于2019年7月25日周四 下午6:43写道:
>
> Signed-off-by: simon gao <simon29rock@gmail.com>
> ---
>  apply.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/apply.c b/apply.c
> index 4992eca..47b16aa 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -2093,8 +2093,10 @@ static int use_patch(struct apply_state *state, struct patch *p)
>         /* Paths outside are not touched regardless of "--include" */
>         if (state->prefix && *state->prefix) {
>                 const char *rest;
> -               if (!skip_prefix(pathname, state->prefix, &rest) || !*rest)
> +               if (!skip_prefix(pathname, state->prefix, &rest) || !*rest){
> +                       error(_("%s doesn't contain the prefix(%s)"), pathname, state->prefix);
>                         return 0;
> +               }
>         }
>
>         /* See if it matches any of exclude/include rule */
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-25 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 10:16 [PATCH] stop it from failing silently when git apply patch and show err info simon gao
  -- strict thread matches above, loose matches on Subject: below --
2019-07-25 10:43 simon gao
2019-07-25 12:15 ` simon gao

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).