From: Junio C Hamano <gitster@pobox•com>
To: Git mailing list <git@vger•kernel.org>
Cc: "Stephen Cuppett" <cuppett@gmail•com>
Cc: Nanako Shiraishi <nanako3@bluebottle•com>
Subject: [PATCH] autodetect core.symlinks in git-init
Date: Fri, 31 Aug 2007 00:22:25 -0700 [thread overview]
Message-ID: <7vodgo2moe.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vveaw2na9.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Fri, 31 Aug 2007 00:09:18 -0700")
We already autodetect if filemode is reliable on the filesystem
to deal with VFAT and friends. Do the same for symbolic link
support.
Signed-off-by: Junio C Hamano <gitster@pobox•com>
---
* The earlier one left the test symlink behind after testing is
complete. Embarrassing...
builtin-init-db.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index af15cb2..763fa55 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -264,6 +264,21 @@ static int create_default_files(const char *git_dir, const char *template_path)
if (work_tree != git_work_tree_cfg)
git_config_set("core.worktree", work_tree);
}
+
+ /* Check if symlink is supported in the work tree */
+ if (!reinit) {
+ path[len] = 0;
+ strcpy(path + len, "tXXXXXX");
+ if (!close(xmkstemp(path)) &&
+ !unlink(path) &&
+ !symlink("testing", path) &&
+ !lstat(path, &st1) &&
+ S_ISLNK(st1.st_mode))
+ unlink(path); /* good */
+ else
+ git_config_set("core.symlinks", "false");
+ }
+
return reinit;
}
next prev parent reply other threads:[~2007-08-31 7:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-31 1:35 [RFC] Change handling of RelNotes Stephen Cuppett
2007-08-31 1:39 ` Petr Baudis
2007-08-31 6:04 ` Junio C Hamano
2007-08-31 2:21 ` Junio C Hamano
2007-08-31 6:08 ` Marius Storm-Olsen
2007-08-31 6:44 ` Nanako Shiraishi
2007-08-31 7:09 ` Junio C Hamano
2007-08-31 7:22 ` Junio C Hamano [this message]
2007-08-31 8:00 ` [PATCH] autodetect core.symlinks in git-init Nanako Shiraishi
2007-08-31 8:23 ` Marius Storm-Olsen
[not found] ` <316a20a40708310539w1d20c391w8566a042c7a8679a@mail.gmail.com>
2007-08-31 12:52 ` [RFC] Change handling of RelNotes Stephen Cuppett
2007-08-31 20:25 ` Junio C Hamano
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=7vodgo2moe.fsf_-_@gitster.siamese.dyndns.org \
--to=gitster@pobox$(echo .)com \
--cc=cuppett@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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