diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t --- a/tests/test-convert-git.t +++ b/tests/test-convert-git.t @@ -681,14 +681,14 @@ $ cd git-testrevs $ git init Initialized empty Git repository in $TESTTMP/git-testrevs/.git/ - $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null - $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null + $ echo a >> a ; git add a > /dev/null; commit -m 'first' + $ echo a >> a ; git add a > /dev/null; commit -m 'master commit' $ git checkout -b goodbranch 'HEAD^' Switched to a new branch 'goodbranch' - $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null + $ echo a >> b ; git add b > /dev/null; commit -m 'good branch commit' $ git checkout -b badbranch 'HEAD^' Switched to a new branch 'badbranch' - $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null + $ echo a >> c ; git add c > /dev/null; commit -m 'bad branch commit' $ cd .. $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch initializing destination hg-testrevs repository @@ -696,14 +696,14 @@ sorting... converting... 2 first - 1 good branch commit - 0 master commit + 1 master commit + 0 good branch commit updating bookmarks $ cd hg-testrevs $ hg log -G -T '{rev} {bookmarks}' - o 2 master + o 2 goodbranch | - | o 1 goodbranch + | o 1 master |/ o 0 @@ -717,6 +717,9 @@ $ echo 'sub' >> foo $ git add foo $ commit -a -m 'addfoo' +This is non-deterministic because `pwd` is likely inside a temp directory +and this value gets written into the .gitmodules file, thus changing hashes +of everything derived from it. $ BASE=`pwd` $ cd .. $ mkdir git-repo6 @@ -732,7 +735,7 @@ > path = git-repo5 > url = git-repo5 > EOF - $ git commit -q -a -m "weird white space submodule" + $ commit -q -a -m "weird white space submodule" $ cd .. $ hg convert git-repo6 hg-repo6 initializing destination hg-repo6 repository @@ -753,8 +756,8 @@ $ git checkout HEAD .gitmodules $ git rm .gitmodules rm '.gitmodules' - $ git commit -q -m "remove .gitmodules" .gitmodules - $ git commit -q -m "missing .gitmodules" + $ commit -q -m "remove .gitmodules" .gitmodules + $ commit -q -m "missing .gitmodules" $ cd .. $ hg convert git-repo6 hg-repo6 --traceback 2>&1 | grep -v "fatal: Path '.gitmodules' does not exist" initializing destination hg-repo6 repository @@ -815,7 +818,7 @@ bookmark: master tag: tip user: nottest - date: Mon Jan 01 00:00:23 2007 +0000 + date: Mon Jan 01 00:00:27 2007 +0000 files: .hgsub .hgsubstate description: addsubmodule @@ -884,13 +887,9 @@ $ git init git-repo7 Initialized empty Git repository in $TESTTMP/git-repo7/.git/ $ cd git-repo7 -TODO: it'd be nice to use (?) lines instead of grep -v to handle the -git output variance, but that doesn't currently work in the middle of -a block, so do this for now. - $ touch a && git add a && git commit -am "commit a" | grep -v changed - [master (root-commit) 8ae5f69] commit a - Author: nottest - create mode 100644 a + $ touch a && git add a && commit -am "commit a" + $ git rev-parse HEAD + b77d4d3dca7949aa425aba5d218042a385065923 $ cd .. $ git clone git-repo7 git-repo7-client Cloning into 'git-repo7-client'... @@ -903,15 +902,15 @@ 0 commit a updating bookmarks $ hg -R hg-repo7 bookmarks - master 0:03bf38caa4c6 - origin/master 0:03bf38caa4c6 + master 0:28a7d3f23427 + origin/master 0:28a7d3f23427 Run convert when the remote branches have changed (there was an old bug where the local convert read branches from the server) $ cd git-repo7 $ echo a >> a - $ git commit -q -am "move master forward" + $ commit -q -am "move master forward" $ cd .. $ rm -rf hg-repo7 $ hg convert --config convert.git.remoteprefix=origin git-repo7-client hg-repo7 @@ -922,8 +921,8 @@ 0 commit a updating bookmarks $ hg -R hg-repo7 bookmarks - master 0:03bf38caa4c6 - origin/master 0:03bf38caa4c6 + master 0:28a7d3f23427 + origin/master 0:28a7d3f23427 damaged git repository tests: In case the hard-coded hashes change, the following commands can be used to @@ -959,7 +958,7 @@ $ git init '`echo pwned >COMMAND-INJECTION`' Initialized empty Git repository in $TESTTMP/`echo pwned >COMMAND-INJECTION`/.git/ $ cd '`echo pwned >COMMAND-INJECTION`' - $ git commit -q --allow-empty -m 'empty' + $ commit -q --allow-empty -m 'empty' $ cd .. $ hg convert '`echo pwned >COMMAND-INJECTION`' 'converted' initializing destination converted repository @@ -976,7 +975,7 @@ $ git init 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' Initialized empty Git repository in $TESTTMP/ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #/.git/ $ cd 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' - $ git commit -q --allow-empty -m 'empty' + $ commit -q --allow-empty -m 'empty' $ cd .. $ hg convert 'ext::sh -c echo% pwned% >GIT-EXT-COMMAND-INJECTION% #' 'converted-git-ext' initializing destination converted-git-ext repository @@ -999,13 +998,14 @@ $ commit -m initial $ echo 1 > foo $ tree=`git write-tree` + $ parent=`git rev-parse HEAD` Git doesn't provider a user-facing API to write extra metadata into the commit, so create the commit object by hand $ git hash-object -t commit -w --stdin << EOF > tree ${tree} - > parent ba6b1344e977ece9e00958dbbf17f1f09384b2c1 + > parent ${parent} > author test 1000000000 +0000 > committer test 1000000000 +0000 > extra-1 extra-1 @@ -1014,9 +1014,9 @@ > > message with extras > EOF - 8123727c8361a4117d1a2d80e0c4e7d70c757f18 + 9a234dca4345fc0263417fd58f23d071233d4d45 - $ git reset --hard 8123727c8361a4117d1a2d80e0c4e7d70c757f18 > /dev/null + $ git reset --hard 9a234dca4345fc0263417fd58f23d071233d4d45 > /dev/null $ cd .. @@ -1032,17 +1032,17 @@ updating bookmarks $ hg -R hgextras1 log --debug -r 1 - changeset: 1:e13a39880f68479127b2a80fa0b448cc8524aa09 + changeset: 1:eb0a79a9d51fc8310cf9d569f1703d41a0acf823 bookmark: master tag: tip phase: draft - parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 + parent: 0:7cc0c933b0b075a2a6c36cb9b1638f9bb54394b3 parent: -1:0000000000000000000000000000000000000000 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 user: test date: Sun Sep 09 01:46:40 2001 +0000 extra: branch=default - extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 + extra: convert_revision=9a234dca4345fc0263417fd58f23d071233d4d45 description: message with extras @@ -1067,17 +1067,17 @@ updating bookmarks $ hg -R hgextras2 log --debug -r 1 - changeset: 1:d40fb205d58597e6ecfd55b16f198be5bf436391 + changeset: 1:ee0741577061d2a30889ba3138797a59185010df bookmark: master tag: tip phase: draft - parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 + parent: 0:7cc0c933b0b075a2a6c36cb9b1638f9bb54394b3 parent: -1:0000000000000000000000000000000000000000 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 user: test date: Sun Sep 09 01:46:40 2001 +0000 extra: branch=default - extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 + extra: convert_revision=9a234dca4345fc0263417fd58f23d071233d4d45 extra: extra-1=extra-1 description: message with extras @@ -1096,17 +1096,17 @@ updating bookmarks $ hg -R hgextras3 log --debug -r 1 - changeset: 1:0105af33379e7b6491501fd34141b7af700fe125 + changeset: 1:e3ef3af18ebac06c213cd0194d306f6c591a0c9b bookmark: master tag: tip phase: draft - parent: 0:dcb68977c55cd02cbd13b901df65c4b6e7b9c4b9 + parent: 0:7cc0c933b0b075a2a6c36cb9b1638f9bb54394b3 parent: -1:0000000000000000000000000000000000000000 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 user: test date: Sun Sep 09 01:46:40 2001 +0000 extra: branch=default - extra: convert_revision=8123727c8361a4117d1a2d80e0c4e7d70c757f18 + extra: convert_revision=9a234dca4345fc0263417fd58f23d071233d4d45 extra: extra-1=extra-1 extra: extra-2=extra-2 with space description: @@ -1126,11 +1126,11 @@ updating bookmarks $ hg -R hgextras4 log --debug -r 1 - changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c + changeset: 1:2f6315d25e96c4496516c4c93a439bc7f22c50b2 bookmark: master tag: tip phase: draft - parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d + parent: 0:ba282370acbe8adbb6c2b5b1036d4f7e8c10ff0c parent: -1:0000000000000000000000000000000000000000 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 user: test @@ -1154,11 +1154,11 @@ updating bookmarks $ hg -R hgextras5 log --debug -r 1 - changeset: 1:574d85931544d4542007664fee3747360e85ee28 + changeset: 1:730cc22ac35bf6010a5205dd37bd8e8bf679eb24 bookmark: master tag: tip phase: draft - parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d + parent: 0:ba282370acbe8adbb6c2b5b1036d4f7e8c10ff0c parent: -1:0000000000000000000000000000000000000000 manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 user: test