All of lore.kernel.org
 help / color / mirror / Atom feed
* Possible bug with git subtree pull
@ 2019-06-07 22:30 Douglas J. Clutter
  0 siblings, 0 replies; only message in thread
From: Douglas J. Clutter @ 2019-06-07 22:30 UTC (permalink / raw)
  To: git

It appears the git subtree pull command may have some problems.

The script below demonstrates the problem as follows:
1) Create a repo with a lib folder
2) Create another repo that uses the lib folder via git subtree push/add - the initial operation works as expected
3) Update the original lib folder as follows: modify an existing file and add a new file
4) Commit the changes reports "1 file changed, 1 insertion(+)"
5) Use git subtree push/pull - seems to work: returns message "1 file changed, 1 insertion(+)"
6) The new file is there, but the changed file is not updated

The expected behavior is:
	git subtree pull - would merge both the updated file and the new file

Actual behavior is:
	git subtree pull - adds the new file but does not merge changes to the existing file

Have confirmed behavior on both Windows and Ubuntu.

git --version is 2.17.1 in Ubuntu

Here is the full Ubuntu script:
clear
echo Test git subtree

export gitTestRoot="/home/dougc/git-test"
export librepo="$gitTestRoot/librepo"
export uselibrepo="$gitTestRoot/uselibrepo"

echo Clean-up
cd /
rm -rf $gitTestRoot

echo Initialize repos
mkdir $gitTestRoot
mkdir $librepo
cd $librepo
git init
mkdir $uselibrepo
cd $uselibrepo
git init

echo Add files to librepo
cd $librepo
echo Hi >fileInRoot.txt
mkdir lib
cd lib
echo Mom >fileInLib.txt
cd ..
git add fileInRoot.txt
git add lib/fileInLib.txt
git commit -m "Initial files in repo with lib"

echo Add files to uselibrepo
cd $uselibrepo
echo Excellent>file1.txt
git add file1.txt
git commit -m "Initial files in repo that will have lib subtree"

echo Add subtree to uselibrepo
cd $librepo
git subtree push --prefix=lib $uselibrepo libBranch
cd $uselibrepo
git subtree add --prefix=lib $uselibrepo libBranch
git branch -D libBranch

echo Add/change files in lib
cd $librepo/lib
echo Dad >fileInLib.txt
echo Adventure >anotherLib.txt
git add anotherLib.txt
git commit -m "Updates to lib in original location"

echo Share changes
cd $librepo
git subtree push --prefix=lib $uselibrepo libBranch
cd $uselibrepo
git subtree pull --prefix=lib -m "Merging" $uselibrepo libBranch
git branch -D libBranch

echo New file is found in both places
cat $librepo/lib/anotherLib.txt
cat $uselibrepo/lib/anotherLib.txt

echo Changed file is NOT the same in both places
cat $librepo/lib/fileInLib.txt
cat $uselibrepo/lib/fileInLib.txt


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

only message in thread, other threads:[~2019-06-07 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 22:30 Possible bug with git subtree pull Douglas J. Clutter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.