{"thread":{"id":"25830","subject":"Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory","startedAt":"2010-11-24T08:01:21Z","lastAt":"2010-11-24T09:46:38Z","messageCount":4,"participants":["Ilyas --","Nguyen Thai Ngoc Duy","Matthijs Kooijman"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"156472","messageId":"AANLkTikfg9fLtqC6V3hQkiSZ+RfWqViJsHPxrt6ycoRR@mail.gmail.com","threadId":"25830","inReplyTo":null,"subject":"Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory","fromName":"Ilyas --","fromEmail":"umask00@gmail.com","sentAt":"2010-11-24T08:01:21Z","receivedAt":"2010-11-24T08:01:21Z","isPatch":false,"sender":{"key":"umask00@gmail.com","avatar":null},"body":"Hi!\n\nThe patch bellow for problem 'Versioning configuration files on a\nserver: fatal: Unable to create '//etc/.git/index.lock': No such file\nor directory' works fine on FreeBSD/Linux.\nPlease fix this problem in upstream.\n\nThank you.\n\n\ndiff --git a/dir.c b/dir.c\nindex d1e5e5e..5408db9 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -943,6 +943,7 @@ int file_exists(const char *f)\n\n\n char *get_relative_cwd(char *buffer, int size, const char *dir)\n\n {\n        char *cwd = buffer;\n+       size_t len, root_len;\n\n        if (!dir)\n                return NULL;\n@@ -952,6 +953,15 @@ char *get_relative_cwd(char *buffer, int size,\nconst char *dir)\n\n        if (!is_absolute_path(dir))\n\n\n                dir = make_absolute_path(dir);\n\n+       len = strlen(dir);\n+       root_len = offset_1st_component(dir);\n+\n+       if (root_len >= len) {\n\n+           /* dir is the filesystem root, so the cwd is always inside */\n\n\n+           root_len = offset_1st_component(cwd);\n+           return cwd + root_len;\n+       }\n+\n        while (*dir && *dir == *cwd) {\n\n                dir++;\n                cwd++;\n"},{"id":"156473","messageId":"AANLkTim_sPyVGK3XWEVseseRzcmNM-YS=aFSWZeBiB7n@mail.gmail.com","threadId":"25830","inReplyTo":"AANLkTikfg9fLtqC6V3hQkiSZ+RfWqViJsHPxrt6ycoRR@mail.gmail.com","subject":"Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-24T08:45:43Z","receivedAt":"2010-11-24T08:45:43Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Nov 24, 2010 at 3:01 PM, Ilyas -- <umask00@gmail.com> wrote:\n> Hi!\n>\n> The patch bellow for problem 'Versioning configuration files on a\n> server: fatal: Unable to create '//etc/.git/index.lock': No such file\n> or directory' works fine on FreeBSD/Linux.\n> Please fix this problem in upstream.\n\nI also have another patch to fix this [1]. Hopefully Junio will pick it up soon.\n\n[1] http://article.gmane.org/gmane.comp.version-control.git/161825\n-- \nDuy\n"},{"id":"156474","messageId":"20101124085030.GB22067@login.drsnuggles.stderr.nl","threadId":"25830","inReplyTo":"AANLkTim_sPyVGK3XWEVseseRzcmNM-YS=aFSWZeBiB7n@mail.gmail.com","subject":"Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory","fromName":"Matthijs Kooijman","fromEmail":"matthijs@stdin.nl","sentAt":"2010-11-24T08:50:30Z","receivedAt":"2010-11-24T08:50:30Z","isPatch":false,"sender":{"key":"matthijs@stdin.nl","avatar":"https://avatars.githubusercontent.com/u/194491?v=4"},"body":"Hi folks,\n\nOn Wed, Nov 24, 2010 at 03:45:43PM +0700, Nguyen Thai Ngoc Duy wrote:\n> On Wed, Nov 24, 2010 at 3:01 PM, Ilyas -- <umask00@gmail.com> wrote:\n> > The patch bellow for problem 'Versioning configuration files on a\n> > server: fatal: Unable to create '//etc/.git/index.lock': No such file\n> > or directory' works fine on FreeBSD/Linux.\n> > Please fix this problem in upstream.\n> \n> I also have another patch to fix this [1]. Hopefully Junio will pick it up soon.\nThe patch sent by Ilyas is mine and it was just a quick hack. Please use\nthe patch sent later by Nguyen instead, it solves the problem properly:\n\n> [1] http://article.gmane.org/gmane.comp.version-control.git/161825\n"},{"id":"156475","messageId":"AANLkTinpwM=3P0Zz-t_j1sh=7s8h6mh-oiymuxdU9HL_@mail.gmail.com","threadId":"25830","inReplyTo":"20101124085030.GB22067@login.drsnuggles.stderr.nl","subject":"Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory","fromName":"Ilyas --","fromEmail":"umask00@gmail.com","sentAt":"2010-11-24T09:46:38Z","receivedAt":"2010-11-24T09:46:38Z","isPatch":false,"sender":{"key":"umask00@gmail.com","avatar":null},"body":"Yes, patch which I sent provided by Matthijs Kooijman in other thread\n(with the same subject).\n\nWe use git on many servers for track configs and when we get troubles\nwith /.git we was really stressed.\n\n\n\nI hope that this issue will be fixed in upstream soon.\n\n\nThank you.\n\n\nOn Wed, Nov 24, 2010 at 11:50 AM,  <matthijs@stdin.nl> wrote:\n> Hi folks,\n>\n> On Wed, Nov 24, 2010 at 03:45:43PM +0700, Nguyen Thai Ngoc Duy wrote:\n>> On Wed, Nov 24, 2010 at 3:01 PM, Ilyas -- <umask00@gmail.com> wrote:\n>> > The patch bellow for problem 'Versioning configuration files on a\n>> > server: fatal: Unable to create '//etc/.git/index.lock': No such file\n>> > or directory' works fine on FreeBSD/Linux.\n>> > Please fix this problem in upstream.\n>>\n>> I also have another patch to fix this [1]. Hopefully Junio will pick it up soon.\n> The patch sent by Ilyas is mine and it was just a quick hack. Please use\n> the patch sent later by Nguyen instead, it solves the problem properly:\n>\n>> [1] http://article.gmane.org/gmane.comp.version-control.git/161825\n>\n> -----BEGIN PGP SIGNATURE-----\n> Version: GnuPG v1.4.9 (GNU/Linux)\n>\n> iEYEARECAAYFAkzs0dYACgkQz0nQ5oovr7xKwQCgqd/l6cuub7zXlnbepYCDRwEW\n> i88AniNyZFrWeYS5gNlKJfEnENo6ml2p\n> =uRWs\n> -----END PGP SIGNATURE-----\n>\n>\n"}]}