No merge strategy handled the merge (git version 1.1.GIT)
Hello,
I've been hacking on some features for IPVS in the Linux kernel recently but abandoned work for 3 weeks. Today I wanted to re-sync with Linus to work in a more up-to-date tree and simply typed (forgot I had previously done work in that tree)
git-pull
in my local repository tree, which resulted in following:
[...] ff/df76b725bc7c0ce7db0b123957c21989674aaf pack/pack-0741dd55e7c560f401c7f37120f3203ad8664bb0.idx pack/pack-0741dd55e7c560f401c7f37120f3203ad8664bb0.pack
wrote 43124 bytes read 122278591 bytes 66461.13 bytes/sec
total size is 122060858 speedup is 1.00
* refs/heads/origin: fast forward to branch 'master' of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Nope.
Merging HEAD with 3ee68c4af3fd7228c1be63254b9f884614f9ebb2
Merging:03f7e47c28dc1273395112c72ee198e86f2d576d Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.63ee68c4af3fd7228c1be63254b9f884614f9ebb2 [SPARC64]: Use compat_sys_futimesat in 32-bit syscall table.
found 1 common ancestor(s):48ea753075aa15699bd5fac26faa08431aaa697b Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
Removing arch/sh/boards/hp6xx/hp620/mach.c
Removing arch/ia64/ia32/ia32_ioctl.c
Removing drivers/net/sk98lin/skproc.c
Removing include/asm-arm/arch-epxa10db/timer00.h
Removing arch/powerpc/xmon/start_32.c
Removing arch/arm/mach-integrator/dma.c
Removing drivers/video/aty/xlinit.c
Removing arch/arm/mach-epxa10db/Makefile.boot
Removing scripts/lxdialog/lxdialog.c
Removing include/asm-mips/.gitignore
Removing arch/ppc/platforms/pmac_smp.c
Removing drivers/scsi/sym53c8xx_defs.h
Removing arch/ppc/platforms/pmac_pci.c
Removing arch/sparc64/kernel/ioctl32.c
Removing arch/powerpc/xmon/start_8xx.c
Removing arch/um/include/time_user.h
Removing include/asm-mips/riscos-syscall.h
Removing drivers/char/rio/poll.h
Removing drivers/char/rio/brates.h
Removing scripts/lxdialog/inputbox.c
Removing drivers/char/rio/eisa.h
Removing arch/ppc/boot/openfirmware/coffmain.c
Removing drivers/char/rio/proto.h
Removing drivers/char/rio/riowinif.h
Removing drivers/char/rio/riscos.h
Removing drivers/serial/uart00.c
Removing net/ipv6/netfilter/ip6t_length.c
Removing arch/sh/kernel/cpu/irq_ipr.c
Removing arch/s390/crypto/des_z990.c
Removing scripts/lxdialog/yesno.c
Removing arch/x86_64/boot/compressed/miscsetup.h
Removing net/ipv6/netfilter/ip6t_mark.c
Removing net/ipv6/netfilter/ip6t_NFQUEUE.c
Removing include/asm-arm/arch-epxa10db/io.h
Removing drivers/char/rio/hosthw.h
Removing arch/ppc/platforms/pmac_time.c
Removing net/ipv6/netfilter/ip6t_MARK.c
Removing kernel/crash_dump.c
Removing arch/arm/mach-epxa10db/irq.c
Removing arch/ppc/platforms/pmac_low_i2c.c
Removing drivers/char/rio/cmd.h
Removing drivers/net/arm/ether00.c
Removing arch/mips/kernel/ioctl32.c
Removing arch/um/kernel/skas/mem_user.c
Removing drivers/i2c/busses/i2c-pmac-smu.c
Removing drivers/input/mouse/maplemouse.c
Removing drivers/char/rio/rtahw.h
Removing drivers/char/rio/mca.h
Removing scripts/lxdialog/textbox.c
Auto-merging net/ipv4/ipvs/ip_vs_ctl.c
Traceback (most recent call last):
File "/home/ratz/bin/git-merge-recursive", line 915, in ?
firstBranch, secondBranch, graph)
File "/home/ratz/bin/git-merge-recursive", line 87, in merge
branch1Name, branch2Name)
File "/home/ratz/bin/git-merge-recursive", line 160, in mergeTrees
if not processEntry(entry, branch1Name, branch2Name):
File "/home/ratz/bin/git-merge-recursive", line 868, in processEntry
branch1Name, branch2Name)
File "/home/ratz/bin/git-merge-recursive", line 212, in mergeFile
src1, orig, src2], returnCode=True)
File "/home/ratz/share/git-core/python/gitMergeCommon.py", line 72,
in runProgram
raise ProgramError(progStr, e.strerror)
ProgramError: merge -L HEAD/net/ipv4/ipvs/ip_vs_ctl.c -L orig/net/ipv4/ipvs/ip_vs_ctl.c -L 3ee68c4af3fd7228c1be63254b9f884614f9ebb2/net/ipv4/ipvs/ip_vs_ctl.c .merge_file_uofMwv .merge_file_hcesLs .merge_file_TwtEqw: No such file or directory No merge strategy handled the merge.
I'm all for verbosity when it comes to a problem with software, however this output does not tell me much about what I could do to achieve following state:
1. Sync my local tree to Linus' tree.
2. Merge my changes I've done locally with the resulting tree of 1.
git-diff shows me 222 unmerged paths, along with my changes:
~> git-diff net/ipv4/ipvs/
* Unmerged path net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_ctl.c +0 -0
* Unmerged path net/ipv4/ipvs/ip_vs_lblc.c
net/ipv4/ipvs/ip_vs_lblc.c +0 -0
* Unmerged path net/ipv4/ipvs/ip_vs_lblcr.c
net/ipv4/ipvs/ip_vs_lblcr.c +0 -0
* Unmerged path net/ipv4/ipvs/ip_vs_proto_tcp.c
net/ipv4/ipvs/ip_vs_proto_tcp.c +0 -0
Would it be faster for me to clone the current master again and diff the old (master, probably inconsistent) tree to master and merge the changes by hand? Of course I can start my work again from scratch, it's only been around 200 lines of changes so far ;).
Oh, btw, how is git branch -D supposed to work? Isn't there some code missing?
Thanks for any insights,
Roberto Nibali, ratz
Signature · 1 line
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
Quoted 11 lines · Roberto Nibali
Hello,
I've been hacking on some features for IPVS in the Linux kernel recently but abandoned work for 3 weeks. Today I wanted to re-sync with Linus to work in a more up-to-date tree and simply typed (forgot I had previously done work in that tree)
git-pull
in my local repository tree, which resulted in following:
...
Quoted 13 lines
Auto-merging
net/ipv4/ipvs/ip_vs_ctl.c
Traceback (most recent call last):
File "/home/ratz/bin/git-merge-recursive", line 915, in ?
firstBranch, secondBranch, graph)
File "/home/ratz/bin/git-merge-recursive", line 87, in merge
branch1Name, branch2Name)
File "/home/ratz/bin/git-merge-recursive", line 160, in mergeTrees
if notprocessEntry(entry, branch1Name, branch2Name):
File "/home/ratz/bin/git-merge-recursive", line 868, in processEntry
branch1Name, branch2Name)
File "/home/ratz/bin/git-merge-recursive", line 212, in mergeFile
src1, orig, src2], returnCode=True)
File "/home/ratz/share/git-core/python/gitMergeCommon.py", line 72,
Quoted 9 lines
in runProgram
raiseProgramError(progStr, e.strerror)
ProgramError: merge -LHEAD/net/ipv4/ipvs/ip_vs_ctl.c-Lorig/net/ipv4/ipvs/ip_vs_ctl.c-L3ee68c4af3fd7228c1be63254b9f884614f9ebb2/net/ipv4/ipvs/ip_vs_ctl.c.merge_file_uofMwv .merge_file_hcesLs .merge_file_TwtEqw: No such file or directory
No merge strategy handled the merge.
The problem is that merge(1), which is used for file-level merges, couldn't be found. Is it installed on your system? If you use Linux, it is usually found in the "rcs" package in your favorite distribution.
This have came up a couple of times now, we should probably make this error message a bit less cryptic. I will send a patch in a separate mail.
Quoted 7 lines
I'm all for verbosity when it comes to a problem with software, however this output does not tell me much about what I could do to achieve following state:
1. Sync my local tree to Linus' tree.
2. Merge my changes I've done locally with the resulting tree of 1.
If your repository is in the state that the failed git-pull left it in, then the following actions should merge your changes with Linus' tree.
1. Install merge(1)
2. Run 'git reset --hard' (NOTE: Be careful with this command. It will revert any uncommitted changes you may have in your working directory!)
3. Run 'git pull'
Quoted 2 lines
Oh, btw, how is git branch -D supposed to work? Isn't there some code missing?
Could you be a bit more specific? Do you mean that there is code missing in git-branch.sh? What happens when you run 'git branch -D <some branch>'? It seems to work fine here.
- Fredrik
PATCH 1/1 merge-recursive: Improve the error message printed when merge(1) isn't found.
---
git-merge-recursive.py | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
75cd8eff434fd6e9cf7fff98f13a27bfaa1b363b
git-merge-recursive.py +10 -5
@@ -205,11 +205,16 @@ def mergeFile(oPath, oSha, oMode, aPath, orig = runProgram(['git-unpack-file', oSha]).rstrip() src1 = runProgram(['git-unpack-file', aSha]).rstrip() src2 = runProgram(['git-unpack-file', bSha]).rstrip() - [out, code] = runProgram(['merge', - '-L', branch1Name + '/' + aPath, - '-L', 'orig/' + oPath, - '-L', branch2Name + '/' + bPath, - src1, orig, src2], returnCode=True) + try: + [out, code] = runProgram(['merge', + '-L', branch1Name + '/' + aPath, + '-L', 'orig/' + oPath, + '-L', branch2Name + '/' + bPath, + src1, orig, src2], returnCode=True) + except ProgramError, e: + print >>sys.stderr, e + die("Failed to execute 'merge'. merge(1) is used as the " + "file-level merge tool. Is 'merge' in your path?") sha = runProgram(['git-hash-object', '-t', 'blob', '-w', src1]).rstrip()
Signature · 1 line
0.99.9k.g3480-dirty
Re: [PATCH] merge-recursive: Improve the error message printed when merge(1) isn't found.
Quoted 5 lines
git-merge-recursive.py +0
-5- [out, code] = runProgram(['merge', - '-L', branch1Name + '/' + aPath, - '-L', 'orig/' + oPath, - '-L', branch2Name + '/' + bPath, - src1, orig, src2], returnCode=True)
git-merge-recursive.py def mergeFile(oPath, oSha, oMode, aPath, · line 217
Quoted 10 lines
git-merge-recursive.py +10
-0+ try: + [out, code] = runProgram(['merge', + '-L', branch1Name + '/' + aPath, + '-L', 'orig/' + oPath, + '-L', branch2Name + '/' + bPath, + src1, orig, src2], returnCode=True) + except ProgramError, e: + print >>sys.stderr, e + die("Failed to execute 'merge'. merge(1) is used as the " + "file-level merge tool. Is 'merge' in your path?")
This has my vote as well.
Thanks for your support,
Roberto Nibali, ratz
Signature · 1 line
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
Quoted 4 lines
The problem is that merge(1), which is used for file-level merges, couldn't be found. Is it installed on your system? If you use Linux, it is usually found in the "rcs" package in your favorite distribution.
Also in diffutils (the package with diff3).
Signature · 4 lines
GPG Key id: 0xD1F10BA2 Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2 AstralStorm
Quoted 7 lines · Radoslaw Szkodzinski
Quoted 4 lines
The problem is that merge(1), which is used for file-level merges, couldn't be found. Is it installed on your system? If you use Linux, it is usually found in the "rcs" package in your favorite distribution.
Also in diffutils (the package with diff3).
No, I was wrong. However, diff3 can merge files and should also be supported. It is much lighter than full rcs.
Parameters:
diff3 -m local base new > mergedlocal
Signature · 4 lines
GPG Key id: 0xD1F10BA2 Fingerprint: 96E2 304A B9C4 949A 10A0 9105 9543 0453 D1F1 0BA2 AstralStorm
Quoted 9 lines
Quoted 4 lines
raise
ProgramError(progStr, e.strerror)
ProgramError: merge -LHEAD/net/ipv4/ipvs/ip_vs_ctl.c-Lorig/net/ipv4/ipvs/ip_vs_ctl.c-L3ee68c4af3fd7228c1be63254b9f884614f9ebb2/net/ipv4/ipvs/ip_vs_ctl.c.merge_file_uofMwv .merge_file_hcesLs .merge_file_TwtEqw: No such file or directory No merge strategy handled the merge.The problem is that merge(1), which is used for file-level merges, couldn't be found. Is it installed on your system? If you use Linux, it is usually found in the "rcs" package in your favorite distribution.
That's it, I've installed it now.
Quoted 3 lines
This have came up a couple of times now, we should probably make this error message a bit less cryptic. I will send a patch in a separate mail.
Thanks.
Quoted 8 lines
If your repository is in the state that the failed git-pull left it in, then the following actions should merge your changes with Linus' tree.
1. Install merge(1)
2. Run 'git reset --hard' (NOTE: Be careful with this command. It will revert any uncommitted changes you may have in your working directory!)
3. Run 'git pull'
This worked. And as you've mentioned, I lost the uncommitted changes.
Quoted 5 lines
Quoted 1 line
Oh, btw, how is git branch -D supposed to work? Isn't there some code missing?
Could you be a bit more specific? Do you mean that there is code missing in
git-branch.sh? What happens when you run 'git branch -D <some branch>'? It seems to work fine here.
Well, I was trying to understand git a bit better, so I started reading the source code and just found that -D wasn't documented on my system, even after a
git clone rsync://git.kernel.org/pub/scm/git/git.git/ GIT_HEAD
I'm talking about following excerpt which I've looked at for 2 minutes:
#!/bin/sh
USAGE='[-d <branch>] | [[-f] <branch> [start-point]]'
LONG_USAGE='If no arguments, show available branches and mark current branch with a star. If one argument, create a new branch <branchname> based off of current HEAD. If two arguments, create a new branch <branchname> based off of <start-point>.'
SUBDIRECTORY_OK='Yes'
. git-sh-setup
headref=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||')
delete_branch () {
option="$1"
shift
for branch_name
do
case ",$headref," in
",$branch_name,")
die "Cannot delete the branch you are on." ;;
,,)
die "What branch are you on anyway?" ;;
esac
branch=$(cat "$GIT_DIR/refs/heads/$branch_name") &&
branch=$(git-rev-parse --verify "$branch^0") ||
die "Seriously, what branch are you talking about?"
case "$option" in
-D)
;;[...]
This is slightly confusing, since I didn't see the shift after delete_branch so it looked like a noop. On top of that "-D" did/does not seem to be documented. Skimming over your patch you've sent later to this list, it appears you've fixed the documentation.
Best regards,
Roberto Nibali, ratz
Signature · 1 line
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
Quoted 3 lines · Roberto Nibali
... "not reading code before commenting" omitted ... On top of that "-D" did/does
not seem to be documented...
Well, initially, not documenting it was done somewhat deliberately, because -D is an operation that would lose information. Running the command with -d option would reveal its existence after telling the user why we do not let it be deleted by default.