git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cherry-pick vs submodule, conflicts
@ 2009-11-13 18:05 Jeff Epler
  0 siblings, 0 replies; only message in thread
From: Jeff Epler @ 2009-11-13 18:05 UTC (permalink / raw)
  To: git

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?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-13 18:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 18:05 cherry-pick vs submodule, conflicts Jeff Epler

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 NNTP newsgroup(s).