{"thread":{"id":"17227","subject":"[PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","startedAt":"2009-01-17T16:15:43Z","lastAt":"2009-01-19T19:48:36Z","messageCount":6,"participants":["Adeodato Simó","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"100855","messageId":"1232208943-31756-1-git-send-email-dato@net.com.org.es","threadId":"17227","inReplyTo":null,"subject":"[PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-01-17T16:15:43Z","receivedAt":"2009-01-17T16:15:43Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"If logs/refs or rr-cache are dangling symlinks in the workdir, and reflogs\nand/or rerere are enabled, commit will die with \"fatal: Could not create\ndirectory\". (In the case of rr-cache, it will die after having created the\ncommit.)\n\nThis commit just creates logs/refs and rr-cache in the origin repository if\nthey don't exist already.\n\nSigned-off-by: Adeodato Simó <dato@net.com.org.es>\n---\n contrib/workdir/git-new-workdir |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir\nindex 993cacf..a4e89d0 100755\n--- a/contrib/workdir/git-new-workdir\n+++ b/contrib/workdir/git-new-workdir\n@@ -66,6 +66,12 @@ mkdir -p \"$new_workdir/.git\" || die \"unable to create \\\"$new_workdir\\\"!\"\n for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn\n do\n \tcase $x in\n+\tlogs/refs|rr-cache)\n+\t\tif [ ! -e \"$git_dir/$x\" ]; then\n+\t\t\tmkdir -p \"$git_dir/$x\"\n+\t\tfi\n+\tesac\n+\tcase $x in\n \t*/*)\n \t\tmkdir -p \"$(dirname \"$new_workdir/.git/$x\")\"\n \t\t;;\n-- \n1.6.1.263.g35eb3c\n"},{"id":"100904","messageId":"7vbpu54cxe.fsf@gitster.siamese.dyndns.org","threadId":"17227","inReplyTo":"1232208943-31756-1-git-send-email-dato@net.com.org.es","subject":"Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-18T01:31:57Z","receivedAt":"2009-01-18T01:31:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adeodato Simó <dato@net.com.org.es> writes:\n\n> If logs/refs or rr-cache are dangling symlinks in the workdir, and reflogs\n> and/or rerere are enabled, commit will die with \"fatal: Could not create\n> directory\". (In the case of rr-cache, it will die after having created the\n> commit.)\n>\n> This commit just creates logs/refs and rr-cache in the origin repository if\n> they don't exist already.\n\nHmm, is that better than not creating the symlink of the borrowed\nrepository does not have them?\n"},{"id":"100950","messageId":"20090118113830.GA1394@chistera.yi.org","threadId":"17227","inReplyTo":"7vbpu54cxe.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-01-18T11:38:30Z","receivedAt":"2009-01-18T11:38:30Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Junio C Hamano [Sat, 17 Jan 2009 17:31:57 -0800]:\n\n> Adeodato Simó <dato@net.com.org.es> writes:\n\n> > If logs/refs or rr-cache are dangling symlinks in the workdir, and reflogs\n> > and/or rerere are enabled, commit will die with \"fatal: Could not create\n> > directory\". (In the case of rr-cache, it will die after having created the\n> > commit.)\n\n> > This commit just creates logs/refs and rr-cache in the origin repository if\n> > they don't exist already.\n\n> Hmm, is that better than not creating the symlink of the borrowed\n> repository does not have them?\n\nI would say so. I'll agree this covers a less common case, because one\nnormally starts a regular repo, work on it, and at some point realize\nyou'd like another checkout, and create a workdir. By that point, logs/refs\nsurely should exist in the original repo.\n\nHowever, I've as of late directly created bare repositories knowing that\nI wanted to work just with workdirs against it. In this case, the logs\nfor each checkout'ed branch will be stored in the workdirs and not the\nrepo, so deleting the workdir will make you lose those logs. Which is\nbad, since workdirs should always be safe to delete.\n\nAs I said, I realized this is a bit of a cornercase, but I think it\nwould be nice solving in the proposed way. (If you want, I can put a\nshorter version of the above rationale in the commit message.)\n\nThanks,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \nLa música es de los que la quieren escuchar y de nadie más.\n                -- Andrés Calamaro\n"},{"id":"101050","messageId":"7vskngwfko.fsf@gitster.siamese.dyndns.org","threadId":"17227","inReplyTo":"20090118113830.GA1394@chistera.yi.org","subject":"Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-18T19:59:35Z","receivedAt":"2009-01-18T19:59:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adeodato Simó <dato@net.com.org.es> writes:\n\n> However, I've as of late directly created bare repositories knowing that\n> I wanted to work just with workdirs against it. In this case, the logs\n> for each checkout'ed branch will be stored in the workdirs and not the\n> repo, so deleting the workdir will make you lose those logs. Which is\n> bad, since workdirs should always be safe to delete.\n\nI had to think about the above for a while, but after realizing that you\nhave a strict distinction between a \"workdir\" and a normal \"repository\nwith a work tree\" in mind, I can see where you are coming from.  A workdir\nis transient in nature and you should be able to dismiss it safely as long\nas the repository it borrows from is intact.\n\nBut \"safely\" is somewhat relative.\n\nWhat state would you be discarding when you remove a workdir?  I can think\nof:\n\n - local uncommitted changes, in the work tree contents and in the index\n   (obviously);\n\n - reflog for the HEAD (aka branch switching);\n\n - what branch you had checked out when you discarded the workdir;\n\nand everything else (commits created, the tips and histories of refs,\nconfiguration changes) are kept in the .git repository of the original.\n\nBut what if the original does _not_ want to keep track of changes of\ncertain nature?  It is nonsensical for the original not to want to keep\nthe commits nor the tips of the refs, but it is not unreasonable for a\nbare repository used as a distribution point not want to keep reflogs, for\nexample.  A workdir could be defined as \"a transient work tree created on\nan existing repository, the side effects of working in which are saved to\nthe original repository (except for the ones listed above).  The kind of\nside effects saved are however limited to the ones that are saved while\nworking in the original repository.\"\n\nWith such a definition, you can \"safely\" create a workdir out of a bare\nrepository, without fear of contaminating it with unwanted reflogs.\n\nI tend to think the definition your patch seems to use would be more\nuseful in practice, though.\n\n    A workdir is a new work area that is not a normal \"work tree with a\n    full repository\", but borrows from an existing repository.  Any side\n    effect from the work you do in a workdir will be saved in the original\n    repository, and removing one would lose only the three kind of\n    information listed above.  Creating a new workdir has the side effect\n    of enabling reflogs and rerere in the original repository.\n\nBut the last sentence somehow feels dirty.\n"},{"id":"101126","messageId":"20090119122018.GA25566@chistera.yi.org","threadId":"17227","inReplyTo":"7vskngwfko.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-01-19T12:20:18Z","receivedAt":"2009-01-19T12:20:18Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Junio C Hamano [Sun, 18 Jan 2009 11:59:35 -0800]:\n\n> Adeodato Simó <dato@net.com.org.es> writes:\n\n> > However, I've as of late directly created bare repositories knowing that\n> > I wanted to work just with workdirs against it. In this case, the logs\n> > for each checkout'ed branch will be stored in the workdirs and not the\n> > repo, so deleting the workdir will make you lose those logs. Which is\n> > bad, since workdirs should always be safe to delete.\n\n> I had to think about the above for a while, but after realizing that you\n> have a strict distinction between a \"workdir\" and a normal \"repository\n> with a work tree\" in mind, I can see where you are coming from.  A workdir\n> is transient in nature and you should be able to dismiss it safely as long\n> as the repository it borrows from is intact.\n\nThe thing, for me, is that a workdir should result in effects as close\nas possible as doing the work in the repository with the workdir itself.\nI normally use workdirs when it's not feasible to do the work in the\nrepo itself (eg., there's work in progress I'd rather have around,\nrather than committing it to a temporary branch, to leave the repo\n\"clean\" for further work).\n\n>     A workdir is a new work area that is not a normal \"work tree with a\n>     full repository\", but borrows from an existing repository.  Any side\n>     effect from the work you do in a workdir will be saved in the original\n>     repository, and removing one would lose only the three kind of\n>     information listed above.  Creating a new workdir has the side effect\n>     of enabling reflogs and rerere in the original repository.\n\n> But the last sentence somehow feels dirty.\n\nI really don't understand that last sentence. Does \"mkdir logs/refs rr-cache\"\n*enable* reflogs and rerere at all? Or, rather, it just gives an empty\nspace for the workdirs \"connecting\" to it to save their reflogs and\nrerere stuff iff they are configured to do so?\n\nCheers,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \nLove in your heart wasn't put there to stay.\nLove isn't love 'til you give it away.\n                -- Oscar Hammerstein II\n"},{"id":"101163","messageId":"7vvdsboz57.fsf@gitster.siamese.dyndns.org","threadId":"17227","inReplyTo":"20090119122018.GA25566@chistera.yi.org","subject":"Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-19T19:48:36Z","receivedAt":"2009-01-19T19:48:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adeodato Simó <dato@net.com.org.es> writes:\n\n> * Junio C Hamano [Sun, 18 Jan 2009 11:59:35 -0800]:\n> ...\n>>     A workdir is a new work area that is not a normal \"work tree with a\n>>     full repository\", but borrows from an existing repository.  Any side\n>>     effect from the work you do in a workdir will be saved in the original\n>>     repository, and removing one would lose only the three kind of\n>>     information listed above.  Creating a new workdir has the side effect\n>>     of enabling reflogs and rerere in the original repository.\n>\n>> But the last sentence somehow feels dirty.\n>\n> I really don't understand that last sentence. Does \"mkdir logs/refs rr-cache\"\n> *enable* reflogs and rerere at all? Or, rather, it just gives an empty\n> space for the workdirs \"connecting\" to it to save their reflogs and\n> rerere stuff iff they are configured to do so?\n\nI thought rerere does not kick in if rr-cache is absent, and it kicks in\nif rr-cache is present when you do not explicitly disable it.  So creation\nof directory is a way to enable it.  Besides, the net effect for a person\nwho does not want to have the bare repository contaminated with these\ndirectories is the same.  The original repository aquires them.\n\nAs I said already, I suspect that it would be more useful in practice to\ncreate these directories as your patch did, than making the new workdir\ninherit the lack of rerere and reflog support if the original repository\nlacked them.  I just wanted to see some documentation that makes it clear\nthat the original repository _is_ modified by a creation of a new workdir.\n"}]}