rename dirlink to gitlink.
Unify naming of plumbing dirlink/gitlink concept: git ls-files -z '*.[ch]' | xargs -0 perl -pi -e 's/dirlink/gitlink/g;' -e 's/DIRLNK/GITLINK/g;' Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
fbf5df024e
commit
302b9282c9
@ -167,7 +167,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
|
|||||||
} else {
|
} else {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "%.*s\n", path->len, path->buf);
|
fprintf(stderr, "%.*s\n", path->len, path->buf);
|
||||||
if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
|
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||||
*header.typeflag = TYPEFLAG_DIR;
|
*header.typeflag = TYPEFLAG_DIR;
|
||||||
mode = (mode | 0777) & ~tar_umask;
|
mode = (mode | 0777) & ~tar_umask;
|
||||||
} else if (S_ISLNK(mode)) {
|
} else if (S_ISLNK(mode)) {
|
||||||
@ -280,7 +280,7 @@ static int write_tar_entry(const unsigned char *sha1,
|
|||||||
memcpy(path.buf + baselen, filename, filenamelen);
|
memcpy(path.buf + baselen, filename, filenamelen);
|
||||||
path.len = baselen + filenamelen;
|
path.len = baselen + filenamelen;
|
||||||
path.buf[path.len] = '\0';
|
path.buf[path.len] = '\0';
|
||||||
if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
|
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||||
strbuf_append_string(&path, "/");
|
strbuf_append_string(&path, "/");
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
|
@ -182,7 +182,7 @@ static int write_zip_entry(const unsigned char *sha1,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
|
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
|
||||||
method = 0;
|
method = 0;
|
||||||
attr2 = 16;
|
attr2 = 16;
|
||||||
result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
|
result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
|
||||||
|
@ -256,7 +256,7 @@ static int fsck_tree(struct tree *item)
|
|||||||
case S_IFREG | 0644:
|
case S_IFREG | 0644:
|
||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
case S_IFDIRLNK:
|
case S_IFGITLINK:
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
* This is nonstandard, but we had a few of these
|
* This is nonstandard, but we had a few of these
|
||||||
@ -715,7 +715,7 @@ int cmd_fsck(int argc, char **argv, const char *prefix)
|
|||||||
struct object *obj;
|
struct object *obj;
|
||||||
|
|
||||||
mode = ntohl(active_cache[i]->ce_mode);
|
mode = ntohl(active_cache[i]->ce_mode);
|
||||||
if (S_ISDIRLNK(mode))
|
if (S_ISGITLINK(mode))
|
||||||
continue;
|
continue;
|
||||||
blob = lookup_blob(active_cache[i]->sha1);
|
blob = lookup_blob(active_cache[i]->sha1);
|
||||||
if (!blob)
|
if (!blob)
|
||||||
|
@ -60,7 +60,7 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
|
|||||||
int retval = 0;
|
int retval = 0;
|
||||||
const char *type = blob_type;
|
const char *type = blob_type;
|
||||||
|
|
||||||
if (S_ISDIRLNK(mode)) {
|
if (S_ISGITLINK(mode)) {
|
||||||
/*
|
/*
|
||||||
* Maybe we want to have some recursive version here?
|
* Maybe we want to have some recursive version here?
|
||||||
*
|
*
|
||||||
|
@ -134,7 +134,7 @@ static int process_directory(const char *path, int len, struct stat *st)
|
|||||||
/* Exact match: file or existing gitlink */
|
/* Exact match: file or existing gitlink */
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
struct cache_entry *ce = active_cache[pos];
|
struct cache_entry *ce = active_cache[pos];
|
||||||
if (S_ISDIRLNK(ntohl(ce->ce_mode))) {
|
if (S_ISGITLINK(ntohl(ce->ce_mode))) {
|
||||||
|
|
||||||
/* Do nothing to the index if there is no HEAD! */
|
/* Do nothing to the index if there is no HEAD! */
|
||||||
if (resolve_gitlink_ref(path, "HEAD", sha1) < 0)
|
if (resolve_gitlink_ref(path, "HEAD", sha1) < 0)
|
||||||
@ -178,7 +178,7 @@ static int process_file(const char *path, int len, struct stat *st)
|
|||||||
int pos = cache_name_pos(path, len);
|
int pos = cache_name_pos(path, len);
|
||||||
struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos];
|
struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos];
|
||||||
|
|
||||||
if (ce && S_ISDIRLNK(ntohl(ce->ce_mode)))
|
if (ce && S_ISGITLINK(ntohl(ce->ce_mode)))
|
||||||
return error("%s is already a gitlink, not replacing", path);
|
return error("%s is already a gitlink, not replacing", path);
|
||||||
|
|
||||||
return add_one_path(ce, path, len, st);
|
return add_one_path(ce, path, len, st);
|
||||||
|
@ -326,7 +326,7 @@ static int update_one(struct cache_tree *it,
|
|||||||
mode = ntohl(ce->ce_mode);
|
mode = ntohl(ce->ce_mode);
|
||||||
entlen = pathlen - baselen;
|
entlen = pathlen - baselen;
|
||||||
}
|
}
|
||||||
if (mode != S_IFDIRLNK && !missing_ok && !has_sha1_file(sha1))
|
if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
|
||||||
return error("invalid object %s", sha1_to_hex(sha1));
|
return error("invalid object %s", sha1_to_hex(sha1));
|
||||||
|
|
||||||
if (!ce->ce_mode)
|
if (!ce->ce_mode)
|
||||||
|
10
cache.h
10
cache.h
@ -40,8 +40,8 @@
|
|||||||
* happens that everybody shares the same bit representation
|
* happens that everybody shares the same bit representation
|
||||||
* in the UNIX world (and apparently wider too..)
|
* in the UNIX world (and apparently wider too..)
|
||||||
*/
|
*/
|
||||||
#define S_IFDIRLNK 0160000
|
#define S_IFGITLINK 0160000
|
||||||
#define S_ISDIRLNK(m) (((m) & S_IFMT) == S_IFDIRLNK)
|
#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Intensive research over the course of many years has shown that
|
* Intensive research over the course of many years has shown that
|
||||||
@ -123,8 +123,8 @@ static inline unsigned int create_ce_mode(unsigned int mode)
|
|||||||
{
|
{
|
||||||
if (S_ISLNK(mode))
|
if (S_ISLNK(mode))
|
||||||
return htonl(S_IFLNK);
|
return htonl(S_IFLNK);
|
||||||
if (S_ISDIR(mode) || S_ISDIRLNK(mode))
|
if (S_ISDIR(mode) || S_ISGITLINK(mode))
|
||||||
return htonl(S_IFDIRLNK);
|
return htonl(S_IFGITLINK);
|
||||||
return htonl(S_IFREG | ce_permissions(mode));
|
return htonl(S_IFREG | ce_permissions(mode));
|
||||||
}
|
}
|
||||||
static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode)
|
static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode)
|
||||||
@ -142,7 +142,7 @@ static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned in
|
|||||||
}
|
}
|
||||||
#define canon_mode(mode) \
|
#define canon_mode(mode) \
|
||||||
(S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
|
(S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
|
||||||
S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFDIRLNK)
|
S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK)
|
||||||
|
|
||||||
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
|
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
|
||||||
|
|
||||||
|
2
diff.c
2
diff.c
@ -1465,7 +1465,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
|
|||||||
if (size_only && 0 < s->size)
|
if (size_only && 0 < s->size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (S_ISDIRLNK(s->mode))
|
if (S_ISGITLINK(s->mode))
|
||||||
return diff_populate_gitlink(s, size_only);
|
return diff_populate_gitlink(s, size_only);
|
||||||
|
|
||||||
if (!s->sha1_valid ||
|
if (!s->sha1_valid ||
|
||||||
|
6
dir.c
6
dir.c
@ -321,7 +321,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
|
|||||||
break;
|
break;
|
||||||
if (endchar == '/')
|
if (endchar == '/')
|
||||||
return index_directory;
|
return index_directory;
|
||||||
if (!endchar && S_ISDIRLNK(ntohl(ce->ce_mode)))
|
if (!endchar && S_ISGITLINK(ntohl(ce->ce_mode)))
|
||||||
return index_gitdir;
|
return index_gitdir;
|
||||||
}
|
}
|
||||||
return index_nonexistent;
|
return index_nonexistent;
|
||||||
@ -356,7 +356,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
|
|||||||
* also true and the directory is empty, in which case
|
* also true and the directory is empty, in which case
|
||||||
* we just ignore it entirely.
|
* we just ignore it entirely.
|
||||||
* (b) if it looks like a git directory, and we don't have
|
* (b) if it looks like a git directory, and we don't have
|
||||||
* 'no_dirlinks' set we treat it as a gitlink, and show it
|
* 'no_gitlinks' set we treat it as a gitlink, and show it
|
||||||
* as a directory.
|
* as a directory.
|
||||||
* (c) otherwise, we recurse into it.
|
* (c) otherwise, we recurse into it.
|
||||||
*/
|
*/
|
||||||
@ -383,7 +383,7 @@ static enum directory_treatment treat_directory(struct dir_struct *dir,
|
|||||||
case index_nonexistent:
|
case index_nonexistent:
|
||||||
if (dir->show_other_directories)
|
if (dir->show_other_directories)
|
||||||
break;
|
break;
|
||||||
if (!dir->no_dirlinks) {
|
if (!dir->no_gitlinks) {
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
|
if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
|
||||||
return show_directory;
|
return show_directory;
|
||||||
|
2
dir.h
2
dir.h
@ -34,7 +34,7 @@ struct dir_struct {
|
|||||||
unsigned int show_ignored:1,
|
unsigned int show_ignored:1,
|
||||||
show_other_directories:1,
|
show_other_directories:1,
|
||||||
hide_empty_directories:1,
|
hide_empty_directories:1,
|
||||||
no_dirlinks:1;
|
no_gitlinks:1;
|
||||||
struct dir_entry **entries;
|
struct dir_entry **entries;
|
||||||
|
|
||||||
/* Exclude info */
|
/* Exclude info */
|
||||||
|
4
entry.c
4
entry.c
@ -145,7 +145,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
|
|||||||
"symlink %s (%s)", path, strerror(errno));
|
"symlink %s (%s)", path, strerror(errno));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case S_IFDIRLNK:
|
case S_IFGITLINK:
|
||||||
if (to_tempfile)
|
if (to_tempfile)
|
||||||
return error("git-checkout-index: cannot create temporary subproject %s", path);
|
return error("git-checkout-index: cannot create temporary subproject %s", path);
|
||||||
if (mkdir(path, 0777) < 0)
|
if (mkdir(path, 0777) < 0)
|
||||||
@ -194,7 +194,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t
|
|||||||
unlink(path);
|
unlink(path);
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
/* If it is a gitlink, leave it alone! */
|
/* If it is a gitlink, leave it alone! */
|
||||||
if (S_ISDIRLNK(ntohl(ce->ce_mode)))
|
if (S_ISGITLINK(ntohl(ce->ce_mode)))
|
||||||
return 0;
|
return 0;
|
||||||
if (!state->force)
|
if (!state->force)
|
||||||
return error("%s is a directory", path);
|
return error("%s is a directory", path);
|
||||||
|
@ -87,7 +87,7 @@ static void process_tree(struct rev_info *revs,
|
|||||||
process_tree(revs,
|
process_tree(revs,
|
||||||
lookup_tree(entry.sha1),
|
lookup_tree(entry.sha1),
|
||||||
p, &me, entry.path);
|
p, &me, entry.path);
|
||||||
else if (S_ISDIRLNK(entry.mode))
|
else if (S_ISGITLINK(entry.mode))
|
||||||
process_gitlink(revs, entry.sha1,
|
process_gitlink(revs, entry.sha1,
|
||||||
p, &me, entry.path);
|
p, &me, entry.path);
|
||||||
else
|
else
|
||||||
|
@ -92,7 +92,7 @@ static int ce_compare_gitlink(struct cache_entry *ce)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't actually require that the .git directory
|
* We don't actually require that the .git directory
|
||||||
* under DIRLNK directory be a valid git directory. It
|
* under GITLINK directory be a valid git directory. It
|
||||||
* might even be missing (in case nobody populated that
|
* might even be missing (in case nobody populated that
|
||||||
* sub-project).
|
* sub-project).
|
||||||
*
|
*
|
||||||
@ -115,7 +115,7 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st)
|
|||||||
return DATA_CHANGED;
|
return DATA_CHANGED;
|
||||||
break;
|
break;
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
if (S_ISDIRLNK(ntohl(ce->ce_mode)))
|
if (S_ISGITLINK(ntohl(ce->ce_mode)))
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
return TYPE_CHANGED;
|
return TYPE_CHANGED;
|
||||||
@ -142,7 +142,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
|
|||||||
(has_symlinks || !S_ISREG(st->st_mode)))
|
(has_symlinks || !S_ISREG(st->st_mode)))
|
||||||
changed |= TYPE_CHANGED;
|
changed |= TYPE_CHANGED;
|
||||||
break;
|
break;
|
||||||
case S_IFDIRLNK:
|
case S_IFGITLINK:
|
||||||
if (!S_ISDIR(st->st_mode))
|
if (!S_ISDIR(st->st_mode))
|
||||||
changed |= TYPE_CHANGED;
|
changed |= TYPE_CHANGED;
|
||||||
else if (ce_compare_gitlink(ce))
|
else if (ce_compare_gitlink(ce))
|
||||||
|
4
tree.c
4
tree.c
@ -157,7 +157,7 @@ static void track_tree_refs(struct tree *item)
|
|||||||
/* Count how many entries there are.. */
|
/* Count how many entries there are.. */
|
||||||
init_tree_desc(&desc, item->buffer, item->size);
|
init_tree_desc(&desc, item->buffer, item->size);
|
||||||
while (tree_entry(&desc, &entry)) {
|
while (tree_entry(&desc, &entry)) {
|
||||||
if (S_ISDIRLNK(entry.mode))
|
if (S_ISGITLINK(entry.mode))
|
||||||
continue;
|
continue;
|
||||||
n_refs++;
|
n_refs++;
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ static void track_tree_refs(struct tree *item)
|
|||||||
while (tree_entry(&desc, &entry)) {
|
while (tree_entry(&desc, &entry)) {
|
||||||
struct object *obj;
|
struct object *obj;
|
||||||
|
|
||||||
if (S_ISDIRLNK(entry.mode))
|
if (S_ISGITLINK(entry.mode))
|
||||||
continue;
|
continue;
|
||||||
if (S_ISDIR(entry.mode))
|
if (S_ISDIR(entry.mode))
|
||||||
obj = &lookup_tree(entry.sha1)->object;
|
obj = &lookup_tree(entry.sha1)->object;
|
||||||
|
Loading…
Reference in New Issue
Block a user