{"thread":{"id":"46111","subject":"issue: \"git subtree split\" vs \"git svn fetch\" consequences","startedAt":"2017-06-03T23:41:46Z","lastAt":"2017-06-03T23:41:46Z","messageCount":1,"participants":["Andry"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"321488","messageId":"1187166615.20170604023631@inbox.ru","threadId":"46111","inReplyTo":null,"subject":"issue: \"git subtree split\" vs \"git svn fetch\" consequences","fromName":"Andry","fromEmail":"andry@inbox.ru","sentAt":"2017-06-03T23:36:31Z","receivedAt":"2017-06-03T23:41:46Z","isPatch":false,"sender":{"key":"andry@inbox.ru","avatar":null},"body":"Hi, git folks!\n\nI think i've found something about inconsistency between \"git subtree split\" and \"git svn fetch\".\n\nFirst of all, \"git subtree split\" ignores commits with 0 changed files, when the \"git svn fetch\" is not.\nFor example, it could be an svn commit where only properties has changed, but no file changes.\n\nSecond, seems \"git subtree split\" and \"git svn fetch\" produces different commit hashes for the same commits.\n\nExperiment:\n\nFor instance, we have SVN repo: repoA with project in subdirectory, say repoA/B.\n\nIf try to make \"git svn clone repoA A.git\" and \"git svn clone repoA/B B.git\", then you will get totally different commit's hash list:\n\n>cd A.git\n>git log --pretty=oneline master\n<GUID_A1> (HEAD -> master, git-svn) A1\n<GUID_B1x> B1\n<GUID_A2> A2\n<GUID_B2x> B2\n...\n<GUID_AN> AN\n<GUID_BNx> BN\n\n>cd ../B.git\n>git log --pretty=oneline master\n<GUID_B1> (HEAD -> master, git-svn) B1\n<GUID_B2> B2\n...\n<GUID_BN> BN\n\n,where <GUID_Bk> not equal to the same commit <GUID_Bkx>, where k=1..N.\n\nI beleave git does create a commit hash using eigher distance to the root, or previous commit hash in a commit chain.\nAnyway, whatever it does this all leads to unavailability to synchronize such working copies which has been made through the \"git svn clone repoA\"+\"git subtree split --prefix=B\"+\"git clone repoB.git\"\nwith the SVN repository referenced by next call to the \"git svn init repoA/B\".\n\nIn another words, say we already have a git repository made from \"git subtree split\" - repoB.git.\n\nNow, this set of commands looks resonable:\n\n>git clone repoB.git B.git\nCloning into 'B.git'...\nremote: Counting objects: 931, done.\nremote: Compressing objects: 100% (395/395), done.\nremote: Total 931 (delta 517), reused 931 (delta 517), pack-reused 0\nReceiving objects: 100% (931/931), 10.15 MiB | 475.00 KiB/s, done.\nResolving deltas: 100% (517/517), done.\n\n>cd B.git\n\n>git log --pretty=online --grep=git-svn-id: master\n<GUID_B1> (HEAD -> master, git-svn) B1\n<GUID_B2> B2\n...\n<GUID_BN> BN\n\n>git svn init repoA/B\n\n>git update-ref refs/remotes/git-svn <GUID_B1>\n\n(This one is important here, otherwise the next \"git svn fetch\" will retake whole svn repository from 0, which is might be too long if there is hundreds of revisions.)\n\n(take a notice, the problem goes from here, see details below)\n\n>git svn fetch\nRebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID> ...\nr4 = <GUID_BN>\nr6 = <GUID_BN-1>\nr12 = <GUID_BN-2>\n...\nrM-1 = <GUID_B2>\nrM = <GUID_B1>\nDone rebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID>\n        <some taken files here>\nrNEW = <GUID_NEW> (refs/remotes/git-svn)\n\n>git svn rebase\nFirst, rewinding head to replay your work on top of it...\nFast-forwarded master to refs/remotes/git-svn.\n\n>git push origin master\nCounting objects: 3, done.\nDelta compression using up to 6 threads.\nCompressing objects: 100% (3/3), done.\nWriting objects: 100% (3/3), 375 bytes | 0 bytes/s, done.\nTotal 3 (delta 2), reused 0 (delta 0)\nremote: Resolving deltas: 100% (2/2), completed with 2 local objects.\nTo repoB.git\n   <GUID_B1>..<GUID_NEW>  master -> master\n\nAnd it seems is all ok, but for one exception. The repoB.git is not the subtree splitted repository.\nThis is repository directly cloned from the SVN repoA/B just before rNEW commit has made into the SVN repository which is made in turn after the clone.\n\nThe real output is this:\n\n>git svn fetch\nRebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID> ...\nDone rebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID>\nRebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID> ...\nDone rebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID>\nRebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID> ...\nDone rebuilding .git/svn/refs/remotes/git-svn/.rev_map.<A_GUID>\nIndex mismatch: <GUID_X> != <GUID_Y>\nrereading <GUID_Z>\n        <some taken files here>\nW: -empty_dir: blabla1\nW: -empty_dir: blabla2\n...\nW: -empty_dir: blablaL\nLast fetched revision of refs/remotes/git-svn was r92, but we are about to fetch: r4!\n\nI googled the whole internet inside out, but there is just no any solution for it.\nIt's broken and nothing about it.\n\nThe only solution i see here is just throw \"git subtree split\" as a hindering garbage for the sake of git-svn synchronization.\n\n"}]}