summaryrefslogtreecommitdiff
path: root/entry.c
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2007-03-02 22:11:30 +0100
committerJunio C Hamano <junkio@cox.net>2007-03-02 16:58:05 -0800
commit78a8d641c14dc2f0a306d787fa1e42d400b3af4d (patch)
treef99b516580d660a3049cbd4c17151f2c8b784653 /entry.c
parent4808bec6f9b5fe414f0dbc2cc0445f54f28e9e9c (diff)
downloadgit-78a8d641c14dc2f0a306d787fa1e42d400b3af4d.tar.gz
Add core.symlinks to mark filesystems that do not support symbolic links.
Some file systems that can host git repositories and their working copies do not support symbolic links. But then if the repository contains a symbolic link, it is impossible to check out the working copy. This patch enables partial support of symbolic links so that it is possible to check out a working copy on such a file system. A new flag core.symlinks (which is true by default) can be set to false to indicate that the filesystem does not support symbolic links. In this case, symbolic links that exist in the trees are checked out as small plain files, and checking in modifications of these files preserve the symlink property in the database (as long as an entry exists in the index). Of course, this does not magically make symbolic links work on such defective file systems; hence, this solution does not help if the working copy relies on that an entry is a real symbolic link. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'entry.c')
-rw-r--r--entry.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/entry.c b/entry.c
index 21b5f2e26d..d72f811580 100644
--- a/entry.c
+++ b/entry.c
@@ -111,9 +111,12 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
return error("git-checkout-index: unable to write file %s", path);
break;
case S_IFLNK:
- if (to_tempfile) {
- strcpy(path, ".merge_link_XXXXXX");
- fd = mkstemp(path);
+ if (to_tempfile || !has_symlinks) {
+ if (to_tempfile) {
+ strcpy(path, ".merge_link_XXXXXX");
+ fd = mkstemp(path);
+ } else
+ fd = create_file(path, 0666);
if (fd < 0) {
free(new);
return error("git-checkout-index: unable to create "