From: Ilyas -- <umask00@gmail.com>
To: git@vger.kernel.org
Subject: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
Date: Wed, 24 Nov 2010 11:01:21 +0300 [thread overview]
Message-ID: <AANLkTikfg9fLtqC6V3hQkiSZ+RfWqViJsHPxrt6ycoRR@mail.gmail.com> (raw)
Hi!
The patch bellow for problem 'Versioning configuration files on a
server: fatal: Unable to create '//etc/.git/index.lock': No such file
or directory' works fine on FreeBSD/Linux.
Please fix this problem in upstream.
Thank you.
diff --git a/dir.c b/dir.c
index d1e5e5e..5408db9 100644
--- a/dir.c
+++ b/dir.c
@@ -943,6 +943,7 @@ int file_exists(const char *f)
char *get_relative_cwd(char *buffer, int size, const char *dir)
{
char *cwd = buffer;
+ size_t len, root_len;
if (!dir)
return NULL;
@@ -952,6 +953,15 @@ char *get_relative_cwd(char *buffer, int size,
const char *dir)
if (!is_absolute_path(dir))
dir = make_absolute_path(dir);
+ len = strlen(dir);
+ root_len = offset_1st_component(dir);
+
+ if (root_len >= len) {
+ /* dir is the filesystem root, so the cwd is always inside */
+ root_len = offset_1st_component(cwd);
+ return cwd + root_len;
+ }
+
while (*dir && *dir == *cwd) {
dir++;
cwd++;
next reply other threads:[~2010-11-24 8:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 8:01 Ilyas -- [this message]
2010-11-24 8:45 ` Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory Nguyen Thai Ngoc Duy
2010-11-24 8:50 ` Matthijs Kooijman
2010-11-24 9:46 ` Ilyas --
-- strict thread matches above, loose matches on Subject: below --
2010-11-17 6:24 Albert Strasheim
2010-11-17 11:20 ` Matthijs Kooijman
2010-11-18 15:52 ` Matthijs Kooijman
2010-11-18 16:00 ` Santi Béjar
2010-11-18 16:07 ` Nguyen Thai Ngoc Duy
2010-11-18 16:26 ` Nguyen Thai Ngoc Duy
2010-11-18 17:17 ` Matthijs Kooijman
2010-11-18 20:36 ` Matthijs Kooijman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTikfg9fLtqC6V3hQkiSZ+RfWqViJsHPxrt6ycoRR@mail.gmail.com \
--to=umask00@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).