All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Weber <michaelw@foldr.org>
To: git@vger.kernel.org
Subject: [PATCH] Always copy template files (no symlinking)
Date: Tue, 22 Apr 2008 16:03:59 +0200	[thread overview]
Message-ID: <20080422140359.GA9590@roadkill.foldr.org> (raw)

Previously, git would readlink(2) template files that are symlinks,
and then symlink(2) the result into .git/.  This does not work for
relative symlinks (as produced by, e.g., encap), and is probably not a
good idea either: it is an irrelevant detail that a file in the
template directory is symlinked.

Signed-off-by: Michael Weber <michaelw@foldr.org>
---
 builtin-init-db.c |   15 ++-------------
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/builtin-init-db.c b/builtin-init-db.c
index 2854868..b025a62 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -83,19 +83,8 @@ static void copy_templates_1(char *path, int baselen,
 		}
 		else if (exists)
 			continue;
-		else if (S_ISLNK(st_template.st_mode)) {
-			char lnk[256];
-			int len;
-			len = readlink(template, lnk, sizeof(lnk));
-			if (len < 0)
-				die("cannot readlink %s", template);
-			if (sizeof(lnk) <= len)
-				die("insanely long symlink %s", template);
-			lnk[len] = 0;
-			if (symlink(lnk, path))
-				die("cannot symlink %s %s", lnk, path);
-		}
-		else if (S_ISREG(st_template.st_mode)) {
+		else if (S_ISREG(st_template.st_mode) ||
+			 S_ISLNK(st_template.st_mode)) {
 			if (copy_file(path, template, st_template.st_mode))
 				die("cannot copy %s to %s", template, path);
 		}
-- 
1.5.5.69.ga0a105

             reply	other threads:[~2008-04-22 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 14:03 Michael Weber [this message]
2008-04-22 17:05 ` [PATCH] Always copy template files (no symlinking) Junio C Hamano
2008-04-22 19:12   ` Michael Weber

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=20080422140359.GA9590@roadkill.foldr.org \
    --to=michaelw@foldr.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.