git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: Better suggestions when git-am(1) fails
Date: Wed, 8 Mar 2023 21:15:53 +0100	[thread overview]
Message-ID: <897c200c-afb3-ceb4-bf44-9af651f5feb4@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2358 bytes --]

Hi,

I had the following error already a few times, when some contributors,
for some reason unknown to me, remove the leading path components from
the patch.  Now I know that the fix is to use -p0, but the first times
it wasn't obvious.  And still I forget about -p0 sometimes and it's
hard to find in the manual pages.  I think it would be good to suggest
using it when such an error appears.


$ git am -s patches/\[PATCH\ 1_2\]\ CONTRIBUTING\:\ Fix\ typo\,\ there\ is\ one\ active\ maintainer\ -\ Rodrigo\ Campos\ \<rodrigo@sdfg.com.ar\>\ -\ 2023-03-08\ 1622.eml
Applying: CONTRIBUTING: Fix typo, there is one active maintainer
error: git diff header lacks filename information when removing 1 leading pathname component (line 9)
Patch failed at 0001 CONTRIBUTING: Fix typo, there is one active maintainer
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
alx@asus5775:~/src/linux/man-pages/man-pages/main$ man git-am
alx@asus5775:~/src/linux/man-pages/man-pages/main$ git am --show-current-patch=diff
---
 CONTRIBUTING | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git CONTRIBUTING CONTRIBUTING
index 3b4408108..3bb671eca 100644
--- CONTRIBUTING
+++ CONTRIBUTING
@@ -8,7 +8,7 @@ Description
    Mailing list
        The main discussions regarding development of the project, patches,
        bugs, news, doubts, etc. happen on the mailing list.  To send an email
-       to the project, send it to both maintainers and CC the mailing list:
+       to the project, send it to Alejandro and CC the mailing list:
 
            To: Alejandro Colomar <alx@kernel.org>
            Cc: <linux-man@vger.kernel.org>
-- 
2.39.2


git(1) could recommend using `-p` to sort this out.  It could go
further and check which level would be needed for the patch to apply,
but at the very least it could tell the user which option it wants
to look for in the documentation.

Does this make sense to you?  I usually find git-am error messages
quite uninformative.


Cheers,

Alex


-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2023-03-08 20:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 20:15 Alejandro Colomar [this message]
2023-03-09  3:17 ` Better suggestions when git-am(1) fails Jeff King
2023-03-09  6:06   ` Jeff King
2023-03-09  6:07     ` [PATCH 1/5] diff: factor out src/dst prefix setup Jeff King
2023-03-09 10:50       ` Alejandro Colomar
2023-03-09  6:07     ` [PATCH 2/5] t4013: add tests for diff prefix options Jeff King
2023-03-09  6:09     ` [PATCH 3/5] diff: add --default-prefix option Jeff King
2023-03-09 10:51       ` Alejandro Colomar
2023-03-09 16:31       ` Junio C Hamano
2023-03-10  9:44         ` Jeff King
2023-03-10 17:04           ` Junio C Hamano
2023-03-13 16:43             ` Jeff King
2023-03-13 17:17               ` Junio C Hamano
2023-03-13 17:31               ` Junio C Hamano
2023-03-13 19:54                 ` Jeff King
2023-03-09  6:11     ` [PATCH 4/5] format-patch: do not respect diff.noprefix Jeff King
2023-03-09 10:53       ` Alejandro Colomar
2023-03-09 16:41       ` Junio C Hamano
2023-03-10  9:49         ` Jeff King
2023-03-09  6:12     ` [PATCH 5/5] format-patch: add format.noprefix option Jeff King
2023-03-09 17:00       ` Junio C Hamano
2023-03-10  9:51         ` Jeff King
2023-03-09 10:58     ` Better suggestions when git-am(1) fails Alejandro Colomar
2023-03-09 21:53     ` Junio C Hamano
2023-03-10  9:54       ` Jeff King
2023-03-09 16:22   ` Junio C Hamano
2023-03-10  9:39     ` Jeff King
2023-03-10 16:28       ` Junio C Hamano
2023-03-13 16:37         ` Jeff King
2023-03-13 17:10           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=897c200c-afb3-ceb4-bf44-9af651f5feb4@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).