From: Junio C Hamano Date: Thu, 19 Jul 2007 00:00:36 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.5.3-rc3~40 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c1c10a3f272ec0908e63bc105a5ffe94c1279fba?hp=-c Merge branch 'maint' * maint: Force listingblocks to be monospaced in manpages Do not expect unlink(2) to fail on a directory. --- c1c10a3f272ec0908e63bc105a5ffe94c1279fba diff --combined Documentation/asciidoc.conf index 6b6220dfdb,a0d8459e21..af5b1558a6 --- a/Documentation/asciidoc.conf +++ b/Documentation/asciidoc.conf @@@ -27,7 -27,13 +27,13 @@@ ifdef::backend-docbook[ [listingblock] {title} + ifdef::doctype-manpage[] + .ft C + endif::doctype-manpage[] | + ifdef::doctype-manpage[] + .ft + endif::doctype-manpage[] {title#} endif::backend-docbook[] @@@ -55,3 -61,5 +61,3 @@@ ifdef::backend-xhtml11[ [gitlink-inlinemacro] {target}{0?({0})} endif::backend-xhtml11[] - - diff --combined entry.c index c540ae13e8,23687af7d5..0625112339 --- a/entry.c +++ b/entry.c @@@ -8,17 -8,40 +8,40 @@@ static void create_directories(const ch const char *slash = path; while ((slash = strchr(slash+1, '/')) != NULL) { + struct stat st; + int stat_status; + len = slash - path; memcpy(buf, path, len); buf[len] = 0; + + if (len <= state->base_dir_len) + /* + * checkout-index --prefix=; is + * allowed to be a symlink to an existing + * directory. + */ + stat_status = stat(buf, &st); + else + /* + * if there currently is a symlink, we would + * want to replace it with a real directory. + */ + stat_status = lstat(buf, &st); + + if (!stat_status && S_ISDIR(st.st_mode)) + continue; /* ok, it is already a directory. */ + + /* + * We know stat_status == 0 means something exists + * there and this mkdir would fail, but that is an + * error codepath; we do not care, as we unlink and + * mkdir again in such a case. + */ if (mkdir(buf, 0777)) { - if (errno == EEXIST) { - struct stat st; - if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777)) - continue; - if (!stat(buf, &st) && S_ISDIR(st.st_mode)) - continue; /* ok */ - } + if (errno == EEXIST && state->force && + !unlink(buf) && !mkdir(buf, 0777)) + continue; die("cannot create directory at %s", buf); } } @@@ -31,7 -54,7 +54,7 @@@ static void remove_subtree(const char * struct dirent *de; char pathbuf[PATH_MAX]; char *name; - + if (!dir) die("cannot opendir %s (%s)", path, strerror(errno)); strcpy(pathbuf, path); @@@ -145,7 -168,7 +168,7 @@@ static int write_entry(struct cache_ent "symlink %s (%s)", path, strerror(errno)); } break; - case S_IFDIRLNK: + case S_IFGITLINK: if (to_tempfile) return error("git-checkout-index: cannot create temporary subproject %s", path); if (mkdir(path, 0777) < 0) @@@ -194,7 -217,7 +217,7 @@@ int checkout_entry(struct cache_entry * unlink(path); if (S_ISDIR(st.st_mode)) { /* If it is a gitlink, leave it alone! */ - if (S_ISDIRLNK(ntohl(ce->ce_mode))) + if (S_ISGITLINK(ntohl(ce->ce_mode))) return 0; if (!state->force) return error("%s is a directory", path);