Skip to content

Commit 302b928

Browse files
taliJunio C Hamano
authored andcommitted
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>
1 parent fbf5df0 commit 302b928

File tree

14 files changed

+27
-27
lines changed

14 files changed

+27
-27
lines changed

archive-tar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
167167
} else {
168168
if (verbose)
169169
fprintf(stderr, "%.*s\n", path->len, path->buf);
170-
if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
170+
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
171171
*header.typeflag = TYPEFLAG_DIR;
172172
mode = (mode | 0777) & ~tar_umask;
173173
} else if (S_ISLNK(mode)) {
@@ -280,7 +280,7 @@ static int write_tar_entry(const unsigned char *sha1,
280280
memcpy(path.buf + baselen, filename, filenamelen);
281281
path.len = baselen + filenamelen;
282282
path.buf[path.len] = '\0';
283-
if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
283+
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
284284
strbuf_append_string(&path, "/");
285285
buffer = NULL;
286286
size = 0;

archive-zip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int write_zip_entry(const unsigned char *sha1,
182182
goto out;
183183
}
184184

185-
if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
185+
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
186186
method = 0;
187187
attr2 = 16;
188188
result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);

builtin-fsck.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static int fsck_tree(struct tree *item)
256256
case S_IFREG | 0644:
257257
case S_IFLNK:
258258
case S_IFDIR:
259-
case S_IFDIRLNK:
259+
case S_IFGITLINK:
260260
break;
261261
/*
262262
* This is nonstandard, but we had a few of these
@@ -715,7 +715,7 @@ int cmd_fsck(int argc, char **argv, const char *prefix)
715715
struct object *obj;
716716

717717
mode = ntohl(active_cache[i]->ce_mode);
718-
if (S_ISDIRLNK(mode))
718+
if (S_ISGITLINK(mode))
719719
continue;
720720
blob = lookup_blob(active_cache[i]->sha1);
721721
if (!blob)

builtin-ls-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
6060
int retval = 0;
6161
const char *type = blob_type;
6262

63-
if (S_ISDIRLNK(mode)) {
63+
if (S_ISGITLINK(mode)) {
6464
/*
6565
* Maybe we want to have some recursive version here?
6666
*

builtin-update-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int process_directory(const char *path, int len, struct stat *st)
134134
/* Exact match: file or existing gitlink */
135135
if (pos >= 0) {
136136
struct cache_entry *ce = active_cache[pos];
137-
if (S_ISDIRLNK(ntohl(ce->ce_mode))) {
137+
if (S_ISGITLINK(ntohl(ce->ce_mode))) {
138138

139139
/* Do nothing to the index if there is no HEAD! */
140140
if (resolve_gitlink_ref(path, "HEAD", sha1) < 0)
@@ -178,7 +178,7 @@ static int process_file(const char *path, int len, struct stat *st)
178178
int pos = cache_name_pos(path, len);
179179
struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos];
180180

181-
if (ce && S_ISDIRLNK(ntohl(ce->ce_mode)))
181+
if (ce && S_ISGITLINK(ntohl(ce->ce_mode)))
182182
return error("%s is already a gitlink, not replacing", path);
183183

184184
return add_one_path(ce, path, len, st);

cache-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static int update_one(struct cache_tree *it,
326326
mode = ntohl(ce->ce_mode);
327327
entlen = pathlen - baselen;
328328
}
329-
if (mode != S_IFDIRLNK && !missing_ok && !has_sha1_file(sha1))
329+
if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
330330
return error("invalid object %s", sha1_to_hex(sha1));
331331

332332
if (!ce->ce_mode)

cache.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
* happens that everybody shares the same bit representation
4141
* in the UNIX world (and apparently wider too..)
4242
*/
43-
#define S_IFDIRLNK 0160000
44-
#define S_ISDIRLNK(m) (((m) & S_IFMT) == S_IFDIRLNK)
43+
#define S_IFGITLINK 0160000
44+
#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
4545

4646
/*
4747
* 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)
123123
{
124124
if (S_ISLNK(mode))
125125
return htonl(S_IFLNK);
126-
if (S_ISDIR(mode) || S_ISDIRLNK(mode))
127-
return htonl(S_IFDIRLNK);
126+
if (S_ISDIR(mode) || S_ISGITLINK(mode))
127+
return htonl(S_IFGITLINK);
128128
return htonl(S_IFREG | ce_permissions(mode));
129129
}
130130
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
142142
}
143143
#define canon_mode(mode) \
144144
(S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
145-
S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFDIRLNK)
145+
S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK)
146146

147147
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
148148

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
14651465
if (size_only && 0 < s->size)
14661466
return 0;
14671467

1468-
if (S_ISDIRLNK(s->mode))
1468+
if (S_ISGITLINK(s->mode))
14691469
return diff_populate_gitlink(s, size_only);
14701470

14711471
if (!s->sha1_valid ||

dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
321321
break;
322322
if (endchar == '/')
323323
return index_directory;
324-
if (!endchar && S_ISDIRLNK(ntohl(ce->ce_mode)))
324+
if (!endchar && S_ISGITLINK(ntohl(ce->ce_mode)))
325325
return index_gitdir;
326326
}
327327
return index_nonexistent;
@@ -356,7 +356,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
356356
* also true and the directory is empty, in which case
357357
* we just ignore it entirely.
358358
* (b) if it looks like a git directory, and we don't have
359-
* 'no_dirlinks' set we treat it as a gitlink, and show it
359+
* 'no_gitlinks' set we treat it as a gitlink, and show it
360360
* as a directory.
361361
* (c) otherwise, we recurse into it.
362362
*/
@@ -383,7 +383,7 @@ static enum directory_treatment treat_directory(struct dir_struct *dir,
383383
case index_nonexistent:
384384
if (dir->show_other_directories)
385385
break;
386-
if (!dir->no_dirlinks) {
386+
if (!dir->no_gitlinks) {
387387
unsigned char sha1[20];
388388
if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
389389
return show_directory;

dir.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct dir_struct {
3434
unsigned int show_ignored:1,
3535
show_other_directories:1,
3636
hide_empty_directories:1,
37-
no_dirlinks:1;
37+
no_gitlinks:1;
3838
struct dir_entry **entries;
3939

4040
/* Exclude info */

0 commit comments

Comments
 (0)