git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <johannes.sixt@telecom.at>
To: git@vger.kernel.org
Cc: Johannes Sixt <johannes.sixt@telecom.at>
Subject: [PATCH] Create a symbolic link as a regular file on filesystems without symlinks.
Date: Tue, 27 Feb 2007 22:41:39 +0100	[thread overview]
Message-ID: <11726125052184-git-send-email-johannes.sixt@telecom.at> (raw)
In-Reply-To: <1172612504272-git-send-email-johannes.sixt@telecom.at>

If core.symlinks = false, the filesystem is actually populated with
a regular file that contains the link text.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 builtin-apply.c |    2 +-
 entry.c         |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index bec95d6..1636807 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2284,7 +2284,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf,
 {
 	int fd;
 
-	if (S_ISLNK(mode))
+	if (trust_symlink_fmt && S_ISLNK(mode))
 		/* Although buf:size is counted string, it also is NUL
 		 * terminated.
 		 */
diff --git a/entry.c b/entry.c
index c2641dd..3d5c0e4 100644
--- a/entry.c
+++ b/entry.c
@@ -100,6 +100,11 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
 		if (to_tempfile) {
 			strcpy(path, ".merge_link_XXXXXX");
 			fd = mkstemp(path);
+		} else if (!trust_symlink_fmt) {
+			/* write a regular file */
+			fd = create_file(path, 0666);
+		}
+		if (to_tempfile || !trust_symlink_fmt) {
 			if (fd < 0) {
 				free(new);
 				return error("git-checkout-index: unable to create "
-- 
1.5.0.19.gddff

  reply	other threads:[~2007-02-27 21:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 21:41 Implement core.symlinks to support filesystems without symlinks Johannes Sixt
2007-02-27 21:41 ` [PATCH] Add a flag core.symlinks analogous to core.filemode Johannes Sixt
2007-02-27 21:41   ` [PATCH] Do not change the file type if the filesystem does not support symlinks Johannes Sixt
2007-02-27 21:41     ` Johannes Sixt [this message]
2007-02-27 21:41       ` [PATCH] diff-lib.c: Ignore type differences " Johannes Sixt
2007-02-27 21:41         ` [PATCH] Describe core.symlinks in the man pages Johannes Sixt
2007-02-27 22:44       ` [PATCH] Create a symbolic link as a regular file on filesystems without symlinks Johannes Schindelin
2007-02-28 17:18         ` Johannes Sixt
2007-02-27 22:54     ` [PATCH] Do not change the file type if the filesystem does not support symlinks Johannes Schindelin
2007-02-28 17:40       ` Johannes Sixt
2007-02-28 17:53         ` Johannes Schindelin
2007-02-27 23:13 ` Implement core.symlinks to support filesystems without symlinks Robin Rosenberg
2007-02-28  0:07   ` Johannes Schindelin
2007-02-28 22:48     ` Robin Rosenberg
2007-03-01  1:18       ` Johannes Schindelin
2007-03-01 11:56         ` Robin Rosenberg
2007-03-01 17:13           ` Johannes Schindelin
2007-03-01 19:24           ` Johannes Sixt

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=11726125052184-git-send-email-johannes.sixt@telecom.at \
    --to=johannes.sixt@telecom.at \
    --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).