{"thread":{"id":"27092","subject":"BUG: git-svn dcommit and concurrency (Re: git svn dcommit errors all no-yet-commited changes are left squashed/uncommited?)","startedAt":"2011-04-13T19:48:55Z","lastAt":"2011-04-14T13:05:52Z","messageCount":3,"participants":["Piotr Krukowiecki","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"165774","messageId":"BANLkTikdGPW+B7rAEVj2DZhOS1HrtXjZ4Q@mail.gmail.com","threadId":"27092","inReplyTo":null,"subject":"BUG: git-svn dcommit and concurrency (Re: git svn dcommit errors all no-yet-commited changes are left squashed/uncommited?)","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-04-13T19:48:55Z","receivedAt":"2011-04-13T19:48:55Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"Hello again,\n\nresending mail, this time with involved people on CC and with clearer message.\n\nI believe there's a bug in git-svn dcommit.\n\nIf during dcommit someone else commits to svn repository then git\na) stops\nb) loses commits not-yet dcommitted\n\n\"a\" is bug IMO, because it seems to work sometimes (only for first\ndcommited change?)\n\"b\" is more severe, because it destroys user data (in a way) - you\nhave to use reflog to get it back, I believe.\n\nI have reproduced it locally - added \"sleep\" to git-svn in the dcommit\nloop and did svn commit when it slept.\n\nPasting log from dcommit below. Notes:\n- local git commits and unfetched svn commits were not conflicting\n(changed different files)\n- when starting dcommit there was one unfetched commit (r4) - this\nworked without problems\n- new change commited to svn was r8 - during sleep after r6\n- \"git log remotes/git-svn..\" shows nothing => commit history is lost\n- \"git diff\" shows all not-yet-commited changes merged in working tree\n\n----------------------------------------------------------------------------------------\npiotr@piotr-laptop:/tmp/d/b$ git svn dcommit\nCommitting to file:///tmp/b ...\n\tA\ttwo.txt\nCommitted r5\n\tM\tfile.txt\nr4 = 161ef277a311148c42a4391fab1531b818d6b8ba (refs/remotes/git-svn)\n\tA\ttwo.txt\nr5 = e2ac55eff258832e0dc7612b9a12913c861897a3 (refs/remotes/git-svn)\nW: 9a64a0288d5474a78eb528c81efe38a026331fdb and refs/remotes/git-svn\ndiffer, using rebase:\n:100644 100644 b77ce16c276583c177f535cde69e8764ee4a1497\n928a139863b65711aa12167b81fefccfacc00d69 M\tfile.txt\nFirst, rewinding head to replay your work on top of it...\nApplying: three.txt\nApplying: next\nApplying: next\nApplying: next\nApplying: next\nSleeping...\n\tA\tthree.txt\nCommitted r6\n\tA\tthree.txt\nr6 = fe11637f550e3158acf333cbd6197fbc775d9000 (refs/remotes/git-svn)\nNo changes between current HEAD and refs/remotes/git-svn\nResetting to the latest refs/remotes/git-svn\nUnstaged changes after reset:\nM\tthree.txt\nSleeping...\n\tM\tthree.txt\nCommitted r7\n\tM\tthree.txt\nr7 = 9ebda9f54668427441daa97b0f152eb1885d266b (refs/remotes/git-svn)\nNo changes between current HEAD and refs/remotes/git-svn\nResetting to the latest refs/remotes/git-svn\nUnstaged changes after reset:\nM\tthree.txt\nSleeping...\n\tM\tthree.txt\nCommitted r9\n\tM\tfile.txt\nr8 = 92bcba5a1a5be41d4393be1810bed0e9417da1a8 (refs/remotes/git-svn)\n\tM\tthree.txt\nr9 = 6988d79c042c21534241e4f6e82ef29056ce69bc (refs/remotes/git-svn)\nW: cdc341b381aab0ab01233bcc0b47d36acef75eb8 and refs/remotes/git-svn\ndiffer, using rebase:\n:100644 100644 928a139863b65711aa12167b81fefccfacc00d69\na063167d351d2715c1a612cd0f431ac77b9eba92 M\tfile.txt\nCannot rebase: You have unstaged changes.\nPlease commit or stash them.\nrebase refs/remotes/git-svn: command returned error: 1\n\npiotr@piotr-laptop:/tmp/d/b$ git status\n# On branch master\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tmodified:   three.txt\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\npiotr@piotr-laptop:/tmp/d/b$ git log remotes/git-svn..\npiotr@piotr-laptop:/tmp/d/b$ git diff\ndiff --git a/three.txt b/three.txt\nindex 7bfc0fd..ce447d2 100644\n--- a/three.txt\n+++ b/three.txt\n@@ -1,2 +1,5 @@\n three\n next\n+next\n+next\n+next\n----------------------------------------------------------------------------------------\n\nI'm also attaching \"sleep\" patch, logs from creating/commiting to svn\nrepository and from git svn clone for convenience (some messages from\nsvn are in Polish but that shouldn't matter)\n\ngit version 1.7.5-rc1\n\n\nOn Mon, Apr 11, 2011 at 4:32 PM, Piotr Krukowiecki\n<piotr.krukowiecki@gmail.com> wrote:\n> Hi,\n>\n> I've done some changes to \"local\" trunk, dcomitted them to svn server,\n> then cherry-picked those changes to \"local\" branch and tried to\n> dcommit them to svn.\n> Several changes where successfully dcommited, but then I got an error.\n>\n> Two problems:\n> 1. after the error I'm left with changes not sent to svn server as\n> unstaged changes\n> 2. git-svn errors if someone commits something to svn during my commit\n> even if there is no conflict\n>\n> Even if the second problem is intentional (which I'm not sure is a\n> good idea), the first problem means it's not possible to continue\n> after the error (which is not really an error but should be a warning,\n> even if it stops the dcommit).\n>\n>\n> Full story:\n>\n> The log looked like this:\n>\n> [... this is the end of older commit, which succeeded ...]\n> W: -empty_dir: cptests/branches/a_branch/src/file\n> r23939 = 400e84221ca15be3976ba4dcd6d7a2eb1464b00e (refs/remotes/a_branch)\n> No changes between current HEAD and refs/remotes/a_branch\n> Resetting to the latest refs/remotes/a_branch\n> Unstaged changes after reset:\n> M       src/file\n> [... next commit preparation and commit ...]\n>        R       src/file\n> Committed r23941\n>        M       etc/file.xml\n> r23940 = 420c7b2c8f155563a4f4c8e5421857846bf3ebe5 (refs/remotes/a_branch)\n>        D       src/file\n> [...]\n> r23941 = 010c5b3883c473dd236de1a146fad1e90bd323fd (refs/remotes/a_branch)\n> W: bfb909cb21e26930364331660460ccd7be355a2e and refs/remotes/a_branch\n> differ, using rebase:\n> :040000 040000 5df0982b1cf277dd7d915d32a9ff145554fb9c94\n> a662095f06bd349c1a458d52697561ba9d005bac M      etc\n> Cannot rebase: You have unstaged changes.\n> Please commit or stash them.\n> rebase refs/remotes/a_branch: command returned error: 1\n>\n> Now I was left with all the remaining changes \"squashed\" - git status\n> showed a list of unstaged changes. So all changes not yet commited\n> were in fact lost as commits and left in the working tree as one bit\n> not-yet-added change.\n>\n> I believe the reason for this was that while I was dcommiting my\n> changes someone changed the \"etc/file.xml\"\n>\n> So my previous dcommit was r23939 (src/*). Then someone else checked\n> into svn r23940 (etc/file.xml). Then (or earlier) git svn dcommited\n> r23941 (src/*). After that dcommit stopped with error.\n>\n>\n> In this case I have just reset --hard and cherry-picked changes that\n> were not commited, and it worked this time, but I wonder what should I\n> do next time.\n> What if those are not cherry-picked changes, but normal changes? Will\n> I have to use reflog to get back in time?\n>\n> Also, I think in this case svn might continue with dcommit. It already\n> commited one revision after the other-person commit. The other commit\n> changed a completely different directory.\n>\n> Even if this is left as error, it should be possible to continue\n> dcommit in an easy way. Not-commited changes should not be deleted and\n> left as unstaged changes.\n>\n> Also, the \"you have unstaged changes\" error is not very helpful. I\n> thought it meant it commited a change partially, or maybe some other\n> weird thing happened.\n>\n>\n> Thanks,\n>\n> --\n> Piotr Krukowiecki\n>\n\n\n\n-- \nPiotr Krukowiecki\n\n\npiotr@piotr-laptop:/tmp/c$ svn checkout file:///tmp/b\nPobrano wersję 0.\npiotr@piotr-laptop:/tmp/c$ cd b\npiotr@piotr-laptop:/tmp/c/b$ echo hi > file.txt\npiotr@piotr-laptop:/tmp/c/b$ svn add file.txt\nA         file.txt\npiotr@piotr-laptop:/tmp/c/b$ svn commit\nDodawanie       file.txt\nPrzesyłanie treści pliku .\nZatwierdzona wersja 1.\npiotr@piotr-laptop:/tmp/c/b$ echo svn next >> file.txt && svn commit -m \"svn next\"\nWysyłanie       file.txt\nPrzesyłanie treści pliku .\nZatwierdzona wersja 2.\npiotr@piotr-laptop:/tmp/c/b$ echo svn next >> file.txt && svn commit -m \"svn next\"\nWysyłanie       file.txt\nPrzesyłanie treści pliku .\nZatwierdzona wersja 3.\npiotr@piotr-laptop:/tmp/c/b$ echo svn next >> file.txt && svn commit -m \"svn next\"\nWysyłanie       file.txt\nPrzesyłanie treści pliku .\nZatwierdzona wersja 4.\npiotr@piotr-laptop:/tmp/c/b$ echo svn next >> file.txt && svn commit -m \"svn next\"\nWysyłanie       file.txt\nPrzesyłanie treści pliku .\nZatwierdzona wersja 8.\npiotr@piotr-laptop:/tmp/c/b$ \n\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex bf0451b..0ea5302 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -650,6 +650,8 @@ sub cmd_dcommit {\n \t\t\t\t$linear_refs = \\@l;\n \t\t\t}\n \t\t}\n+\t\tprint \"Sleeping...\\n\";\n+\t\tsleep 10;\n \t}\n \n \tif ($old_head) {\n\n\npiotr@piotr-laptop:/tmp/d$ git svn clone file:///tmp/b\nInitialized empty Git repository in /tmp/d/b/.git/\n\tA\tfile.txt\nr1 = 87028a5d8fec778898be76e99ad791219cf23003 (refs/remotes/git-svn)\nChecked out HEAD:\n  file:///tmp/b r1\npiotr@piotr-laptop:/tmp/d$ cd b\npiotr@piotr-laptop:/tmp/d/b$ ls\nfile.txt\npiotr@piotr-laptop:/tmp/d/b$ git svn info\nPath: .\nURL: file:///tmp/b\nRepository Root: file:///tmp/b\nRepository UUID: 86220547-ff96-4b00-a3f0-fa571945d0ba\nRevision: 1\nNode Kind: directory\nSchedule: normal\nLast Changed Author: piotr\nLast Changed Rev: 1\nLast Changed Date: 2011-04-13 20:55:23 +0200 (śro, 13 kwi 2011)\n\npiotr@piotr-laptop:/tmp/d/b$ echo two > two.txt\npiotr@piotr-laptop:/tmp/d/b$ git add two.txt\npiotr@piotr-laptop:/tmp/d/b$ git commit -m two\n[master 01e5e0a] two\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 two.txt\npiotr@piotr-laptop:/tmp/d/b$ echo three > three.txt\npiotr@piotr-laptop:/tmp/d/b$ git add three.txt\npiotr@piotr-laptop:/tmp/d/b$ git commit -m three.txt\n[master d284768] three.txt\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 three.txt\npiotr@piotr-laptop:/tmp/d/b$ echo next >> three.txt && git add three.txt && git commit -m next\n[master 0a0c0cc] next\n 1 files changed, 1 insertions(+), 0 deletions(-)\npiotr@piotr-laptop:/tmp/d/b$ echo next >> three.txt && git add three.txt && git commit -m next\n[master 77d91f8] next\n 1 files changed, 1 insertions(+), 0 deletions(-)\npiotr@piotr-laptop:/tmp/d/b$ echo next >> three.txt && git add three.txt && git commit -m next\n[master cea17b0] next\n 1 files changed, 1 insertions(+), 0 deletions(-)\npiotr@piotr-laptop:/tmp/d/b$ echo next >> three.txt && git add three.txt && git commit -m next\n[master ff44044] next\n 1 files changed, 1 insertions(+), 0 deletions(-)\npiotr@piotr-laptop:/tmp/d/b$ git log\ncommit ff440444a5b8e380fb44180d86f66bb566907a53\nAuthor: Piotr Krukowiecki <>\nDate:   Wed Apr 13 21:02:21 2011 +0200\n\n    next\n\ncommit cea17b028b195d2988ee5e4dc9da0bd4ffa5c57a\nAuthor: Piotr Krukowiecki <>\nDate:   Wed Apr 13 21:02:21 2011 +0200\n\n    next\n\ncommit 77d91f88bf9ae81d747d80bb5c370d16e76737ff\nAuthor: Piotr Krukowiecki <>\nDate:   Wed Apr 13 21:02:20 2011 +0200\n\n    next\n\ncommit 0a0c0cc0f6121d81392d8df80440bef429270b16\nAuthor: Piotr Krukowiecki <>\nDate:   Wed Apr 13 21:02:19 2011 +0200\n\n    next\n\ncommit d28476865857a9fff237b29869bf21b3c83d916e\nAuthor: Piotr Krukowiecki <>\nDate:   Wed Apr 13 21:01:41 2011 +0200\n\n    three.txt\n\ncommit 01e5e0abb9c133a6ff7ef85bbbdbc2c98229cd68\nAuthor: Piotr Krukowiecki <>\nDate:   Wed Apr 13 21:01:20 2011 +0200\n\n    two\n\ncommit 87028a5d8fec778898be76e99ad791219cf23003\nAuthor: piotr <piotr@86220547-ff96-4b00-a3f0-fa571945d0ba>\nDate:   Wed Apr 13 18:55:23 2011 +0000\n\n    hi\n    \n    \n    git-svn-id: file:///tmp/b@1 86220547-ff96-4b00-a3f0-fa571945d0ba\npiotr@piotr-laptop:/tmp/d/b$ git svn rebase\n\tM\tfile.txt\nr2 = 1055c8a9239d7a75856f94a6479192158e1073ec (refs/remotes/git-svn)\n\tM\tfile.txt\nr3 = c9c918a018d21e6af8f4b3d4e22a2aa700024eca (refs/remotes/git-svn)\nFirst, rewinding head to replay your work on top of it...\nApplying: two\nApplying: three.txt\nApplying: next\nApplying: next\nApplying: next\nApplying: next\npiotr@piotr-laptop:/tmp/d/b$ git svn dcommit\nCommitting to file:///tmp/b ...\n\tA\ttwo.txt\nCommitted r5\n\tM\tfile.txt\nr4 = 161ef277a311148c42a4391fab1531b818d6b8ba (refs/remotes/git-svn)\n\tA\ttwo.txt\nr5 = e2ac55eff258832e0dc7612b9a12913c861897a3 (refs/remotes/git-svn)\nW: 9a64a0288d5474a78eb528c81efe38a026331fdb and refs/remotes/git-svn differ, using rebase:\n:100644 100644 b77ce16c276583c177f535cde69e8764ee4a1497 928a139863b65711aa12167b81fefccfacc00d69 M\tfile.txt\nFirst, rewinding head to replay your work on top of it...\nApplying: three.txt\nApplying: next\nApplying: next\nApplying: next\nApplying: next\nSleeping...\n\tA\tthree.txt\nCommitted r6\n\tA\tthree.txt\nr6 = fe11637f550e3158acf333cbd6197fbc775d9000 (refs/remotes/git-svn)\nNo changes between current HEAD and refs/remotes/git-svn\nResetting to the latest refs/remotes/git-svn\nUnstaged changes after reset:\nM\tthree.txt\nSleeping...\n\tM\tthree.txt\nCommitted r7\n\tM\tthree.txt\nr7 = 9ebda9f54668427441daa97b0f152eb1885d266b (refs/remotes/git-svn)\nNo changes between current HEAD and refs/remotes/git-svn\nResetting to the latest refs/remotes/git-svn\nUnstaged changes after reset:\nM\tthree.txt\nSleeping...\n\tM\tthree.txt\nCommitted r9\n\tM\tfile.txt\nr8 = 92bcba5a1a5be41d4393be1810bed0e9417da1a8 (refs/remotes/git-svn)\n\tM\tthree.txt\nr9 = 6988d79c042c21534241e4f6e82ef29056ce69bc (refs/remotes/git-svn)\nW: cdc341b381aab0ab01233bcc0b47d36acef75eb8 and refs/remotes/git-svn differ, using rebase:\n:100644 100644 928a139863b65711aa12167b81fefccfacc00d69 a063167d351d2715c1a612cd0f431ac77b9eba92 M\tfile.txt\nCannot rebase: You have unstaged changes.\nPlease commit or stash them.\nrebase refs/remotes/git-svn: command returned error: 1\n\npiotr@piotr-laptop:/tmp/d/b$ git status\n# On branch master\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#\tmodified:   three.txt\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\npiotr@piotr-laptop:/tmp/d/b$ git log remotes/git-svn..\npiotr@piotr-laptop:/tmp/d/b$ git diff\ndiff --git a/three.txt b/three.txt\nindex 7bfc0fd..ce447d2 100644\n--- a/three.txt\n+++ b/three.txt\n@@ -1,2 +1,5 @@\n three\n next\n+next\n+next\n+next\npiotr@piotr-laptop:/tmp/d/b$\n"},{"id":"165788","messageId":"20110413224010.GA7640@dcvr.yhbt.net","threadId":"27092","inReplyTo":"BANLkTikdGPW+B7rAEVj2DZhOS1HrtXjZ4Q@mail.gmail.com","subject":"Re: BUG: git-svn dcommit and concurrency (Re: git svn dcommit errors all no-yet-commited changes are left squashed/uncommited?)","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2011-04-13T22:40:10Z","receivedAt":"2011-04-13T22:40:10Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Piotr Krukowiecki <piotr.krukowiecki@gmail.com> wrote:\n> resending mail, this time with involved people on CC and with clearer message.\n\nSorry, I don't have time to deal with this in the near future.\nHopefully someone else can fix it.\n\n-- \nEric Wong\n"},{"id":"165806","messageId":"BANLkTi=zPehpahLZ8--GShey1kpxf85Tqg@mail.gmail.com","threadId":"27092","inReplyTo":"20110413224010.GA7640@dcvr.yhbt.net","subject":"Re: BUG: git-svn dcommit and concurrency (Re: git svn dcommit errors all no-yet-commited changes are left squashed/uncommited?)","fromName":"Piotr Krukowiecki","fromEmail":"piotr.krukowiecki@gmail.com","sentAt":"2011-04-14T13:05:52Z","receivedAt":"2011-04-14T13:05:52Z","isPatch":false,"sender":{"key":"piotr.krukowiecki@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3259959?v=4"},"body":"On Thu, Apr 14, 2011 at 12:40 AM, Eric Wong <normalperson@yhbt.net> wrote:\n> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> wrote:\n>> resending mail, this time with involved people on CC and with clearer message.\n>\n> Sorry, I don't have time to deal with this in the near future.\n> Hopefully someone else can fix it.\n\nOK, I'll try to debug this more later today.\n\nI found a blog post about how to act when dcommit fails halfway -\nproviding for convenience:\n\nhttp://blogs.gnome.org/diegoe/2009/03/18/saving-your-neck-when-git-svn-dcommit-fails/\n\n\n-- \nPiotr Krukowiecki\n"}]}