git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] git am sometimes unable to apply git format-patch output file

From
STSoul Trace <s-trace@list.ru>
Date
Aug 12, 2017, 16:02 UTC
Message-ID
<a6e69bd1-b91f-3150-c3a6-9378793e5e43@list.ru>
Hello.

Using git i have found that git am command may sometimes fail to apply patch file which was created by the git am command.

Steps to reproduce:
# 1. Clone test repository:
git clone https://github.com/S-trace/git_am_bug_test.git
# 2. Format patch file for last commit:
git format-patch HEAD~
# 3. Go to previous commit:
git checkout HEAD~
# 4. Apply back patch file created in step 2:
git am 0001-UPDATE-Update-ascend_MOGOLIA_ULG_normal.xml.patch
The git am command fails on my machine with the following error message:
Applying: Update ascend_MOGOLIA_ULG_normal.xml
.git/rebase-apply/patch:6522: trailing whitespace.
     </scene>
error: patch failed: ascend_MOGOLIA_ULG_normal.xml:1
error: ascend_MOGOLIA_ULG_normal.xml: patch does not apply
Patch failed at 0001 Update ascend_MOGOLIA_ULG_normal.xml
The copy of the patch that failed is found in: .git/rebase-apply/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".
But patch command can handle this patch file:
patch -p1 -i 0001-UPDATE-Update-ascend_MOGOLIA_ULG_normal.xml.patch
Versions information:

git --version git version 2.11.0

patch --version GNU patch 2.7.5 Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc. Copyright (C) 1988 Larry Wall

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Written by Larry Wall and Paul Eggert

uname -a Linux omen 4.10.0-26-generic #30-Ubuntu SMP Tue Jun 27 09:30:12 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:        17.04
Codename:       zesty
Thank you.
Next: Torsten Bögershausen
Message 1 of 4 in “[BUG] git am sometimes unable to apply git format-patch output file”
  1. Soul TraceAug 12, 2017
  2. Torsten BögershausenAug 12, 2017
  3. Torsten BögershausenAug 12, 2017
  4. Soul TraceAug 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.