{"thread":{"id":"38209","subject":"Are simultaneous fetches safe?","startedAt":"2014-12-19T19:17:53Z","lastAt":"2014-12-19T19:17:53Z","messageCount":1,"participants":["Craig Silverstein"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"253862","messageId":"CAGXKyzFfzxwhQJJWXqivU2U940Pq3my_gTKS6RJzfO_OVsOygg@mail.gmail.com","threadId":"38209","inReplyTo":null,"subject":"Are simultaneous fetches safe?","fromName":"Craig Silverstein","fromEmail":"csilvers@khanacademy.org","sentAt":"2014-12-19T19:17:53Z","receivedAt":"2014-12-19T19:17:53Z","isPatch":false,"sender":{"key":"csilvers@khanacademy.org","avatar":null},"body":"(Separated out from another thread since this issue seems more general.)\n\nI am planning to use 'git new-workdir', which basically lets several\nworkspaces share a single .git/refs directory. (Among other dirs in\n.git) It's possible that I'll end up running 'git fetch' in these\nworkspaces simultaneously, meaning they'll be trying to update\n.git/ref at the same time.  Is this safe?  I know there's a push-lock,\nbut there doesn't seem to be a fetch-lock.\n\nWhen I tried it, I got some errors:\n\nRunning 'git fetch' in window 1:\n---\nkhan% git fetch origin\nremote: Counting objects: 37, done.\nremote: Compressing objects: 100% (37/37), done.\nremote: Total 37 (delta 11), reused 0 (delta 0)\nUnpacking objects: 100% (37/37), done.\nFrom github.com:Khan/webapp\n   1f893f3..a9d6739  master     -> origin/master\n   2641d9f..b630758  athena     -> origin/athena\n + 2a83b90...b7ca8be chris      -> origin/chris  (forced update)\n   0e74194..a9d6739  sat        -> origin/sat\n * [new tag]         gae-1219-0726-b7ca8bef9b50 -> gae-1219-0726-b7ca8bef9b50\n * [new tag]         gae-1219-0908-a9d67391b44c -> gae-1219-0908-a9d67391b44c\n---\n\nRunning 'git fetch' in window2 at the same time, in the same directory:\n---\nkhan% git fetch origin\nerror: Ref refs/remotes/origin/master is at\na9d67391b44cc8df8336afbc0b0a53691eae1bd4 but expected\n1f893f3a4d78012964fc7fb93d1f61eacb1b4858\nFrom github.com:Khan/webapp\n ! 1f893f3..a9d6739  master     -> origin/master  (unable to update local ref)\nerror: Ref refs/remotes/origin/athena is at\nb63075834f77e494c56aade8ef8d7154f174865c but expected\n2641d9ff052769aca8919c5528f02d65210a12cf\n ! 2641d9f..b630758  athena     -> origin/athena  (unable to update local ref)\nerror: Ref refs/remotes/origin/chris is at\nb7ca8bef9b5011aa763104f1193b60dd91e0ba0c but expected\n2a83b9042cfd1d73970cf0333910f4db978fbc71\n ! 2a83b90...b7ca8be chris      -> origin/chris  (unable to update local ref)\nerror: Ref refs/remotes/origin/sat is at\na9d67391b44cc8df8336afbc0b0a53691eae1bd4 but expected\n0e74194f8a07a13dbae023f88d9cdf2ddcc3566f\n ! 0e74194..a9d6739  sat        -> origin/sat  (unable to update local ref)\n * [new tag]         gae-1219-0726-b7ca8bef9b50 -> gae-1219-0726-b7ca8bef9b50\n * [new tag]         gae-1219-0908-a9d67391b44c -> gae-1219-0908-a9d67391b44c\n---\n\nAre these errors benign, or is there the risk of corruption of some\nkind?  Is there the possibility of corruption in other dirs as well,\nsuch as .git/objects?\n\nIs it possible that both fetch's could prompt a gc run, and if so, is\nthere a risk that two gc's running simultaneously could cause\nproblems?\n\n(Here's the full list of .git dirs shared across workspaces, according\nto https://github.com/git/git/blob/master/contrib/workdir/git-new-workdir):\n   config refs logs/refs objects info hooks packed-refs remotes rr-cache svn\n\nThanks,\ncraig\n"}]}