diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-11-17 08:59:27 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-17 08:59:27 -0800 |
commit | 643faeea5fdfd8d7c0a6084fd26651f340521483 (patch) | |
tree | 0bed9f9704093f5a897c9095d443bf7f56009358 /t | |
parent | 785c58e5c7b7eaade64621a1ad5090da080c1788 (diff) | |
parent | ce45a45f24cc7b3ccc7f6ebcd0025559b4421bda (diff) | |
download | git-643faeea5fdfd8d7c0a6084fd26651f340521483.tar.gz |
Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
Document git-svn's first-parent rule
git svn: attempt to create empty dirs on clone+rebase
git svn: add authorsfile test case for ~/.gitconfig
git svn: read global+system config for clone+init
git svn: handle SVN merges from revisions past the tip of the branch
Diffstat (limited to 't')
-rwxr-xr-x | t/t9115-git-svn-dcommit-funky-renames.sh | 4 | ||||
-rwxr-xr-x | t/t9130-git-svn-authors-file.sh | 23 | ||||
-rwxr-xr-x | t/t9146-git-svn-empty-dirs.sh | 85 | ||||
-rwxr-xr-x | t/t9151-svn-mergeinfo.sh | 6 | ||||
-rw-r--r-- | t/t9151/make-svnmerge-dump | 32 | ||||
-rw-r--r-- | t/t9151/svn-mergeinfo.dump | 386 |
6 files changed, 476 insertions, 60 deletions
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh index 9be7aefaee..767799e7a7 100755 --- a/t/t9115-git-svn-dcommit-funky-renames.sh +++ b/t/t9115-git-svn-dcommit-funky-renames.sh @@ -19,7 +19,7 @@ test_expect_success 'init and fetch repository' ' ' test_expect_success 'create file in existing ugly and empty dir' ' - mkdir "#{bad_directory_name}" && + mkdir -p "#{bad_directory_name}" && echo hi > "#{bad_directory_name}/ foo" && git update-index --add "#{bad_directory_name}/ foo" && git commit -m "new file in ugly parent" && @@ -37,7 +37,7 @@ test_expect_success 'rename pretty file' ' git update-index --add pretty && git commit -m "pretty :x" && git svn dcommit && - mkdir regular_dir_name && + mkdir -p regular_dir_name && git mv pretty regular_dir_name/pretty && git commit -m "moved pretty file" && git svn dcommit diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh index f5abdb3c7f..134411e0a5 100755 --- a/t/t9130-git-svn-authors-file.sh +++ b/t/t9130-git-svn-authors-file.sh @@ -91,4 +91,27 @@ test_expect_success 'fetch continues after authors-file is fixed' ' ) ' +test_expect_success 'fresh clone with svn.authors-file in config' ' + ( + rm -r "$GIT_DIR" && + test x = x"$(git config svn.authorsfile)" && + HOME="`pwd`" && + export HOME && + test_config="$HOME"/.gitconfig && + unset GIT_CONFIG_NOGLOBAL && + unset GIT_DIR && + unset GIT_CONFIG && + git config --global \ + svn.authorsfile "$HOME"/svn-authors && + test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" && + git svn clone "$svnrepo" gitconfig.clone && + cd gitconfig.clone && + nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) && + nr_rev=$(git rev-list HEAD | wc -l) && + test $nr_rev -eq $nr_ex + ) +' + +test_debug 'GIT_DIR=gitconfig.clone/.git git log' + test_done diff --git a/t/t9146-git-svn-empty-dirs.sh b/t/t9146-git-svn-empty-dirs.sh new file mode 100755 index 0000000000..5948544ec5 --- /dev/null +++ b/t/t9146-git-svn-empty-dirs.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# +# Copyright (c) 2009 Eric Wong + +test_description='git svn creates empty directories' +. ./lib-git-svn.sh + +test_expect_success 'initialize repo' ' + for i in a b c d d/e d/e/f "weird file name" + do + svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" + done +' + +test_expect_success 'clone' 'git svn clone "$svnrepo" cloned' + +test_expect_success 'empty directories exist' ' + ( + cd cloned && + for i in a b c d d/e d/e/f "weird file name" + do + if ! test -d "$i" + then + echo >&2 "$i does not exist" + exit 1 + fi + done + ) +' + +test_expect_success 'more emptiness' ' + svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !" +' + +test_expect_success 'git svn rebase creates empty directory' ' + ( cd cloned && git svn rebase ) + test -d cloned/"! !" +' + +test_expect_success 'git svn mkdirs recreates empty directories' ' + ( + cd cloned && + rm -r * && + git svn mkdirs && + for i in a b c d d/e d/e/f "weird file name" "! !" + do + if ! test -d "$i" + then + echo >&2 "$i does not exist" + exit 1 + fi + done + ) +' + +test_expect_success 'git svn mkdirs -r works' ' + ( + cd cloned && + rm -r * && + git svn mkdirs -r7 && + for i in a b c d d/e d/e/f "weird file name" + do + if ! test -d "$i" + then + echo >&2 "$i does not exist" + exit 1 + fi + done + + if test -d "! !" + then + echo >&2 "$i should not exist" + exit 1 + fi + + git svn mkdirs -r8 && + if ! test -d "! !" + then + echo >&2 "$i not exist" + exit 1 + fi + ) +' + +test_done diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh index 9bee516358..f57daf401a 100755 --- a/t/t9151-svn-mergeinfo.sh +++ b/t/t9151-svn-mergeinfo.sh @@ -15,7 +15,11 @@ test_expect_success 'load svn dump' " git svn fetch --all " -test_expect_success 'svn merges were represented coming in' " +test_expect_success 'represent svn merges without intervening commits' " + [ `git cat-file commit HEAD^1 | grep parent | wc -l` -eq 2 ] + " + +test_expect_success 'represent svn merges with intervening commits' " [ `git cat-file commit HEAD | grep parent | wc -l` -eq 2 ] " diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index e35d64d585..7e3da75f86 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -28,6 +28,10 @@ svn cp trunk branches/left echo "Committing BRANCH POINT" svn commit -m "make left branch" +svn cp trunk branches/right + +echo "Committing other BRANCH POINT" +svn commit -m "make right branch" cd branches/left/ #$sm init @@ -64,7 +68,33 @@ git cat-file blob b51ad431:Makefile > Makefile svn resolved Makefile -svn commit -m "Merge trunk" +svn commit -m "Merge trunk 1" + +# create commits on both branches + +cd ../branches/left +git cat-file blob ff5ebe39:Makefile > Makefile +echo "Committing BRANCH UPDATE 4" +svn commit -m "left update 4" + +cd ../right +git cat-file blob b5039db6:Makefile > Makefile +echo "Committing other BRANCH UPDATE 1" +svn commit -m "right update 1" + +# merge to trun again + +cd ../.. +svn update +cd trunk + +svn merge ../branches/left --accept postpone + +git cat-file blob b51ad431:Makefile > Makefile + +svn resolved Makefile + +svn commit -m "Merge trunk 2" cd ../.. diff --git a/t/t9151/svn-mergeinfo.dump b/t/t9151/svn-mergeinfo.dump index 2153187c9b..11a883fda9 100644 --- a/t/t9151/svn-mergeinfo.dump +++ b/t/t9151/svn-mergeinfo.dump @@ -1,6 +1,6 @@ SVN-fs-dump-format-version: 2 -UUID: 1ce241d1-ba54-4eb9-bded-03057fe48a33 +UUID: 1530d5a2-a1dc-4438-8ad5-d95e96db8945 Revision-number: 0 Prop-content-length: 56 @@ -9,12 +9,12 @@ Content-length: 56 K 8 svn:date V 27 -2009-10-20T01:33:37.692723Z +2009-11-12T20:29:38.812226Z PROPS-END Revision-number: 1 -Prop-content-length: 123 -Content-length: 123 +Prop-content-length: 127 +Content-length: 127 K 7 svn:log @@ -22,12 +22,12 @@ V 24 Setup trunk and branches K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:38.159933Z +2009-11-12T20:29:39.045856Z PROPS-END Node-path: branches @@ -49,8 +49,8 @@ PROPS-END Revision-number: 2 -Prop-content-length: 106 -Content-length: 106 +Prop-content-length: 110 +Content-length: 110 K 7 svn:log @@ -58,12 +58,12 @@ V 8 ancestor K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:39.160059Z +2009-11-12T20:29:40.079587Z PROPS-END Node-path: trunk/Makefile @@ -72,6 +72,7 @@ Node-action: add Prop-content-length: 10 Text-content-length: 2401 Text-content-md5: bfd8ff778d1492dc6758567373176a89 +Text-content-sha1: 103205ce331f7d64086dba497574734f78439590 Content-length: 2411 PROPS-END @@ -155,8 +156,8 @@ backup: clean Revision-number: 3 -Prop-content-length: 115 -Content-length: 115 +Prop-content-length: 119 +Content-length: 119 K 7 svn:log @@ -164,12 +165,12 @@ V 16 make left branch K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:41.148192Z +2009-11-12T20:29:42.084439Z PROPS-END Node-path: branches/left @@ -177,27 +178,54 @@ Node-kind: dir Node-action: add Node-copyfrom-rev: 1 Node-copyfrom-path: trunk -Prop-content-length: 34 -Content-length: 34 -K 13 -svn:mergeinfo -V 0 +Node-path: branches/left/Makefile +Node-kind: file +Node-action: add +Node-copyfrom-rev: 2 +Node-copyfrom-path: trunk/Makefile +Text-copy-source-md5: bfd8ff778d1492dc6758567373176a89 +Text-copy-source-sha1: 103205ce331f7d64086dba497574734f78439590 + + +Revision-number: 4 +Prop-content-length: 120 +Content-length: 120 + +K 7 +svn:log +V 17 +make right branch +K 10 +svn:author +V 8 +tallsopp +K 8 +svn:date +V 27 +2009-11-12T20:29:44.065452Z PROPS-END +Node-path: branches/right +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 1 +Node-copyfrom-path: trunk + -Node-path: branches/left/Makefile +Node-path: branches/right/Makefile Node-kind: file Node-action: add Node-copyfrom-rev: 2 Node-copyfrom-path: trunk/Makefile Text-copy-source-md5: bfd8ff778d1492dc6758567373176a89 +Text-copy-source-sha1: 103205ce331f7d64086dba497574734f78439590 -Revision-number: 4 -Prop-content-length: 112 -Content-length: 112 +Revision-number: 5 +Prop-content-length: 116 +Content-length: 116 K 7 svn:log @@ -205,12 +233,12 @@ V 13 left update 1 K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:42.148773Z +2009-11-12T20:29:45.066262Z PROPS-END Node-path: branches/left/Makefile @@ -218,6 +246,7 @@ Node-kind: file Node-action: change Text-content-length: 2465 Text-content-md5: 16e38d9753b061731650561ce01b1195 +Text-content-sha1: 36da4b84ea9b64218ab48171dfc5c48ae025f38b Content-length: 2465 # -DCOLLISION_CHECK if you believe that SHA1's @@ -299,9 +328,9 @@ backup: clean cd .. ; tar czvf dircache.tar.gz dir-cache -Revision-number: 5 -Prop-content-length: 111 -Content-length: 111 +Revision-number: 6 +Prop-content-length: 115 +Content-length: 115 K 7 svn:log @@ -309,12 +338,12 @@ V 12 trunk update K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:43.159959Z +2009-11-12T20:29:46.278498Z PROPS-END Node-path: trunk/Makefile @@ -322,6 +351,7 @@ Node-kind: file Node-action: change Text-content-length: 2521 Text-content-md5: 0668418a621333f4aa8b6632cd63e2a0 +Text-content-sha1: 4f29afd038e52f45acb5ef8c41acfc70062a741a Content-length: 2521 # -DCOLLISION_CHECK if you believe that SHA1's @@ -406,9 +436,9 @@ backup: clean cd .. ; tar czvf dircache.tar.gz dir-cache -Revision-number: 6 -Prop-content-length: 112 -Content-length: 112 +Revision-number: 7 +Prop-content-length: 116 +Content-length: 116 K 7 svn:log @@ -416,12 +446,12 @@ V 13 left update 2 K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:44.164175Z +2009-11-12T20:29:47.069090Z PROPS-END Node-path: branches/left/Makefile @@ -429,6 +459,7 @@ Node-kind: file Node-action: change Text-content-length: 2529 Text-content-md5: f6b197cc3f2e89a83e545d4bb003de73 +Text-content-sha1: 2f656677cfec0bceec85e53036ffb63e25126f8e Content-length: 2529 # -DCOLLISION_CHECK if you believe that SHA1's @@ -510,9 +541,9 @@ backup: clean cd .. ; tar czvf dircache.tar.gz dir-cache -Revision-number: 7 -Prop-content-length: 112 -Content-length: 112 +Revision-number: 8 +Prop-content-length: 116 +Content-length: 116 K 7 svn:log @@ -520,12 +551,12 @@ V 13 left update 3 K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:45.144214Z +2009-11-12T20:29:48.053835Z PROPS-END Node-path: branches/left/Makefile @@ -533,6 +564,7 @@ Node-kind: file Node-action: change Text-content-length: 2593 Text-content-md5: 5ccff689fb290e00b85fe18ee50c54ba +Text-content-sha1: a13de8e23f1483efca3e57b2b64b0ae6f740ce10 Content-length: 2593 # -DCOLLISION_CHECK if you believe that SHA1's @@ -614,22 +646,22 @@ backup: clean cd .. ; tar czvf dircache.tar.gz dir-cache -Revision-number: 8 -Prop-content-length: 110 -Content-length: 110 +Revision-number: 9 +Prop-content-length: 116 +Content-length: 116 K 7 svn:log -V 11 -Merge trunk +V 13 +Merge trunk 1 K 10 svn:author -V 4 -samv +V 8 +tallsopp K 8 svn:date V 27 -2009-10-20T01:33:48.176135Z +2009-11-12T20:29:51.098306Z PROPS-END Node-path: trunk @@ -641,7 +673,7 @@ Content-length: 53 K 13 svn:mergeinfo V 18 -/branches/left:2-7 +/branches/left:2-8 PROPS-END @@ -650,6 +682,7 @@ Node-kind: file Node-action: change Text-content-length: 2713 Text-content-md5: 0afbe34f244cd662b1f97d708c687f90 +Text-content-sha1: 46d9377d783e67a9b581da110352e799517c8a14 Content-length: 2713 # -DCOLLISION_CHECK if you believe that SHA1's @@ -734,3 +767,244 @@ backup: clean cd .. ; tar czvf dircache.tar.gz dir-cache +Revision-number: 10 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 13 +left update 4 +K 10 +svn:author +V 8 +tallsopp +K 8 +svn:date +V 27 +2009-11-12T20:29:52.081644Z +PROPS-END + +Node-path: branches/left/Makefile +Node-kind: file +Node-action: change +Text-content-length: 2529 +Text-content-md5: f6b197cc3f2e89a83e545d4bb003de73 +Text-content-sha1: 2f656677cfec0bceec85e53036ffb63e25126f8e +Content-length: 2529 + +# -DCOLLISION_CHECK if you believe that SHA1's +# 1461501637330902918203684832716283019655932542976 hashes do not give you +# enough guarantees about no collisions between objects ever hapenning. +# +# -DNSEC if you want git to care about sub-second file mtimes and ctimes. +# Note that you need some new glibc (at least >2.2.4) for this, and it will +# BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly +# break unless your underlying filesystem supports those sub-second times +# (my ext3 doesn't). +CFLAGS=-g -O3 -Wall + +CC=gcc + + +PROG= update-cache show-diff init-db write-tree read-tree commit-tree \ + cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \ + check-files ls-tree merge-base + +all: $(PROG) + +install: $(PROG) + install $(PROG) $(HOME)/bin/ + +LIBS= -lssl -lz + +init-db: init-db.o + +update-cache: update-cache.o read-cache.o + $(CC) $(CFLAGS) -o update-cache update-cache.o read-cache.o $(LIBS) + +show-diff: show-diff.o read-cache.o + $(CC) $(CFLAGS) -o show-diff show-diff.o read-cache.o $(LIBS) + +write-tree: write-tree.o read-cache.o + $(CC) $(CFLAGS) -o write-tree write-tree.o read-cache.o $(LIBS) + +read-tree: read-tree.o read-cache.o + $(CC) $(CFLAGS) -o read-tree read-tree.o read-cache.o $(LIBS) + +commit-tree: commit-tree.o read-cache.o + $(CC) $(CFLAGS) -o commit-tree commit-tree.o read-cache.o $(LIBS) + +cat-file: cat-file.o read-cache.o + $(CC) $(CFLAGS) -o cat-file cat-file.o read-cache.o $(LIBS) + +fsck-cache: fsck-cache.o read-cache.o object.o commit.o tree.o blob.o + $(CC) $(CFLAGS) -o fsck-cache fsck-cache.o read-cache.o object.o commit.o tree.o blob.o $(LIBS) + +checkout-cache: checkout-cache.o read-cache.o + $(CC) $(CFLAGS) -o checkout-cache checkout-cache.o read-cache.o $(LIBS) + +diff-tree: diff-tree.o read-cache.o + $(CC) $(CFLAGS) -o diff-tree diff-tree.o read-cache.o $(LIBS) + +rev-tree: rev-tree.o read-cache.o object.o commit.o tree.o blob.o + $(CC) $(CFLAGS) -o rev-tree rev-tree.o read-cache.o object.o commit.o tree.o blob.o $(LIBS) + +show-files: show-files.o read-cache.o + $(CC) $(CFLAGS) -o show-files show-files.o read-cache.o $(LIBS) + +check-files: check-files.o read-cache.o + $(CC) $(CFLAGS) -o check-files check-files.o read-cache.o $(LIBS) + +ls-tree: ls-tree.o read-cache.o + $(CC) $(CFLAGS) -o ls-tree ls-tree.o read-cache.o $(LIBS) + +merge-base: merge-base.o read-cache.o + $(CC) $(CFLAGS) -o merge-base merge-base.o read-cache.o $(LIBS) + +read-cache.o: cache.h +show-diff.o: cache.h + +clean: + rm -f *.o $(PROG) + +backup: clean + cd .. ; tar czvf dircache.tar.gz dir-cache + + +Revision-number: 11 +Prop-content-length: 117 +Content-length: 117 + +K 7 +svn:log +V 14 +right update 1 +K 10 +svn:author +V 8 +tallsopp +K 8 +svn:date +V 27 +2009-11-12T20:29:53.059636Z +PROPS-END + +Node-path: branches/right/Makefile +Node-kind: file +Node-action: change +Text-content-length: 2593 +Text-content-md5: 5ccff689fb290e00b85fe18ee50c54ba +Text-content-sha1: a13de8e23f1483efca3e57b2b64b0ae6f740ce10 +Content-length: 2593 + +# -DCOLLISION_CHECK if you believe that SHA1's +# 1461501637330902918203684832716283019655932542976 hashes do not give you +# enough guarantees about no collisions between objects ever hapenning. +# +# -DNSEC if you want git to care about sub-second file mtimes and ctimes. +# Note that you need some new glibc (at least >2.2.4) for this, and it will +# BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly +# break unless your underlying filesystem supports those sub-second times +# (my ext3 doesn't). +CFLAGS=-g -O3 -Wall + +CC=gcc + + +PROG= update-cache show-diff init-db write-tree read-tree commit-tree \ + cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \ + check-files ls-tree merge-base + +all: $(PROG) + +install: $(PROG) + install $(PROG) $(HOME)/bin/ + +LIBS= -lssl -lz + +init-db: init-db.o + +update-cache: update-cache.o read-cache.o + $(CC) $(CFLAGS) -o update-cache update-cache.o read-cache.o $(LIBS) + +show-diff: show-diff.o read-cache.o + $(CC) $(CFLAGS) -o show-diff show-diff.o read-cache.o $(LIBS) + +write-tree: write-tree.o read-cache.o + $(CC) $(CFLAGS) -o write-tree write-tree.o read-cache.o $(LIBS) + +read-tree: read-tree.o read-cache.o + $(CC) $(CFLAGS) -o read-tree read-tree.o read-cache.o $(LIBS) + +commit-tree: commit-tree.o read-cache.o + $(CC) $(CFLAGS) -o commit-tree commit-tree.o read-cache.o $(LIBS) + +cat-file: cat-file.o read-cache.o + $(CC) $(CFLAGS) -o cat-file cat-file.o read-cache.o $(LIBS) + +fsck-cache: fsck-cache.o read-cache.o object.o commit.o tree.o blob.o + $(CC) $(CFLAGS) -o fsck-cache fsck-cache.o read-cache.o object.o commit.o tree.o blob.o $(LIBS) + +checkout-cache: checkout-cache.o read-cache.o + $(CC) $(CFLAGS) -o checkout-cache checkout-cache.o read-cache.o $(LIBS) + +diff-tree: diff-tree.o read-cache.o + $(CC) $(CFLAGS) -o diff-tree diff-tree.o read-cache.o $(LIBS) + +rev-tree: rev-tree.o read-cache.o object.o commit.o tree.o blob.o + $(CC) $(CFLAGS) -o rev-tree rev-tree.o read-cache.o object.o commit.o tree.o blob.o $(LIBS) + +show-files: show-files.o read-cache.o + $(CC) $(CFLAGS) -o show-files show-files.o read-cache.o $(LIBS) + +check-files: check-files.o read-cache.o + $(CC) $(CFLAGS) -o check-files check-files.o read-cache.o $(LIBS) + +ls-tree: ls-tree.o read-cache.o + $(CC) $(CFLAGS) -o ls-tree ls-tree.o read-cache.o $(LIBS) + +merge-base: merge-base.o read-cache.o object.o commit.o tree.o blob.o + $(CC) $(CFLAGS) -o merge-base merge-base.o read-cache.o object.o commit.o tree.o blob.o $(LIBS) + +read-cache.o: cache.h +show-diff.o: cache.h + +clean: + rm -f *.o $(PROG) + +backup: clean + cd .. ; tar czvf dircache.tar.gz dir-cache + + +Revision-number: 12 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 13 +Merge trunk 2 +K 10 +svn:author +V 8 +tallsopp +K 8 +svn:date +V 27 +2009-11-12T20:29:56.083003Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: change +Prop-content-length: 54 +Content-length: 54 + +K 13 +svn:mergeinfo +V 19 +/branches/left:2-11 +PROPS-END + + |