{"thread":{"id":"1629","subject":"Automatic merge failed, fix up by hand","startedAt":"2005-08-23T21:12:51Z","lastAt":"2005-08-24T03:52:51Z","messageCount":12,"participants":["Len Brown","Junio C Hamano","Linus Torvalds","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7666","messageId":"1124831571.13042.27.camel@firebird.lenb.worldpath.net","threadId":"1629","inReplyTo":null,"subject":"Automatic merge failed, fix up by hand","fromName":"Len Brown","fromEmail":"len.brown@intel.com","sentAt":"2005-08-23T21:12:51Z","receivedAt":"2005-08-23T21:12:51Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":"I'm having trouble using git for merging kernel trees.\n\ngit seems to manufacture conflicts in files that\nI never touched, and on some files it completely\nthrows up its arms, see \"Not handling case\" below.\n\nNot clear how I got into this state -- probably\nsomething to do with adding commits on branches\nand them git-pull-branch'ing them into the master;\ncombined with updating the master from-linus.\n\nwhen i switch heads, I simply remove .git/HEAD\nand link it to the refs/heads/master or refs/heads/acpi-2.6.12\nfollowed by a git checkout -f.  To merge the work\nback into the master I switch back to the master\nand git-pull-branch per jeff's howto.  I also\nperiodically pull from-linus after switching\nthe branch back to the master.\n\nThe merge issue below is reproduced in a \"git clone -l\" copy\nwith no plain files present.\n\nGot any tips on how to recover?\n\nthanks,\n-Len\n\n[lenb@firebird to-akpm.latest]$ git pull ../../from-linus\nPacking 842 objects\nUnpacking 842 objects\n 100% (842/842) done\nTrying to merge 81065e2f415af6c028eac13f481fb9e60a0b487b into\n702c7e7626deeabb057b6f529167b65ec2eefbdb\nSimple merge failed, trying Automatic merge\nAuto-merging CREDITS.\nRemoving Documentation/DocBook/scsidrivers.tmpl\nRemoving Documentation/dvb/README.dibusb\nRemoving Documentation/i2c/chips/smsc47b397.txt\nRemoving Documentation/i2c/sysfs-interface\nRemoving Documentation/networking/wanpipe.txt\nAuto-merging MAINTAINERS.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in MAINTAINERS.\nRemoving arch/arm/configs/omnimeter_defconfig\nRemoving arch/arm/kernel/arch.c\nRemoving arch/arm/lib/longlong.h\nRemoving arch/arm/lib/udivdi3.c\nRemoving arch/arm/mach-omap/Kconfig\nRemoving arch/arm/mach-omap/Makefile\nRemoving arch/arm/mach-omap/Makefile.boot\nRemoving arch/arm/mach-omap/board-generic.c\nRemoving arch/arm/mach-omap/board-h2.c\nRemoving arch/arm/mach-omap/board-h3.c\nRemoving arch/arm/mach-omap/board-innovator.c\nRemoving arch/arm/mach-omap/board-netstar.c\nRemoving arch/arm/mach-omap/board-osk.c\nRemoving arch/arm/mach-omap/board-perseus2.c\nRemoving arch/arm/mach-omap/board-voiceblue.c\nRemoving arch/arm/mach-omap/clock.c\nRemoving arch/arm/mach-omap/clock.h\nRemoving arch/arm/mach-omap/common.c\nRemoving arch/arm/mach-omap/common.h\nRemoving arch/arm/mach-omap/dma.c\nRemoving arch/arm/mach-omap/fpga.c\nRemoving arch/arm/mach-omap/gpio.c\nRemoving arch/arm/mach-omap/irq.c\nRemoving arch/arm/mach-omap/leds-h2p2-debug.c\nRemoving arch/arm/mach-omap/leds-innovator.c\nRemoving arch/arm/mach-omap/leds-osk.c\nRemoving arch/arm/mach-omap/leds.c\nRemoving arch/arm/mach-omap/leds.h\nRemoving arch/arm/mach-omap/mcbsp.c\nRemoving arch/arm/mach-omap/mux.c\nRemoving arch/arm/mach-omap/ocpi.c\nRemoving arch/arm/mach-omap/pm.c\nRemoving arch/arm/mach-omap/sleep.S\nRemoving arch/arm/mach-omap/time.c\nRemoving arch/arm/mach-omap/usb.c\nAuto-merging arch/arm/mm/Kconfig.\nAuto-merging arch/arm/mm/proc-v6.S.\nAuto-merging arch/arm/nwfpe/softfloat.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/arm/nwfpe/softfloat.c.\nAuto-merging arch/i386/kernel/acpi/boot.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/i386/kernel/acpi/boot.c.\nAuto-merging arch/i386/kernel/acpi/sleep.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/i386/kernel/acpi/sleep.c.\nAuto-merging arch/i386/kernel/apic.c.\nAuto-merging arch/i386/kernel/nmi.c.\nAuto-merging arch/ia64/Kconfig.\nAuto-merging arch/ia64/configs/sn2_defconfig.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ia64/configs/sn2_defconfig.\nAuto-merging arch/ia64/configs/tiger_defconfig.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ia64/configs/tiger_defconfig.\nAuto-merging arch/ia64/configs/zx1_defconfig.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ia64/configs/zx1_defconfig.\nAuto-merging arch/ia64/kernel/acpi.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ia64/kernel/acpi.c.\nAuto-merging arch/ia64/kernel/domain.c.\nAuto-merging arch/ia64/kernel/iosapic.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ia64/kernel/iosapic.c.\nAuto-merging arch/ia64/kernel/perfmon.c.\nRemoving arch/ia64/sn/include/pci/pcibr_provider.h\nRemoving arch/ia64/sn/include/pci/pic.h\nRemoving arch/ia64/sn/include/pci/tiocp.h\nAuto-merging arch/ia64/sn/kernel/io_init.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ia64/sn/kernel/io_init.c.\nRemoving arch/mips/vr41xx/common/giu.c\nRemoving arch/ppc/boot/utils/addSystemMap.c\nRemoving arch/ppc/syslib/ppc4xx_kgdb.c\nRemoving arch/ppc64/boot/mknote.c\nRemoving arch/ppc64/boot/piggyback.c\nAuto-merging arch/ppc64/kernel/LparData.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/ppc64/kernel/LparData.c.\nAuto-merging arch/ppc64/kernel/Makefile.\nRemoving arch/ppc64/kernel/XmPciLpEvent.c\nAuto-merging arch/ppc64/kernel/head.S.\nRemoving arch/ppc64/kernel/iSeries_pci_reset.c\nAuto-merging arch/ppc64/kernel/iommu.c.\nAuto-merging arch/sparc64/kernel/traps.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/sparc64/kernel/traps.c.\nAuto-merging arch/um/kernel/skas/process.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/um/kernel/skas/process.c.\nRemoving arch/um/kernel/skas/time.c\nRemoving arch/um/kernel/tt/time.c\nRemoving arch/um/kernel/tt/unmap.c\nAuto-merging arch/um/os-Linux/elf_aux.c.\nAuto-merging arch/x86_64/kernel/smpboot.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in arch/x86_64/kernel/smpboot.c.\nAuto-merging arch/x86_64/mm/fault.c.\nAuto-merging drivers/acpi/Kconfig.\nAuto-merging drivers/acpi/container.c.\nAuto-merging drivers/acpi/osl.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/osl.c.\nAuto-merging drivers/acpi/pci_bind.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/pci_bind.c.\nAuto-merging drivers/acpi/pci_irq.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/pci_irq.c.\nAuto-merging drivers/acpi/pci_link.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/pci_link.c.\nAuto-merging drivers/acpi/pci_root.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/pci_root.c.\nAuto-merging drivers/acpi/processor_core.c.\nAuto-merging drivers/acpi/processor_idle.c.\nAuto-merging drivers/acpi/scan.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/scan.c.\nAuto-merging drivers/acpi/sleep/poweroff.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/acpi/sleep/poweroff.c.\nAuto-merging drivers/base/bus.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/base/bus.c.\nAuto-merging drivers/base/class.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/base/class.c.\nRemoving drivers/base/class_simple.c\nAuto-merging drivers/char/hpet.c.\nRemoving drivers/i2c/chips/adm1021.c\nRemoving drivers/i2c/chips/adm1025.c\nRemoving drivers/i2c/chips/adm1026.c\nRemoving drivers/i2c/chips/adm1031.c\nRemoving drivers/i2c/chips/asb100.c\nRemoving drivers/i2c/chips/ds1621.c\nRemoving drivers/i2c/chips/fscher.c\nRemoving drivers/i2c/chips/fscpos.c\nRemoving drivers/i2c/chips/gl518sm.c\nRemoving drivers/i2c/chips/gl520sm.c\nRemoving drivers/i2c/chips/it87.c\nRemoving drivers/i2c/chips/lm63.c\nRemoving drivers/i2c/chips/lm75.c\nRemoving drivers/i2c/chips/lm75.h\nRemoving drivers/i2c/chips/lm77.c\nRemoving drivers/i2c/chips/lm78.c\nRemoving drivers/i2c/chips/lm80.c\nRemoving drivers/i2c/chips/lm83.c\nRemoving drivers/i2c/chips/lm85.c\nRemoving drivers/i2c/chips/lm87.c\nRemoving drivers/i2c/chips/lm90.c\nRemoving drivers/i2c/chips/lm92.c\nRemoving drivers/i2c/chips/max1619.c\nRemoving drivers/i2c/chips/pc87360.c\nRemoving drivers/i2c/chips/sis5595.c\nRemoving drivers/i2c/chips/smsc47b397.c\nRemoving drivers/i2c/chips/smsc47m1.c\nRemoving drivers/i2c/chips/via686a.c\nRemoving drivers/i2c/chips/w83627hf.c\nRemoving drivers/i2c/chips/w83781d.c\nRemoving drivers/i2c/chips/w83l785ts.c\nAuto-merging drivers/ide/Kconfig.\nRemoving drivers/ide/cris/ide-v10.c\nAuto-merging drivers/ide/ide-floppy.c.\nAuto-merging drivers/ide/pci/generic.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/ide/pci/generic.c.\nAuto-merging drivers/ide/pci/serverworks.c.\nAuto-merging drivers/ide/ppc/pmac.c.\nAuto-merging drivers/ide/setup-pci.c.\nRemoving drivers/input/gameport/cs461x.c\nRemoving drivers/input/gameport/vortex.c\nRemoving drivers/isdn/hisax/enternow.h\nRemoving drivers/isdn/hisax/st5481_hdlc.c\nRemoving drivers/isdn/hisax/st5481_hdlc.h\nRemoving drivers/isdn/sc/debug.c\nRemoving drivers/macintosh/macserial.c\nRemoving drivers/macintosh/macserial.h\nAuto-merging drivers/md/md.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/md/md.c.\nRemoving drivers/media/dvb/b2c2/skystar2.c\nRemoving drivers/media/dvb/dibusb/Kconfig\nRemoving drivers/media/dvb/dibusb/Makefile\nRemoving drivers/media/dvb/dibusb/dvb-dibusb-core.c\nRemoving drivers/media/dvb/dibusb/dvb-dibusb-dvb.c\nRemoving drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c\nRemoving drivers/media/dvb/dibusb/dvb-dibusb-firmware.c\nRemoving drivers/media/dvb/dibusb/dvb-dibusb-remote.c\nRemoving drivers/media/dvb/dibusb/dvb-dibusb-usb.c\nRemoving drivers/media/dvb/dibusb/dvb-dibusb.h\nRemoving drivers/media/dvb/dibusb/dvb-fe-dtt200u.c\nRemoving drivers/mtd/maps/db1550-flash.c\nRemoving drivers/mtd/maps/db1x00-flash.c\nRemoving drivers/mtd/maps/elan-104nc.c\nRemoving drivers/mtd/maps/pb1550-flash.c\nRemoving drivers/mtd/maps/pb1xxx-flash.c\nRemoving drivers/mtd/nand/tx4925ndfmc.c\nRemoving drivers/mtd/nand/tx4938ndfmc.c\nAuto-merging drivers/net/8139cp.c.\nERROR: drivers/net/dm9000.c: Not handling case  ->\n5fddc0ff887822fde5cbf904e3db8e46b4becca1 ->\n6440a892bb813ca4a08e0a1878cf0dedb43b254d\nRemoving drivers/net/fmv18x.c\nRemoving drivers/net/sk_g16.c\nRemoving drivers/net/sk_g16.h\nRemoving drivers/net/skfp/lnkstat.c\nRemoving drivers/net/skfp/smtparse.c\nRemoving drivers/net/smc-mca.h\nAuto-merging drivers/net/tg3.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/net/tg3.c.\nRemoving drivers/pci/hotplug/acpiphp_pci.c\nRemoving drivers/pci/hotplug/acpiphp_res.c\nAuto-merging drivers/pci/msi.c.\nAuto-merging drivers/pci/quirks.c.\nAuto-merging drivers/pnp/card.c.\nRemoving drivers/scsi/pci2000.c\nRemoving drivers/scsi/pci2220i.c\nRemoving drivers/scsi/pci2220i.h\nRemoving drivers/scsi/psi_dale.h\nRemoving drivers/scsi/psi_roy.h\nRemoving drivers/serial/bast_sio.c\nAuto-merging drivers/serial/sn_console.c.\nRemoving drivers/usb/atm/usb_atm.c\nRemoving drivers/usb/atm/usb_atm.h\nAuto-merging drivers/usb/input/wacom.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in drivers/usb/input/wacom.c.\nAuto-merging drivers/usb/net/zd1201.c.\nRemoving fs/freevxfs/vxfs_kcompat.h\nERROR: fs/ioprio.c: Not handling case  ->\n97e1f088ba00b3b63f7f9ea594b756781fcf6596 ->\nd1c1f2b2c9da9796affc6be18b8793489b9f2873\nAuto-merging fs/jffs2/symlink.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in fs/jffs2/symlink.c.\nAuto-merging fs/jfs/inode.c.\nAuto-merging fs/jfs/jfs_logmgr.c.\nAuto-merging fs/jfs/jfs_logmgr.h.\nAuto-merging fs/jfs/jfs_txnmgr.c.\nAuto-merging fs/jfs/super.c.\nAuto-merging fs/jfs/symlink.c.\nAuto-merging fs/namei.c.\nAuto-merging fs/nfs/dir.c.\nAuto-merging fs/nfs/file.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in fs/nfs/file.c.\nAuto-merging fs/nfs/inode.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in fs/nfs/inode.c.\nERROR: fs/nfs/nfs3acl.c: Not handling case  ->\n1b7a3ef2f8131f4f9c02534f55d5a42de4633f67 ->\n6a5bbc0ae941aa690e1f73137cbce4af38902092\nAuto-merging fs/nfs/nfs3proc.c.\nAuto-merging fs/nfs/nfs4proc.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in fs/nfs/nfs4proc.c.\nAuto-merging fs/nfs/proc.c.\nAuto-merging fs/nfs/read.c.\nERROR: fs/nfs_common/nfsacl.c: Not handling case  ->\n18c58c32e326281bfa7226edbaaec135b45c2b70 ->\n251e5a1bb1c4cbe0308c042073b0d83cfe71d73d\nAuto-merging fs/nfsd/nfssvc.c.\nAuto-merging fs/ntfs/ChangeLog.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in fs/ntfs/ChangeLog.\nAuto-merging fs/ntfs/aops.c.\nAuto-merging fs/ntfs/mft.c.\nAuto-merging fs/proc/base.c.\nAuto-merging fs/reiserfs/inode.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in fs/reiserfs/inode.c.\nAuto-merging fs/sysfs/symlink.c.\nAuto-merging include/acpi/acpi_bus.h.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in include/acpi/acpi_bus.h.\nAuto-merging include/acpi/acpi_drivers.h.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in include/acpi/acpi_drivers.h.\nAuto-merging include/asm-i386/processor.h.\nAuto-merging include/asm-ia64/iosapic.h.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in include/asm-ia64/iosapic.h.\nRemoving include/asm-m32r/m32102peri.h\nRemoving include/asm-ppc/fsl_ocp.h\nAuto-merging include/asm-ppc/ibm44x.h.\nRemoving include/asm-ppc64/iSeries/HvCallCfg.h\nRemoving include/asm-ppc64/iSeries/LparData.h\nAuto-merging include/asm-ppc64/iSeries/LparMap.h.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in include/asm-ppc64/iSeries/LparMap.h.\nRemoving include/asm-ppc64/iSeries/XmPciLpEvent.h\nRemoving include/asm-ppc64/iSeries/iSeries_proc.h\nAuto-merging include/asm-sh/unistd.h.\nAuto-merging include/asm-sparc64/thread_info.h.\nAuto-merging include/asm-x86_64/processor.h.\nAuto-merging include/linux/acpi.h.\nAuto-merging include/linux/fs.h.\nRemoving include/linux/ioc4_common.h\nRemoving include/linux/netfilter_ipv4/lockhelp.h\nAuto-merging include/linux/nfs_fs.h.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in include/linux/nfs_fs.h.\nRemoving include/linux/pci-dynids.h\nAuto-merging include/linux/pci.h.\nAuto-merging include/linux/pci_ids.h.\nAuto-merging include/linux/sunrpc/xdr.h.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in include/linux/sunrpc/xdr.h.\nRemoving include/linux/xattr_acl.h\nAuto-merging include/net/ax25.h.\nAuto-merging include/net/sock.h.\nAuto-merging kernel/sched.c.\nAuto-merging kernel/signal.c.\nAuto-merging kernel/timer.c.\nAuto-merging mm/shmem.c.\nAuto-merging net/decnet/dn_neigh.c.\nAuto-merging net/ipv4/icmp.c.\nAuto-merging net/ipv4/ipcomp.c.\nAuto-merging net/ipv4/tcp.c.\nAuto-merging net/ipv4/tcp_ipv4.c.\nAuto-merging net/ipv4/tcp_output.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in net/ipv4/tcp_output.c.\nRemoving net/ipv4/utils.c\nAuto-merging net/ipv6/ipcomp6.c.\nAuto-merging net/ipv6/netfilter/ip6_queue.c.\nAuto-merging net/ipv6/raw.c.\nAuto-merging net/ipv6/tcp_ipv6.c.\nAuto-merging net/sched/sch_generic.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in net/sched/sch_generic.c.\nAuto-merging net/sunrpc/xdr.c.\nmerge: warning: conflicts during merge\nERROR: Merge conflict in net/sunrpc/xdr.c.\nRemoving sound/pcmcia/vx/vx_entry.c\nRemoving sound/pcmcia/vx/vxp440.c\nAuto-merging sound/ppc/pmac.c.\nfatal: merge program failed\nAutomatic merge failed, fix up by hand\n"},{"id":"7673","messageId":"7vhddgnw9q.fsf@assigned-by-dhcp.cox.net","threadId":"1629","inReplyTo":"1124831571.13042.27.camel@firebird.lenb.worldpath.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-23T22:06:25Z","receivedAt":"2005-08-23T22:06:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Len Brown <len.brown@intel.com> writes:\n\n> The merge issue below is reproduced in a \"git clone -l\" copy\n> with no plain files present.\n\nMeaning you did not have any file in the working tree?  It seems\nto me that what is happenning is the resolve is trying to merge\nthe head of your tree and from-linus, but at the same time it\nnotices that you removed those files from your working tree and\nthinks that is what you would want to do.\n\nI could get to 81065e2f415af6... commit (Linus tip at this\nmoment), so if you can tell me where to snarf the other commit\n(702c7e76....) that would help me diagnose the problem a lot.\n\nThanks.\n"},{"id":"7678","messageId":"1124836282.14730.4.camel@toshiba","threadId":"1629","inReplyTo":"7vhddgnw9q.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Len Brown","fromEmail":"len.brown@intel.com","sentAt":"2005-08-23T22:31:22Z","receivedAt":"2005-08-23T22:31:22Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":"On Tue, 2005-08-23 at 18:06 -0400, Junio C Hamano wrote:\n> Len Brown <len.brown@intel.com> writes:\n> \n> > The merge issue below is reproduced in a \"git clone -l\" copy\n> > with no plain files present.\n> \n> Meaning you did not have any file in the working tree?  It seems\n> to me that what is happenning is the resolve is trying to merge\n> the head of your tree and from-linus, but at the same time it\n> notices that you removed those files from your working tree and\n> thinks that is what you would want to do.\n\nDoesn't matter if the merge is after a git checkout -f\nor not.  I was just pointing out that it also fails\nif there are no plain files checked out.\n\n> I could get to 81065e2f415af6... commit (Linus tip at this\n> moment), so if you can tell me where to snarf the other commit\n> (702c7e76....) that would help me diagnose the problem a lot.\n\nrsync://rsync.kernel.org/pub/scm/linux/kernel/git/lenb/to-akpm.git\n\nfails when merged into latest linus, or when latest linus\nis merged into it.\n\nI suspect some artifact of my patches being based on\none of several branches rooted at 2.6.12 is the issue,\nand that in switching between latest 2.6.13 and stable\n2.6.12 branches, some state has bled through that\nnow confuses the heck out of resolve.\n\nthanks,\n-Len\n"},{"id":"7681","messageId":"7vzmr8mci2.fsf@assigned-by-dhcp.cox.net","threadId":"1629","inReplyTo":"1124836282.14730.4.camel@toshiba","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-23T23:58:45Z","receivedAt":"2005-08-23T23:58:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Len Brown <len.brown@intel.com> writes:\n\n>> I could get to 81065e2f415af6... commit (Linus tip at this\n>> moment), so if you can tell me where to snarf the other commit\n>> (702c7e76....) that would help me diagnose the problem a lot.\n>\n> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/lenb/to-akpm.git\n\nThanks.\n\nI think merge-base, even though we attempted to fix it recently,\nis still confused and that is one of the reasons why you are\ngetting this.\n\n    prompt$  git-rev-parse origin test-lenb-merge\n    81065e2f415af6c028eac13f481fb9e60a0b487b\n    702c7e7626deeabb057b6f529167b65ec2eefbdb\n    prompt$  git-merge-base origin test-lenb-merge\n    30e332f3307e9f7718490a706e5ce99f0d3a7b26\n    prompt$  git show-branch origin test-lenb-merge\n    ! [origin] zd1201 kmalloc size fix\n     * [test-lenb-merge] [ACPI] fix ia64 build issues resulting from L...\n    --\n    +  [origin] zd1201 kmalloc size fix\n    +  [origin~1] md: make sure resync gets started when array starts.\n    +  [origin~2] preempt race in getppid\n    +  [origin~3] Merge master.kernel.org:/pub/scm/linux/kernel/git/da\n    -- >8 -- snip -- >8 --\n    +  Merge ../to-linus-stable/\n    ++ [ACPI] re-enable platform-specific hotkey drivers by default\n    +  ARM: 2851/1: Fix NWFPE extended precision exception handling\n    ++ [origin~34] intelfb/fbdev: Save info->flags in a local variable\n    prompt$  git-rev-parse origin~34\n    3edea4833a1efcd43e1dff082bc8001fdfe74b34\n\nNotice that show-branch, which walks the commit ancestry chain\npretty much the same way merge-base does, notices and stops at\norigin~34 (that's 34th generation first parent commit from Linus\ntip) that is the common commit between the two heads being\nmerged?  And that commit, 3edea48... is different from what\nmerge-base is reporting.\n\nIf I maually run merge-cache using origin~34 as the merge base,\nonly the following two files needs to result in non-simple merge:\n\n    Documentation/acpi-hotkey.txt\n    drivers/acpi/osl.c\n\nDo these two files match your expectation?\n\nI'll take a look at merge-base.c next, but just in case I CC:ed\nthis to Linus, who is more familiar with that code.\n"},{"id":"7688","messageId":"7vek8kmb2a.fsf@assigned-by-dhcp.cox.net","threadId":"1629","inReplyTo":"7vzmr8mci2.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-24T00:29:49Z","receivedAt":"2005-08-24T00:29:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> I think merge-base, even though we attempted to fix it recently,\n> is still confused and that is one of the reasons why you are\n> getting this.\n>\n>     prompt$  git-rev-parse origin test-lenb-merge\n>     81065e2f415af6c028eac13f481fb9e60a0b487b\n>     702c7e7626deeabb057b6f529167b65ec2eefbdb\n -->8-- snip -->8--\n>     +  Merge ../to-linus-stable/\n>     ++ [ACPI] re-enable platform-specific hotkey drivers by default\n>     +  ARM: 2851/1: Fix NWFPE extended precision exception handling\n>     ++ [origin~34] intelfb/fbdev: Save info->flags in a local variable\n>     prompt$  git-rev-parse origin~34\n>     3edea4833a1efcd43e1dff082bc8001fdfe74b34\n\nI spoke too fast.  merge-base is not giving you an incorrect\nanswer.  It just happens that the answer was way suboptimal.\n\nThe \"[ACPI] re-enable platform-specific hotkey\" is what it\nchose, and my monkey guessing origin~34 happened to be better\nmerge base, but the logic used by merge-base is to pick the\nlatest (from wallclock wise) commit among several candidates,\nand by that criteria it did the \"right\" thing.\n\nIn this case, the \"right\" thing was a wrong decision.  So we\nprobably should revisit how we choose the \"best\" merge base\namong candidates.  I think \"origin~34\" which happened to be the\nlast one output by \"git show-branch\" was just an accident, not a\ngood rule to follow, so changing merge-base to use the one that\nthe other command shows the last would not be a good way to fix\nthis.\n\nProbably the ideal way would be to give merge-base an option to\nspit out all the candidates, and have the script try to see\nwhich ones yield the least number of non-trivial merges.\n\nLinus?\n"},{"id":"7687","messageId":"1124843469.14730.13.camel@toshiba","threadId":"1629","inReplyTo":"7vzmr8mci2.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Len Brown","fromEmail":"len.brown@intel.com","sentAt":"2005-08-24T00:31:09Z","receivedAt":"2005-08-24T00:31:09Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":"On Tue, 2005-08-23 at 19:58 -0400, Junio C Hamano wrote:\n> Len Brown <len.brown@intel.com> writes:\n> \n> >> I could get to 81065e2f415af6... commit (Linus tip at this\n> >> moment), so if you can tell me where to snarf the other commit\n> >> (702c7e76....) that would help me diagnose the problem a lot.\n> >\n> > rsync://rsync.kernel.org/pub/scm/linux/kernel/git/lenb/to-akpm.git\n> \n> Thanks.\n> \n> I think merge-base, even though we attempted to fix it recently,\n> is still confused and that is one of the reasons why you are\n> getting this.\n> \n>     prompt$  git-rev-parse origin test-lenb-merge\n>     81065e2f415af6c028eac13f481fb9e60a0b487b\n>     702c7e7626deeabb057b6f529167b65ec2eefbdb\n>     prompt$  git-merge-base origin test-lenb-merge\n>     30e332f3307e9f7718490a706e5ce99f0d3a7b26\n>     prompt$  git show-branch origin test-lenb-merge\n>     ! [origin] zd1201 kmalloc size fix\n>      * [test-lenb-merge] [ACPI] fix ia64 build issues resulting from\n> L...\n>     --\n>     +  [origin] zd1201 kmalloc size fix\n>     +  [origin~1] md: make sure resync gets started when array starts.\n>     +  [origin~2] preempt race in getppid\n>     +  [origin~3] Merge master.kernel.org:/pub/scm/linux/kernel/git/da\n>     -- >8 -- snip -- >8 --\n>     +  Merge ../to-linus-stable/\n>     ++ [ACPI] re-enable platform-specific hotkey drivers by default\n>     +  ARM: 2851/1: Fix NWFPE extended precision exception handling\n>     ++ [origin~34] intelfb/fbdev: Save info->flags in a local variable\n>     prompt$  git-rev-parse origin~34\n>     3edea4833a1efcd43e1dff082bc8001fdfe74b34\n> \n> Notice that show-branch, which walks the commit ancestry chain\n> pretty much the same way merge-base does, notices and stops at\n> origin~34 (that's 34th generation first parent commit from Linus\n> tip) that is the common commit between the two heads being\n> merged?  And that commit, 3edea48... is different from what\n> merge-base is reporting.\n> \n> If I maually run merge-cache using origin~34 as the merge base,\n> only the following two files needs to result in non-simple merge:\n> \n>     Documentation/acpi-hotkey.txt\n>     drivers/acpi/osl.c\n> \n> Do these two files match your expectation?\n\nNo, I don't think so.\n\nUnless I missed something, to-akpm should be a proper super-set\nof from-linus, so I wouldn't expect a merge on these two.\n\n> I'll take a look at merge-base.c next, but just in case I CC:ed\n> this to Linus, who is more familiar with that code.\n\nthanks,\n-Len\n"},{"id":"7690","messageId":"Pine.LNX.4.58.0508231733500.3317@g5.osdl.org","threadId":"1629","inReplyTo":"1124831571.13042.27.camel@firebird.lenb.worldpath.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-24T00:48:49Z","receivedAt":"2005-08-24T00:48:49Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 23 Aug 2005, Len Brown wrote:\n>\n> I'm having trouble using git for merging kernel trees.\n> \n> git seems to manufacture conflicts in files that\n> I never touched, and on some files it completely\n> throws up its arms, see \"Not handling case\" below.\n\nCool.\n\nYou've found a case where git-merge-base finds what appears to be two \nequally good merge candidates, but they really aren't.\n\nThe merge candidates are 30e332f3307e9f7718490a706e5ce99f0d3a7b26 and \n3edea4833a1efcd43e1dff082bc8001fdfe74b34.\n\nTo see this graphically, do:\n\n\techo 30e332f3307e9f7718490a706e5ce99f0d3a7b26 > .git/refs/tags/selected-merge-base\n\techo 3edea4833a1efcd43e1dff082bc8001fdfe74b34 > .git/refs/tags/other-merge-base\n\n\techo 81065e2f415af6c028eac13f481fb9e60a0b487b > .git/refs/tags/linus-head\n\techo 702c7e7626deeabb057b6f529167b65ec2eefbdb > .git/refs/tags/lenb-head\n\n\tgitk --all\n\nand notice how the not-selected one is:\n\n\tAuthor: Antonino A. Daplas <adaplas@gmail.com>  2005-08-15 06:29:11\n\tCommitter: Linus Torvalds <torvalds@g5.osdl.org>  2005-08-15 09:59:39\n\tTags: not-selected\n\nwhile the selected on is:\n\n\tAuthor: Luming Yu <luming.yu@intel.com>  2005-08-11 21:31:00\n\tCommitter: Len Brown <len.brown@intel.com>  2005-08-15 12:46:58\n\tTags: selected\n\nand the reason we chose that one is that it's three hours later than the \nother one, and we don't know any better.\n\n> Not clear how I got into this state -- probably\n> something to do with adding commits on branches\n> and them git-pull-branch'ing them into the master;\n> combined with updating the master from-linus.\n\nNo, it's git.\n\nWell, it's git, together with your propensity to merge old work, which \ncauses this kind of confusion where there are two \"equally good\" points to \nchoose from as the merge base, and git chose the wrong one because it \n_looked_ newer and there was a recent merge to an old version of my tree. \n\nCross-merges cause this, but I'm sure there's a good algorithm for \nselecting _which_ of the two interesting commits to pick.\n\nGive me a moment to think about this.\n\n\t\tLinus\n"},{"id":"7691","messageId":"7v3bp0m9ax.fsf@assigned-by-dhcp.cox.net","threadId":"1629","inReplyTo":"7vek8kmb2a.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-24T01:07:50Z","receivedAt":"2005-08-24T01:07:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Probably the ideal way would be to give merge-base an option to\n> spit out all the candidates, and have the script try to see\n> which ones yield the least number of non-trivial merges.\n\nI first checked out your 702c7e.. commit, and slurped Linus tip\n(back then, 81065e2f415af6c028eac13f481fb9e60a0b487b).  Then I\nran git resolve with the attached patch (against the tip of\ngit.git \"master\" branch).  Here is what happened, which seems to\nwork a little bit better, at least to me.\n\n    prompt$ git checkout -f\n    prompt$ git status\n    nothing to commit\n    prompt$ ls -l .git/HEAD\n    lrwxrwxrwx  1 junio src 26 Aug 23 15:43 .git/HEAD -> refs/heads/lenb\n    prompt$ git resolve HEAD origin 'Merge Linus into Lenb'\n    Trying to find the optimum merge base\n    Trying to merge 81065e2f415af6c028eac13f481fb9e60a0b487b into 702c7e7626deeabb057b6f529167b65ec2eefbdb using 3edea4833a1efcd43e1dff082bc8001fdfe74b34\n    Simple merge failed, trying Automatic merge\n    Auto-merging Documentation/acpi-hotkey.txt.\n    merge: warning: conflicts during merge\n    ERROR: Merge conflict in Documentation/acpi-hotkey.txt.\n    Auto-merging drivers/acpi/osl.c.\n    fatal: merge program failed\n    Automatic merge failed, fix up by hand\n\nOnly lightly tested, in the sense that I did only this one case\nand nothing else.  For a large repository and with complex\nmerges, \"merge-base -a\" _might_ end up reporting many\ncandidates, in which case the pre-merge step to figure out the\nbest merge base may turn out to be disastrously slow.  I dunno.\n\n\n---\ngit diff HEAD\ndiff --git a/git-resolve-script b/git-resolve-script\n--- a/git-resolve-script\n+++ b/git-resolve-script\n@@ -49,7 +49,42 @@ if [ \"$common\" == \"$head\" ]; then\n \tdropheads\n \texit 0\n fi\n-echo \"Trying to merge $merge into $head\"\n+\n+# Find optimum merge base if there are more than one candidate.\n+LF='\n+'\n+common=$(git-merge-base -a $head $merge)\n+case \"$common\" in\n+?*\"$LF\"?*)\n+\techo \"Trying to find the optimum merge base\"\n+\tG=.tmp-index$$\n+\tbest=\n+\tbest_cnt=-1\n+\tfor c in $common\n+\tdo\n+\t\trm -f $G\n+\t\tGIT_INDEX_FILE=$G git-read-tree -m $c $head $merge \\\n+\t\t\t2>/dev/null || continue\n+\t\tif GIT_INDEX_FILE=$G git-write-tree 2>/dev/null\n+\t\tthen\n+\t\t\t# This one results in just a Simple merge;\n+\t\t\t# It cannot become better than this.\n+\t\t\tbest=$c\n+\t\t\tbreak\n+\t\tfi\n+\t\t# Otherwise, count the paths that are unmerged.\n+\t\tcnt=`GIT_INDEX_FILE=$G git-ls-files --unmerged | wc -l`\n+\t\tif test $best_cnt -le 0 -o $cnt -le $best_cnt\n+\t\tthen\n+\t\t\tbest=$c\n+\t\t\tbest_cnt=$cnt\n+\t\tfi\n+\tdone\n+\trm -f $G\n+\tcommon=\"$best\"\n+esac\n+\n+echo \"Trying to merge $merge into $head using $common\"\n git-read-tree -u -m $common $head $merge || exit 1\n result_tree=$(git-write-tree  2> /dev/null)\n if [ $? -ne 0 ]; then\ndiff --git a/merge-base.c b/merge-base.c\n--- a/merge-base.c\n+++ b/merge-base.c\n@@ -82,13 +82,17 @@ static struct commit *interesting(struct\n  * commit B.\n  */\n \n-static struct commit *common_ancestor(struct commit *rev1, struct commit *rev2)\n+static int show_all = 0;\n+\n+static int merge_base(struct commit *rev1, struct commit *rev2)\n {\n \tstruct commit_list *list = NULL;\n \tstruct commit_list *result = NULL;\n \n-\tif (rev1 == rev2)\n-\t\treturn rev1;\n+\tif (rev1 == rev2) {\n+\t\tprintf(\"%s\\n\", sha1_to_hex(rev1->object.sha1));\n+\t\treturn 0;\n+\t}\n \n \tparse_commit(rev1);\n \tparse_commit(rev2);\n@@ -108,7 +112,7 @@ static struct commit *common_ancestor(st\n \t\tif (flags == 3) {\n \t\t\tinsert_by_date(commit, &result);\n \n-\t\t\t/* Mark children of a found merge uninteresting */\n+\t\t\t/* Mark parents of a found merge uninteresting */\n \t\t\tflags |= UNINTERESTING;\n \t\t}\n \t\tparents = commit->parents;\n@@ -122,26 +126,46 @@ static struct commit *common_ancestor(st\n \t\t\tinsert_by_date(p, &list);\n \t\t}\n \t}\n-\treturn interesting(result);\n+\n+\tif (!result)\n+\t\treturn 1;\n+\n+\twhile (result) {\n+\t\tstruct commit *commit = result->item;\n+\t\tresult = result->next;\n+\t\tif (commit->object.flags & UNINTERESTING)\n+\t\t\tcontinue;\n+\t\tprintf(\"%s\\n\", sha1_to_hex(commit->object.sha1));\n+\t\tif (!show_all)\n+\t\t\treturn 0;\n+\t\tcommit->object.flags |= UNINTERESTING;\n+\t}\n+\treturn 0;\n }\n \n+static const char merge_base_usage[] =\n+\"git-merge-base [--all] <commit-id> <commit-id>\";\n+\n int main(int argc, char **argv)\n {\n-\tstruct commit *rev1, *rev2, *ret;\n+\tstruct commit *rev1, *rev2;\n \tunsigned char rev1key[20], rev2key[20];\n \n+\twhile (1 < argc && argv[1][0] == '-') {\n+\t\tchar *arg = argv[1];\n+\t\tif (!strcmp(arg, \"-a\") || !strcmp(arg, \"--all\"))\n+\t\t\tshow_all = 1;\n+\t\telse\n+\t\t\tusage(merge_base_usage);\n+\t\targc--; argv++;\n+\t}\n \tif (argc != 3 ||\n \t    get_sha1(argv[1], rev1key) ||\n-\t    get_sha1(argv[2], rev2key)) {\n-\t\tusage(\"git-merge-base <commit-id> <commit-id>\");\n-\t}\n+\t    get_sha1(argv[2], rev2key))\n+\t\tusage(merge_base_usage);\n \trev1 = lookup_commit_reference(rev1key);\n \trev2 = lookup_commit_reference(rev2key);\n \tif (!rev1 || !rev2)\n \t\treturn 1;\n-\tret = common_ancestor(rev1, rev2);\n-\tif (!ret)\n-\t\treturn 1;\n-\tprintf(\"%s\\n\", sha1_to_hex(ret->object.sha1));\n-\treturn 0;\n+\treturn merge_base(rev1, rev2);\n }\n"},{"id":"7692","messageId":"Pine.LNX.4.58.0508231823420.3317@g5.osdl.org","threadId":"1629","inReplyTo":"7v3bp0m9ax.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-24T01:28:33Z","receivedAt":"2005-08-24T01:28:33Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 23 Aug 2005, Junio C Hamano wrote:\n> \n> Only lightly tested, in the sense that I did only this one case\n> and nothing else.  For a large repository and with complex\n> merges, \"merge-base -a\" _might_ end up reporting many\n> candidates, in which case the pre-merge step to figure out the\n> best merge base may turn out to be disastrously slow.  I dunno.\n\nOk, I think your approach is the correct one. Just list all the commits, \nand let the merge logic figure out which one is the best one.\n\nHere, in case anybody cares, is an alternate approach, which sucks. It \n_happens_ to pick the right parent in this case, but when I look at why it \npicks it, it's pretty much just pure luck again. The distance function is \nnot good.\n\nJust returning several entries is the correct thing to do, because then\nyou can make the distance function be based on the tree diffs, like you\ndo. That's _much_ better than trying to make the distance be based on some\ntopology.\n\nSo I append this patch just as a historical curiosity. Junio's patch is \nclearly superior.\n\n\t\tLinus\n\n---\ndiff --git a/merge-base.c b/merge-base.c\n--- a/merge-base.c\n+++ b/merge-base.c\n@@ -82,10 +82,84 @@ static struct commit *interesting(struct\n  * commit B.\n  */\n \n+/*\n+ * Count the distance from one commit to the base, using a very\n+ * stupid recursive algorithm. We only avoid recursion when seeing\n+ * a single parent.\n+ */\n+static unsigned long count_distance(struct commit *head, struct commit *base)\n+{\n+\tstruct commit_list *parents;\n+\tunsigned long distance = ULONG_MAX;\n+\tunsigned long chain = 1;\n+\n+\t/* Walk the chain of direct parents */\n+\tfor (;;) {\n+\t\tparents = head->parents;\n+\t\tif (!parents)\n+\t\t\tgoto no_parent;\n+\t\t/* Multiple parents? */\n+\t\tif (parents->next)\n+\t\t\tbreak;\n+\t\thead = parents->item;\n+\t\tif (head == base)\n+\t\t\treturn chain;\n+\t\tchain++;\n+\t}\n+\n+\twhile (parents) {\n+\t\tstruct commit *c = parents->item;\n+\t\tunsigned long d;\n+\n+\t\tparents = parents->next;\n+\t\tif (c == base)\n+\t\t\treturn chain;\n+\t\tif (c->object.flags & UNINTERESTING)\n+\t\t\tcontinue;\n+\t\td = count_distance(c, base);\n+\t\tif (d < distance)\n+\t\t\tdistance = d;\n+\t}\n+\tif (distance != ULONG_MAX)\n+\t\treturn distance + chain;\n+no_parent:\n+\treturn ULONG_MAX;\n+}\n+\n+/*\n+ * There are some really nasty cases where we get multiple apparently\n+ * equally valid parents, and we need to disambiguate them.\n+ *\n+ * We aim for the one whose total distance to the two revisions is the\n+ * smallest, where distance is \"x**2 + y**2\" (we _much_ prefer a nice\n+ * balanced equidistant one over one that is near to one but far from\n+ * the other)\n+ */\n+static struct commit *pick_best_commit(struct commit_list *list, struct commit *rev1, struct commit *rev2)\n+{\n+\tunsigned long distance = ULONG_MAX;\n+\tstruct commit *best = NULL;\n+\n+\tdo {\n+\t\tstruct commit *base = list->item;\n+\t\tunsigned long d1 = count_distance(rev1, base);\n+\t\tunsigned long d2 = count_distance(rev2, base);\n+\t\tunsigned long d = d1*d1 + d2*d2;\n+\n+fprintf(stderr, \"distance analysis: %s: %lu %lu %lu\\n\", sha1_to_hex(base->object.sha1), d1, d2, d);\n+\t\tif (d < distance) {\n+\t\t\tdistance = d;\n+\t\t\tbest = base;\n+\t\t}\n+\t} while ((list = list->next) != NULL);\n+\treturn best;\n+}\n+\n static struct commit *common_ancestor(struct commit *rev1, struct commit *rev2)\n {\n \tstruct commit_list *list = NULL;\n \tstruct commit_list *result = NULL;\n+\tstruct commit_list *final = NULL;\n \n \tif (rev1 == rev2)\n \t\treturn rev1;\n@@ -122,7 +196,32 @@ static struct commit *common_ancestor(st\n \t\t\tinsert_by_date(p, &list);\n \t\t}\n \t}\n-\treturn interesting(result);\n+\n+\t/*\n+\t * Go through the result list, and pick out unique\n+\t * members to put on the final list.\n+\t */\n+\twhile (result) {\n+\t\tstruct commit_list *entry = result;\n+\t\tstruct commit *c = result->item;\n+\t\tresult = result->next;\n+\t\tif (c->object.flags & UNINTERESTING)\n+\t\t\tcontinue;\n+\t\tif (c == rev1 || c == rev2)\n+\t\t\treturn c;\n+\t\tentry->next = final;\n+\t\tfinal = entry;\n+\t\tc->object.flags |= UNINTERESTING;\n+\t}\n+\n+\tif (!final)\n+\t\treturn NULL;\n+\n+\t/* Just one entry? */\n+\tif (!final->next)\n+\t\treturn final->item;\n+\n+\treturn pick_best_commit(final, rev1, rev2);\n }\n \n int main(int argc, char **argv)\n"},{"id":"7693","messageId":"1124850327.27033.6.camel@firebird.lenb.worldpath.net","threadId":"1629","inReplyTo":"7v3bp0m9ax.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Len Brown","fromEmail":"len.brown@intel.com","sentAt":"2005-08-24T02:25:27Z","receivedAt":"2005-08-24T02:25:27Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":"On Tue, 2005-08-23 at 21:07 -0400, Junio C Hamano wrote:\n> Junio C Hamano <junkio@cox.net> writes:\n> \n> > Probably the ideal way would be to give merge-base an option to\n> > spit out all the candidates, and have the script try to see\n> > which ones yield the least number of non-trivial merges.\n> \n> I first checked out your 702c7e.. commit, and slurped Linus tip\n> (back then, 81065e2f415af6c028eac13f481fb9e60a0b487b).  Then I\n> ran git resolve with the attached patch (against the tip of\n> git.git \"master\" branch).  Here is what happened, which seems to\n> work a little bit better, at least to me.\n> \n>     prompt$ git checkout -f\n>     prompt$ git status\n>     nothing to commit\n>     prompt$ ls -l .git/HEAD\n>     lrwxrwxrwx  1 junio src 26 Aug 23 15:43 .git/HEAD ->\n> refs/heads/lenb\n>     prompt$ git resolve HEAD origin 'Merge Linus into Lenb'\n>     Trying to find the optimum merge base\n>     Trying to merge 81065e2f415af6c028eac13f481fb9e60a0b487b into\n> 702c7e7626deeabb057b6f529167b65ec2eefbdb using\n> 3edea4833a1efcd43e1dff082bc8001fdfe74b34\n\nLooking at gitk, it certainly chose the right ancestor in this case.\n\n>     Simple merge failed, trying Automatic merge\n>     Auto-merging Documentation/acpi-hotkey.txt.\n>     merge: warning: conflicts during merge\n>     ERROR: Merge conflict in Documentation/acpi-hotkey.txt.\n>     Auto-merging drivers/acpi/osl.c.\n>     fatal: merge program failed\n>     Automatic merge failed, fix up by hand\n> \n> Only lightly tested, in the sense that I did only this one case\n> and nothing else.  For a large repository and with complex\n> merges, \"merge-base -a\" _might_ end up reporting many\n> candidates, in which case the pre-merge step to figure out the\n> best merge base may turn out to be disastrously slow.  I dunno.\n\nIt ran a heck of a lot faster than the alternative -- which\nwould have been to export 85 patches and re-commit them\nto a new tree.\n\nPerhaps Tony's recent merge mystery had the same cause and he can also\nbenefit from this patch?\n\nthanks!\n\n-Len\n"},{"id":"7696","messageId":"Pine.LNX.4.63.0508232231110.23242@iabervon.org","threadId":"1629","inReplyTo":"7v3bp0m9ax.fsf@assigned-by-dhcp.cox.net","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-08-24T03:11:20Z","receivedAt":"2005-08-24T03:11:20Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 23 Aug 2005, Junio C Hamano wrote:\n\n> Only lightly tested, in the sense that I did only this one case\n> and nothing else.  For a large repository and with complex\n> merges, \"merge-base -a\" _might_ end up reporting many\n> candidates, in which case the pre-merge step to figure out the\n> best merge base may turn out to be disastrously slow.  I dunno.\n\nI think it's the right thing to do for now (and what I was going to\nsuggest), and if people find it too slow, we can consider teaching\nread-tree to take multiple common ancestors and use any of them that gives\nclear result on a per-file basis.\n\nOn the other hand, Tony might have hit a bad case with an ill-chosen\ncommon ancestor for a patch/revert sequence, and we probably want to look\ninto that if we've got some history that demonstrates the problem. I think\nthat, if there are two common ancestors, one of which has applied a patch\nand one of which hasn't, and on one side of the merge it gets reverted, we\nshould get the revert, but we'll only get it if we choose the ancestor\nwhere it was applied.\n\n(Letters are versions of the file, which 'b' being the bad patch; the\n second column is the two choices for common ancestor)\n\n  a-b-a-?\n / X   /\na-b-b-b\n\nOf course, you could have the two lines exactly flipped for a different\nfile in the same commits, or for a different hunk in the same file, and\nthere would be no single choice that doesn't lose the revert. The really\nright thing to do is identify that there is a b->a transition that is not\na trivial merge and that is not beyond a common ancestor, but that's hard\nto determine easily and with sufficient granularity to catch everything.\n\nI still someday want to do a version of diff/merge for git that could\nselect common ancestors on a per-hunk basis and identify block moves and\navoid giving confusing (but marginally shorter) diffs, but that's a major\nundertaking that I don't have time for right now.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"7698","messageId":"7vhddgj8j0.fsf@assigned-by-dhcp.cox.net","threadId":"1629","inReplyTo":"Pine.LNX.4.58.0508231823420.3317@g5.osdl.org","subject":"Re: Automatic merge failed, fix up by hand","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-24T03:52:51Z","receivedAt":"2005-08-24T03:52:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> Ok, I think your approach is the correct one. Just list all the commits, \n> and let the merge logic figure out which one is the best one.\n>\n> Just returning several entries is the correct thing to do, because then\n> you can make the distance function be based on the tree diffs, like you\n> do. That's _much_ better than trying to make the distance be based on some\n> topology.\n>\n> So I append this patch just as a historical curiosity. Junio's patch is \n> clearly superior.\n>\n> \t\tLinus\n\nOf course it is clearly superior, because it is not _my_ patch\nbut *yours*.\n\nI just did what you earlier told the world how things should\nwork, based on this message:\n\n    Date:\tMon, 11 Apr 2005 16:48:25 -0700 (PDT)\n    From:\tLinus Torvalds <torvalds@osdl.org>\n    Subject: Re: git: patch for parent-id and idea for merge\n    Message-ID: <Pine.LNX.4.58.0504111631360.1267@ppc970.osdl.org>\n\n    Btw, I've changed the semantics of \"rev-tree\" once again.\n    ...\n    In other words, it will give you a way to figure out which changeset to\n    use as the common one. It's always going to be a parent of one of these\n    edge-commits that has all of its reachability bits set. Which one.. Now\n    that's the question. Maybe just the most recent one, or maybe actually use\n    \"diff-tree\" to see which one generates the fewest conflicts.\n"}]}