From: David Greaves <david@dgreaves.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: <git@vger.kernel.org>
Subject: [PATCH 1/1] bugfix for git-checkout-cache --prefix=/symlink/export_dir/ -a
Date: Mon, 23 May 2005 09:49:38 +0100 [thread overview]
Message-ID: <E1Da8d0-0002GR-4m@ash.dgreaves.com> (raw)
If there's a prefix then allow symlinks to directories in it.
This fixes a bug where
git-checkout-cache --prefix=/symlink/export_dir/ -a
otherwise fails.
Signed-off-by: David Greaves <david@dgreaves.com>
---
commit 18006ac69ae9db97b7d96fd0bfb1bdb6893e318d
tree 37580a3d32262d2cee7d28b20474c0f2ceb6faaa
parent 2aef5bbae99aeba3551408eae13faea02bf55b67
author David Greaves <david@dgreaves.com> Mon, 23 May 2005 09:42:04 +0100
committer David Greaves <david@dgreaves.com> Mon, 23 May 2005 09:42:04 +0100
checkout-cache.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
Index: checkout-cache.c
===================================================================
--- 99282828d5af15b0af0d0eac13a5b1194e88342c/checkout-cache.c (mode:100644)
+++ 37580a3d32262d2cee7d28b20474c0f2ceb6faaa/checkout-cache.c (mode:100644)
@@ -37,20 +37,25 @@
#include "cache.h"
static int force = 0, quiet = 0, not_new = 0, refresh_cache = 0;
+const char *base_dir = "";
static void create_directories(const char *path)
{
int len = strlen(path);
char *buf = xmalloc(len + 1);
const char *slash = path;
+ int baselen = strlen(base_dir);
while ((slash = strchr(slash+1, '/')) != NULL) {
+ struct stat st;
len = slash - path;
memcpy(buf, path, len);
buf[len] = 0;
+ if (slash - path <= baselen &&
+ !stat(buf, &st) && S_ISDIR(st.st_mode))
+ continue; /* allow symlinks only in --prefix */
if (mkdir(buf, 0755)) {
if (errno == EEXIST) {
- struct stat st;
if (!lstat(buf, &st) && S_ISDIR(st.st_mode))
continue; /* ok */
if (force && !unlink(buf) && !mkdir(buf, 0755))
@@ -229,7 +234,6 @@
int main(int argc, char **argv)
{
int i, force_filename = 0;
- const char *base_dir = "";
struct cache_file cache_file;
int newfd = -1;
next reply other threads:[~2005-05-23 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-23 8:49 David Greaves [this message]
2005-05-23 18:45 ` [PATCH 1/1] bugfix for git-checkout-cache --prefix=/symlink/export_dir/ -a Linus Torvalds
2005-05-23 19:09 ` Linus Torvalds
2005-05-24 8:51 ` [PATCH] Allow symlinks in the leading path in checkout-cache --prefix= 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=E1Da8d0-0002GR-4m@ash.dgreaves.com \
--to=david@dgreaves.com \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.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).