git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* bugreport: git apply -3 confusing "lacks the necessary blob"
@ 2021-08-18 18:17 Jan Kratochvil
  2021-08-20  9:19 ` Bagas Sanjaya
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2021-08-18 18:17 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
git apply -3 b.diff

What did you expect to happen? (Expected behavior)
<<<<<<< ours
c
||||||| base
a
=======
b
>>>>>>> theirs

What happened instead? (Actual behavior)
error: patch failed: x:1
error: repository lacks the necessary blob to fall back on 3-way merge.
error: x: patch does not apply

What's different between what you expected and what actually happened?
The conflicting patch has not been applied to resolve it manually.

Anything else you want to add:
The problem is 'git apply -3' will print confusing "lacks the necessary blob"
message despite the real error message should be:
"b.diff is missing line starting with 'index', cannot apply by -3/--3way"

reproducer:
(set -ex;: rm -rf gitgit;mkdir gitgit;cd gitgit;git init;echo a >x;git add x;git commit -am.;git checkout -b b;echo b >x;git commit -am.;git checkout master;echo c >x;git commit -am.;git diff master^..b|grep -v ^index >b.diff;git apply -3 b.diff || cat b.diff)

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.31.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.12.11-300.fc34.x86_64 #1 SMP Wed Jun 16 15:47:58 UTC 2021 x86_64
compiler info: gnuc: 11.0
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
not run from a git repository - no hooks to show

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

end of thread, other threads:[~2021-08-27 17:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 18:17 bugreport: git apply -3 confusing "lacks the necessary blob" Jan Kratochvil
2021-08-20  9:19 ` Bagas Sanjaya
2021-08-20  9:26   ` Jan Kratochvil
2021-08-20 17:40   ` Junio C Hamano
2021-08-20 18:30     ` Jan Kratochvil
2021-08-27 15:15     ` Jan Kratochvil
2021-08-27 17:14       ` Junio C Hamano

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).