cherry-pick vs submodule, conflicts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A fellow git user of mine encountered an unexpected problem cherry-
picking from one branch to another.  The conflict was 'added by us: sub'
and I created a small program that leads to the same message.

#!/bin/bash
# This script demonstrates that it doesn't work to cherry-pick when some (not
# even touched) path is a submodule in HEAD but a regular subdirectory in the
# branch being picked from.
#
# Furthermore, when using 'git mergetool', the (desired?) action 'c'
# gives the error "fatal: unable to stat 'sub': No such file or directory".
#
# The behavior is essentially the same on
# git version 1.6.3.3
# git version 1.6.5.rc1.49.ge970
#
# maybe this is related to
# http://kerneltrap.org/mailarchive/git/2007/7/7/250935
# but the case must be extended to cover submodules?

set -e
BASEDIR=$(pwd)
rm -rf main sub &&
mkdir sub main &&
(cd sub && git init && touch y && git add y && git commit -my) &&
                                        # make a submodule
cd ../main &&
git init &&
touch x; git add x &&
git commit -mx &&                       # initial commit
git branch b &&
mkdir sub &&                            # on master, make sub a subdir
touch sub/y; git add sub/y &&
git commit -my &&
echo 1 > x &&
git commit -mx1 -a &&                   # and create a second commit
CHERRY=$(git rev-parse HEAD) &&         # which is a tasty cherry
git checkout b &&
git submodule add file://$BASEDIR/sub sub &&
git submodule update &&
git commit -my &&                       # on brach, make sub a submodule
! git cherry-pick $CHERRY &&            # pull second commit from master
git status                              # what happened?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]