@matheusbsbs / matheus-bagliano / commits / 302b9282c9
Fork 0

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>

Martin Waitz committed May 21, 2007 at 22:08 UTC 302b9282c9ddfcc704ca759bdc98c1d5f75eba2f
14 files changed +27 -27
archive-tar.c
+2 -2
@@ -167,7 +167,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path,
167 } else {
168 if (verbose)
169 fprintf(stderr, "%.*s\n", path->len, path->buf);
170 - if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
170 + if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
171 *header.typeflag = TYPEFLAG_DIR;
172 mode = (mode | 0777) & ~tar_umask;
173 } else if (S_ISLNK(mode)) {
@@ -280,7 +280,7 @@ static int write_tar_entry(const unsigned char *sha1,
280 memcpy(path.buf + baselen, filename, filenamelen);
281 path.len = baselen + filenamelen;
282 path.buf[path.len] = '\0';
283 - if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
283 + if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
284 strbuf_append_string(&path, "/");
285 buffer = NULL;
286 size = 0;
archive-zip.c
+1 -1
@@ -182,7 +182,7 @@ static int write_zip_entry(const unsigned char *sha1,
182 goto out;
183 }
184
185 - if (S_ISDIR(mode) || S_ISDIRLNK(mode)) {
185 + if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
186 method = 0;
187 attr2 = 16;
188 result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
builtin-fsck.c
+2 -2
@@ -256,7 +256,7 @@ static int fsck_tree(struct tree *item)
256 case S_IFREG | 0644:
257 case S_IFLNK:
258 case S_IFDIR:
259 - case S_IFDIRLNK:
259 + case S_IFGITLINK:
260 break;
261 /*
262 * This is nonstandard, but we had a few of these
@@ -715,7 +715,7 @@ int cmd_fsck(int argc, char **argv, const char *prefix)
715 struct object *obj;
716
717 mode = ntohl(active_cache[i]->ce_mode);
718 - if (S_ISDIRLNK(mode))
718 + if (S_ISGITLINK(mode))
719 continue;
720 blob = lookup_blob(active_cache[i]->sha1);
721 if (!blob)
builtin-ls-tree.c
+1 -1
@@ -60,7 +60,7 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
60 int retval = 0;
61 const char *type = blob_type;
62
63 - if (S_ISDIRLNK(mode)) {
63 + if (S_ISGITLINK(mode)) {
64 /*
65 * Maybe we want to have some recursive version here?
66 *
builtin-update-index.c
+2 -2
@@ -134,7 +134,7 @@ static int process_directory(const char *path, int len, struct stat *st)
134 /* Exact match: file or existing gitlink */
135 if (pos >= 0) {
136 struct cache_entry *ce = active_cache[pos];
137 - if (S_ISDIRLNK(ntohl(ce->ce_mode))) {
137 + if (S_ISGITLINK(ntohl(ce->ce_mode))) {
138
139 /* Do nothing to the index if there is no HEAD! */
140 if (resolve_gitlink_ref(path, "HEAD", sha1) < 0)
@@ -178,7 +178,7 @@ static int process_file(const char *path, int len, struct stat *st)
178 int pos = cache_name_pos(path, len);
179 struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos];
180
181 - if (ce && S_ISDIRLNK(ntohl(ce->ce_mode)))
181 + if (ce && S_ISGITLINK(ntohl(ce->ce_mode)))
182 return error("%s is already a gitlink, not replacing", path);
183
184 return add_one_path(ce, path, len, st);
cache-tree.c
+1 -1
@@ -326,7 +326,7 @@ static int update_one(struct cache_tree *it,
326 mode = ntohl(ce->ce_mode);
327 entlen = pathlen - baselen;
328 }
329 - if (mode != S_IFDIRLNK && !missing_ok && !has_sha1_file(sha1))
329 + if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
330 return error("invalid object %s", sha1_to_hex(sha1));
331
332 if (!ce->ce_mode)
cache.h
+5 -5
@@ -40,8 +40,8 @@
40 * happens that everybody shares the same bit representation
41 * in the UNIX world (and apparently wider too..)
42 */
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)
45
46 /*
47 * 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)
123 {
124 if (S_ISLNK(mode))
125 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);
128 return htonl(S_IFREG | ce_permissions(mode));
129 }
130 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
142 }
143 #define canon_mode(mode) \
144 (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)
146
147 #define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
148
diff.c
+1 -1
@@ -1465,7 +1465,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
1465 if (size_only && 0 < s->size)
1466 return 0;
1467
1468 - if (S_ISDIRLNK(s->mode))
1468 + if (S_ISGITLINK(s->mode))
1469 return diff_populate_gitlink(s, size_only);
1470
1471 if (!s->sha1_valid ||
dir.c
+3 -3
@@ -321,7 +321,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
321 break;
322 if (endchar == '/')
323 return index_directory;
324 - if (!endchar && S_ISDIRLNK(ntohl(ce->ce_mode)))
324 + if (!endchar && S_ISGITLINK(ntohl(ce->ce_mode)))
325 return index_gitdir;
326 }
327 return index_nonexistent;
@@ -356,7 +356,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
356 * also true and the directory is empty, in which case
357 * we just ignore it entirely.
358 * (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
360 * as a directory.
361 * (c) otherwise, we recurse into it.
362 */
@@ -383,7 +383,7 @@ static enum directory_treatment treat_directory(struct dir_struct *dir,
383 case index_nonexistent:
384 if (dir->show_other_directories)
385 break;
386 - if (!dir->no_dirlinks) {
386 + if (!dir->no_gitlinks) {
387 unsigned char sha1[20];
388 if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0)
389 return show_directory;
dir.h
+1 -1
@@ -34,7 +34,7 @@ struct dir_struct {
34 unsigned int show_ignored:1,
35 show_other_directories:1,
36 hide_empty_directories:1,
37 - no_dirlinks:1;
37 + no_gitlinks:1;
38 struct dir_entry **entries;
39
40 /* Exclude info */
entry.c
+2 -2
@@ -145,7 +145,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
145 "symlink %s (%s)", path, strerror(errno));
146 }
147 break;
148 - case S_IFDIRLNK:
148 + case S_IFGITLINK:
149 if (to_tempfile)
150 return error("git-checkout-index: cannot create temporary subproject %s", path);
151 if (mkdir(path, 0777) < 0)
@@ -194,7 +194,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t
194 unlink(path);
195 if (S_ISDIR(st.st_mode)) {
196 /* If it is a gitlink, leave it alone! */
197 - if (S_ISDIRLNK(ntohl(ce->ce_mode)))
197 + if (S_ISGITLINK(ntohl(ce->ce_mode)))
198 return 0;
199 if (!state->force)
200 return error("%s is a directory", path);
list-objects.c
+1 -1
@@ -87,7 +87,7 @@ static void process_tree(struct rev_info *revs,
87 process_tree(revs,
88 lookup_tree(entry.sha1),
89 p, &me, entry.path);
90 - else if (S_ISDIRLNK(entry.mode))
90 + else if (S_ISGITLINK(entry.mode))
91 process_gitlink(revs, entry.sha1,
92 p, &me, entry.path);
93 else
read-cache.c
+3 -3
@@ -92,7 +92,7 @@ static int ce_compare_gitlink(struct cache_entry *ce)
92
93 /*
94 * We don't actually require that the .git directory
95 - * under DIRLNK directory be a valid git directory. It
95 + * under GITLINK directory be a valid git directory. It
96 * might even be missing (in case nobody populated that
97 * sub-project).
98 *
@@ -115,7 +115,7 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st)
115 return DATA_CHANGED;
116 break;
117 case S_IFDIR:
118 - if (S_ISDIRLNK(ntohl(ce->ce_mode)))
118 + if (S_ISGITLINK(ntohl(ce->ce_mode)))
119 return 0;
120 default:
121 return TYPE_CHANGED;
@@ -142,7 +142,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
142 (has_symlinks || !S_ISREG(st->st_mode)))
143 changed |= TYPE_CHANGED;
144 break;
145 - case S_IFDIRLNK:
145 + case S_IFGITLINK:
146 if (!S_ISDIR(st->st_mode))
147 changed |= TYPE_CHANGED;
148 else if (ce_compare_gitlink(ce))
tree.c
+2 -2
@@ -157,7 +157,7 @@ static void track_tree_refs(struct tree *item)
157 /* Count how many entries there are.. */
158 init_tree_desc(&desc, item->buffer, item->size);
159 while (tree_entry(&desc, &entry)) {
160 - if (S_ISDIRLNK(entry.mode))
160 + if (S_ISGITLINK(entry.mode))
161 continue;
162 n_refs++;
163 }
@@ -169,7 +169,7 @@ static void track_tree_refs(struct tree *item)
169 while (tree_entry(&desc, &entry)) {
170 struct object *obj;
171
172 - if (S_ISDIRLNK(entry.mode))
172 + if (S_ISGITLINK(entry.mode))
173 continue;
174 if (S_ISDIR(entry.mode))
175 obj = &lookup_tree(entry.sha1)->object;