* [PATCH] rename dirlink to gitlink. @ 2007-05-21 20:08 Martin Waitz 2007-05-21 23:12 ` Torgil Svensson 0 siblings, 1 reply; 7+ messages in thread From: Martin Waitz @ 2007-05-21 20:08 UTC (permalink / raw) To: Junio C Hamano; +Cc: git [-- Attachment #1: Type: text/plain, Size: 10678 bytes --] Unify naming of plumbing dirlink/gitlink concept: perl -pi -e 's/dirlink/gitlink/g' -e 's/DIRLNK/GITLINK/g' --- archive-tar.c | 4 ++-- archive-zip.c | 2 +- builtin-fsck.c | 4 ++-- builtin-ls-tree.c | 2 +- builtin-update-index.c | 4 ++-- cache-tree.c | 2 +- cache.h | 10 +++++----- diff.c | 2 +- dir.c | 6 +++--- dir.h | 2 +- entry.c | 4 ++-- list-objects.c | 2 +- read-cache.c | 6 +++--- tree.c | 4 ++-- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/archive-tar.c b/archive-tar.c index 33e7657..66fe3e3 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -167,7 +167,7 @@ static void write_entry(const unsigned char *sha1, struct strbuf *path, } else { if (verbose) 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; mode = (mode | 0777) & ~tar_umask; } else if (S_ISLNK(mode)) { @@ -280,7 +280,7 @@ static int write_tar_entry(const unsigned char *sha1, memcpy(path.buf + baselen, filename, filenamelen); path.len = baselen + filenamelen; path.buf[path.len] = '\0'; - if (S_ISDIR(mode) || S_ISDIRLNK(mode)) { + if (S_ISDIR(mode) || S_ISGITLINK(mode)) { strbuf_append_string(&path, "/"); buffer = NULL; size = 0; diff --git a/archive-zip.c b/archive-zip.c index 3cbf6bb..444e162 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -182,7 +182,7 @@ static int write_zip_entry(const unsigned char *sha1, goto out; } - if (S_ISDIR(mode) || S_ISDIRLNK(mode)) { + if (S_ISDIR(mode) || S_ISGITLINK(mode)) { method = 0; attr2 = 16; result = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0); diff --git a/builtin-fsck.c b/builtin-fsck.c index 44ce629..cbbcaf0 100644 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@ -256,7 +256,7 @@ static int fsck_tree(struct tree *item) case S_IFREG | 0644: case S_IFLNK: case S_IFDIR: - case S_IFDIRLNK: + case S_IFGITLINK: break; /* * 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; mode = ntohl(active_cache[i]->ce_mode); - if (S_ISDIRLNK(mode)) + if (S_ISGITLINK(mode)) continue; blob = lookup_blob(active_cache[i]->sha1); if (!blob) diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c index 1cb4dca..9a5977f 100644 --- a/builtin-ls-tree.c +++ b/builtin-ls-tree.c @@ -60,7 +60,7 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen, int retval = 0; const char *type = blob_type; - if (S_ISDIRLNK(mode)) { + if (S_ISGITLINK(mode)) { /* * Maybe we want to have some recursive version here? * diff --git a/builtin-update-index.c b/builtin-update-index.c index 8f98991..509369e 100644 --- a/builtin-update-index.c +++ b/builtin-update-index.c @@ -134,7 +134,7 @@ static int process_directory(const char *path, int len, struct stat *st) /* Exact match: file or existing gitlink */ if (pos >= 0) { 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! */ 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); 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 add_one_path(ce, path, len, st); diff --git a/cache-tree.c b/cache-tree.c index 6369cc7..350a79b 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -326,7 +326,7 @@ static int update_one(struct cache_tree *it, mode = ntohl(ce->ce_mode); 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)); if (!ce->ce_mode) diff --git a/cache.h b/cache.h index 4204bc1..2497c21 100644 --- a/cache.h +++ b/cache.h @@ -40,8 +40,8 @@ * happens that everybody shares the same bit representation * in the UNIX world (and apparently wider too..) */ -#define S_IFDIRLNK 0160000 -#define S_ISDIRLNK(m) (((m) & S_IFMT) == S_IFDIRLNK) +#define S_IFGITLINK 0160000 +#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK) /* * 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)) return htonl(S_IFLNK); - if (S_ISDIR(mode) || S_ISDIRLNK(mode)) - return htonl(S_IFDIRLNK); + if (S_ISDIR(mode) || S_ISGITLINK(mode)) + return htonl(S_IFGITLINK); return htonl(S_IFREG | ce_permissions(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) \ (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) diff --git a/diff.c b/diff.c index 33297aa..9a5e980 100644 --- a/diff.c +++ b/diff.c @@ -1467,7 +1467,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only) if (size_only && 0 < s->size) return 0; - if (S_ISDIRLNK(s->mode)) + if (S_ISGITLINK(s->mode)) return diff_populate_gitlink(s, size_only); if (!s->sha1_valid || diff --git a/dir.c b/dir.c index 11fab7f..f543f50 100644 --- a/dir.c +++ b/dir.c @@ -321,7 +321,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len) break; if (endchar == '/') return index_directory; - if (!endchar && S_ISDIRLNK(ntohl(ce->ce_mode))) + if (!endchar && S_ISGITLINK(ntohl(ce->ce_mode))) return index_gitdir; } 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 * we just ignore it entirely. * (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. * (c) otherwise, we recurse into it. */ @@ -383,7 +383,7 @@ static enum directory_treatment treat_directory(struct dir_struct *dir, case index_nonexistent: if (dir->show_other_directories) break; - if (!dir->no_dirlinks) { + if (!dir->no_gitlinks) { unsigned char sha1[20]; if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0) return show_directory; diff --git a/dir.h b/dir.h index 817c674..172147f 100644 --- a/dir.h +++ b/dir.h @@ -34,7 +34,7 @@ struct dir_struct { unsigned int show_ignored:1, show_other_directories:1, hide_empty_directories:1, - no_dirlinks:1; + no_gitlinks:1; struct dir_entry **entries; /* Exclude info */ diff --git a/entry.c b/entry.c index 82bf725..ae64764 100644 --- a/entry.c +++ b/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)); } 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 +194,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t 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); diff --git a/list-objects.c b/list-objects.c index 310f8d3..e5c88c2 100644 --- a/list-objects.c +++ b/list-objects.c @@ -87,7 +87,7 @@ static void process_tree(struct rev_info *revs, process_tree(revs, lookup_tree(entry.sha1), p, &me, entry.path); - else if (S_ISDIRLNK(entry.mode)) + else if (S_ISGITLINK(entry.mode)) process_gitlink(revs, entry.sha1, p, &me, entry.path); else diff --git a/read-cache.c b/read-cache.c index d9f46da..ad4e187 100644 --- a/read-cache.c +++ b/read-cache.c @@ -92,7 +92,7 @@ static int ce_compare_gitlink(struct cache_entry *ce) /* * 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 * sub-project). * @@ -115,7 +115,7 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st) return DATA_CHANGED; break; case S_IFDIR: - if (S_ISDIRLNK(ntohl(ce->ce_mode))) + if (S_ISGITLINK(ntohl(ce->ce_mode))) return 0; default: 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))) changed |= TYPE_CHANGED; break; - case S_IFDIRLNK: + case S_IFGITLINK: if (!S_ISDIR(st->st_mode)) changed |= TYPE_CHANGED; else if (ce_compare_gitlink(ce)) diff --git a/tree.c b/tree.c index e4a39aa..a372827 100644 --- a/tree.c +++ b/tree.c @@ -157,7 +157,7 @@ static void track_tree_refs(struct tree *item) /* Count how many entries there are.. */ init_tree_desc(&desc, item->buffer, item->size); while (tree_entry(&desc, &entry)) { - if (S_ISDIRLNK(entry.mode)) + if (S_ISGITLINK(entry.mode)) continue; n_refs++; } @@ -169,7 +169,7 @@ static void track_tree_refs(struct tree *item) while (tree_entry(&desc, &entry)) { struct object *obj; - if (S_ISDIRLNK(entry.mode)) + if (S_ISGITLINK(entry.mode)) continue; if (S_ISDIR(entry.mode)) obj = &lookup_tree(entry.sha1)->object; -- 1.5.2.2.g081e -- Martin Waitz [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] rename dirlink to gitlink. 2007-05-21 20:08 [PATCH] rename dirlink to gitlink Martin Waitz @ 2007-05-21 23:12 ` Torgil Svensson 2007-05-21 23:32 ` Junio C Hamano 0 siblings, 1 reply; 7+ messages in thread From: Torgil Svensson @ 2007-05-21 23:12 UTC (permalink / raw) To: Martin Waitz; +Cc: Junio C Hamano, git On 5/21/07, Martin Waitz <tali@admingilde.org> wrote: > Unify naming of plumbing dirlink/gitlink concept: > > perl -pi -e 's/dirlink/gitlink/g' -e 's/DIRLNK/GITLINK/g' > --- Does this mean that the link doesn't necessarily has to be represented as a directory (even though current code does it) ? //Torgil ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rename dirlink to gitlink. 2007-05-21 23:12 ` Torgil Svensson @ 2007-05-21 23:32 ` Junio C Hamano 2007-05-22 5:59 ` Martin Waitz 2007-05-22 11:53 ` [PATCH] rename dirlink to gitlink Petr Baudis 0 siblings, 2 replies; 7+ messages in thread From: Junio C Hamano @ 2007-05-21 23:32 UTC (permalink / raw) To: Torgil Svensson; +Cc: Martin Waitz, Junio C Hamano, git "Torgil Svensson" <torgil.svensson@gmail.com> writes: > On 5/21/07, Martin Waitz <tali@admingilde.org> wrote: >> Unify naming of plumbing dirlink/gitlink concept: >> >> perl -pi -e 's/dirlink/gitlink/g' -e 's/DIRLNK/GITLINK/g' >> --- > > Does this mean that the link doesn't necessarily has to be represented > as a directory (even though current code does it) ? I do not think the patch has that much deep meaning. Personally I think the patch is similar to renaming "cache" used in the code to "index" --- needless code shuffling that does not buy you anything. As an internal symbol, S_IFDIRLNK makes _much_ more sense than S_IFGITLINK, exactly because it is a mixture of S_IFDIR and S_IFLNK. The only excuse that we _might_ want to consider the patch is that S_IFDIRLNK has not lived that long, compared to the use of word "cache" in our codebase. It's only two weeks old -- so if we were to apply this patch, we would need to do that right away, or it will be never. But I am not _so_ enthused about the renaming in the code. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rename dirlink to gitlink. 2007-05-21 23:32 ` Junio C Hamano @ 2007-05-22 5:59 ` Martin Waitz 2007-05-22 6:19 ` Junio C Hamano 2007-05-22 11:53 ` [PATCH] rename dirlink to gitlink Petr Baudis 1 sibling, 1 reply; 7+ messages in thread From: Martin Waitz @ 2007-05-22 5:59 UTC (permalink / raw) To: Junio C Hamano; +Cc: Torgil Svensson, git [-- Attachment #1: Type: text/plain, Size: 587 bytes --] hoi :) On Mon, May 21, 2007 at 04:32:51PM -0700, Junio C Hamano wrote: > As an internal symbol, S_IFDIRLNK makes _much_ more sense than > S_IFGITLINK, exactly because it is a mixture of S_IFDIR and > S_IFLNK. But then we also should be consequent and rename the entire low-level plumbing to dirlink. I don't see a reason to keep both. For me the S_ macro names are about the file type which is represented by them. The fact that dirlinks/gitlinks are represented as DIR + LNK is nice but not so important that we have to name the macro that way. -- Martin Waitz [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rename dirlink to gitlink. 2007-05-22 5:59 ` Martin Waitz @ 2007-05-22 6:19 ` Junio C Hamano 2007-05-22 11:39 ` [PATCH] rename gitlink to dirlink Martin Waitz 0 siblings, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2007-05-22 6:19 UTC (permalink / raw) To: Martin Waitz; +Cc: Torgil Svensson, git Martin Waitz <tali@admingilde.org> writes: > hoi :) > > On Mon, May 21, 2007 at 04:32:51PM -0700, Junio C Hamano wrote: >> As an internal symbol, S_IFDIRLNK makes _much_ more sense than >> S_IFGITLINK, exactly because it is a mixture of S_IFDIR and >> S_IFLNK. > > But then we also should be consequent and rename the entire > low-level plumbing to dirlink. I don't see a reason to keep > both. Ok. Let's do that then before it is too late. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] rename gitlink to dirlink. 2007-05-22 6:19 ` Junio C Hamano @ 2007-05-22 11:39 ` Martin Waitz 0 siblings, 0 replies; 7+ messages in thread From: Martin Waitz @ 2007-05-22 11:39 UTC (permalink / raw) To: Junio C Hamano; +Cc: Torgil Svensson, git Unify naming of plumbing dirlink/gitlink concept: perl -pi -e 's/gitlink/dirlink/g' Signed-off-by: Martin Waitz <tali@admingilde.org> --- On Mon, May 21, 2007 at 11:19:05PM -0700, Junio C Hamano wrote: > > But then we also should be consequent and rename the entire > > low-level plumbing to dirlink. I don't see a reason to keep > > both. > > Ok. Let's do that then before it is too late. now you can choose which one you want to apply... builtin-ls-files.c | 2 +- builtin-update-index.c | 14 +++++++------- diff.c | 4 ++-- dir.c | 10 +++++----- entry.c | 2 +- list-objects.c | 10 +++++----- read-cache.c | 6 +++--- refs.c | 12 ++++++------ refs.h | 4 ++-- sha1_file.c | 2 +- tree.c | 2 +- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/builtin-ls-files.c b/builtin-ls-files.c index f7c066b..ad0267b 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -97,7 +97,7 @@ static void show_other_files(struct dir_struct *dir) * * (Matching entries are normally pruned during * the directory tree walk, but will show up for - * gitlinks because we don't necessarily have + * dirlinks because we don't necessarily have * dir->show_other_directories set to suppress * them). */ diff --git a/builtin-update-index.c b/builtin-update-index.c index 8f98991..7fe2466 100644 --- a/builtin-update-index.c +++ b/builtin-update-index.c @@ -106,7 +106,7 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru /* * Handle a path that was a directory. Four cases: * - * - it's already a gitlink in the index, and we keep it that + * - it's already a dirlink in the index, and we keep it that * way, and update it if we can (if we cannot find the HEAD, * we're going to keep it unchanged in the index!) * @@ -124,20 +124,20 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru * to try to update it as a directory. * * - it doesn't exist at all in the index, but it is a valid - * git directory, and it should be *added* as a gitlink. + * git directory, and it should be *added* as a dirlink. */ static int process_directory(const char *path, int len, struct stat *st) { unsigned char sha1[20]; int pos = cache_name_pos(path, len); - /* Exact match: file or existing gitlink */ + /* Exact match: file or existing dirlink */ if (pos >= 0) { struct cache_entry *ce = active_cache[pos]; if (S_ISDIRLNK(ntohl(ce->ce_mode))) { /* Do nothing to the index if there is no HEAD! */ - if (resolve_gitlink_ref(path, "HEAD", sha1) < 0) + if (resolve_dirlink_ref(path, "HEAD", sha1) < 0) return 0; return add_one_path(ce, path, len, st); @@ -162,8 +162,8 @@ static int process_directory(const char *path, int len, struct stat *st) return error("%s: is a directory - add individual files instead", path); } - /* No match - should we add it as a gitlink? */ - if (!resolve_gitlink_ref(path, "HEAD", sha1)) + /* No match - should we add it as a dirlink? */ + if (!resolve_dirlink_ref(path, "HEAD", sha1)) return add_one_path(NULL, path, len, st); /* Error out. */ @@ -179,7 +179,7 @@ static int process_file(const char *path, int len, struct stat *st) struct cache_entry *ce = pos < 0 ? NULL : active_cache[pos]; if (ce && S_ISDIRLNK(ntohl(ce->ce_mode))) - return error("%s is already a gitlink, not replacing", path); + return error("%s is already a dirlink, not replacing", path); return add_one_path(ce, path, len, st); } diff --git a/diff.c b/diff.c index 33297aa..434947e 100644 --- a/diff.c +++ b/diff.c @@ -1432,7 +1432,7 @@ static int populate_from_stdin(struct diff_filespec *s) return 0; } -static int diff_populate_gitlink(struct diff_filespec *s, int size_only) +static int diff_populate_dirlink(struct diff_filespec *s, int size_only) { int len; char *data = xmalloc(100); @@ -1468,7 +1468,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only) return 0; if (S_ISDIRLNK(s->mode)) - return diff_populate_gitlink(s, size_only); + return diff_populate_dirlink(s, size_only); if (!s->sha1_valid || reuse_worktree_file(s->path, s->sha1, 0)) { diff --git a/dir.c b/dir.c index 11fab7f..1f17fc7 100644 --- a/dir.c +++ b/dir.c @@ -300,7 +300,7 @@ enum exist_status { /* * The index sorts alphabetically by entry name, which - * means that a gitlink sorts as '\0' at the end, while + * means that a dirlink sorts as '\0' at the end, while * a directory (which is defined not as an entry, but as * the files it contains) will sort with the '/' at the * end. @@ -343,8 +343,8 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len) * directory name, we always recurse into the directory to see * all the files. * - * Case 2: If we *already* have that directory name as a gitlink, - * we always continue to see it as a gitlink, regardless of whether + * Case 2: If we *already* have that directory name as a dirlink, + * we always continue to see it as a dirlink, regardless of whether * there is an actual git directory there or not (it might not * be checked out as a subproject!) * @@ -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 * we just ignore it entirely. * (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_dirlinks' set we treat it as a dirlink, and show it * as a directory. * (c) otherwise, we recurse into it. */ @@ -385,7 +385,7 @@ static enum directory_treatment treat_directory(struct dir_struct *dir, break; if (!dir->no_dirlinks) { unsigned char sha1[20]; - if (resolve_gitlink_ref(dirname, "HEAD", sha1) == 0) + if (resolve_dirlink_ref(dirname, "HEAD", sha1) == 0) return show_directory; } return recurse_into_directory; diff --git a/entry.c b/entry.c index 82bf725..db66663 100644 --- a/entry.c +++ b/entry.c @@ -193,7 +193,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t */ unlink(path); if (S_ISDIR(st.st_mode)) { - /* If it is a gitlink, leave it alone! */ + /* If it is a dirlink, leave it alone! */ if (S_ISDIRLNK(ntohl(ce->ce_mode))) return 0; if (!state->force) diff --git a/list-objects.c b/list-objects.c index 310f8d3..8027e02 100644 --- a/list-objects.c +++ b/list-objects.c @@ -26,7 +26,7 @@ static void process_blob(struct rev_info *revs, } /* - * Processing a gitlink entry currently does nothing, since + * Processing a dirlink entry currently does nothing, since * we do not recurse into the subproject. * * We *could* eventually add a flag that actually does that, @@ -34,20 +34,20 @@ static void process_blob(struct rev_info *revs, * - is the subproject actually checked out? * - if so, see if the subproject has already been added * to the alternates list, and add it if not. - * - process the commit (or tag) the gitlink points to + * - process the commit (or tag) the dirlink points to * recursively. * * However, it's unclear whether there is really ever any * reason to see superprojects and subprojects as such a * "unified" object pool (potentially resulting in a totally * humongous pack - avoiding which was the whole point of - * having gitlinks in the first place!). + * having dirlinks in the first place!). * * So for now, there is just a note that we *could* follow * the link, and how to do it. Whether it necessarily makes * any sense what-so-ever to ever do that is another issue. */ -static void process_gitlink(struct rev_info *revs, +static void process_dirlink(struct rev_info *revs, const unsigned char *sha1, struct object_array *p, struct name_path *path, @@ -88,7 +88,7 @@ static void process_tree(struct rev_info *revs, lookup_tree(entry.sha1), p, &me, entry.path); else if (S_ISDIRLNK(entry.mode)) - process_gitlink(revs, entry.sha1, + process_dirlink(revs, entry.sha1, p, &me, entry.path); else process_blob(revs, diff --git a/read-cache.c b/read-cache.c index d9f46da..3aa92a4 100644 --- a/read-cache.c +++ b/read-cache.c @@ -86,7 +86,7 @@ static int ce_compare_link(struct cache_entry *ce, size_t expected_size) return match; } -static int ce_compare_gitlink(struct cache_entry *ce) +static int ce_compare_dirlink(struct cache_entry *ce) { unsigned char sha1[20]; @@ -98,7 +98,7 @@ static int ce_compare_gitlink(struct cache_entry *ce) * * If so, we consider it always to match. */ - if (resolve_gitlink_ref(ce->name, "HEAD", sha1) < 0) + if (resolve_dirlink_ref(ce->name, "HEAD", sha1) < 0) return 0; return hashcmp(sha1, ce->sha1); } @@ -145,7 +145,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) case S_IFDIRLNK: if (!S_ISDIR(st->st_mode)) changed |= TYPE_CHANGED; - else if (ce_compare_gitlink(ce)) + else if (ce_compare_dirlink(ce)) changed |= DATA_CHANGED; return changed; default: diff --git a/refs.c b/refs.c index 89876bf..ee79329 100644 --- a/refs.c +++ b/refs.c @@ -285,7 +285,7 @@ static struct ref_list *get_loose_refs(void) #define MAXDEPTH 5 #define MAXREFLEN (1024) -static int resolve_gitlink_packed_ref(char *name, int pathlen, const char *refname, unsigned char *result) +static int resolve_dirlink_packed_ref(char *name, int pathlen, const char *refname, unsigned char *result) { FILE *f; struct cached_refs refs; @@ -312,7 +312,7 @@ static int resolve_gitlink_packed_ref(char *name, int pathlen, const char *refna return retval; } -static int resolve_gitlink_ref_recursive(char *name, int pathlen, const char *refname, unsigned char *result, int recursion) +static int resolve_dirlink_ref_recursive(char *name, int pathlen, const char *refname, unsigned char *result, int recursion) { int fd, len = strlen(refname); char buffer[128], *p; @@ -322,7 +322,7 @@ static int resolve_gitlink_ref_recursive(char *name, int pathlen, const char *re memcpy(name + pathlen, refname, len+1); fd = open(name, O_RDONLY); if (fd < 0) - return resolve_gitlink_packed_ref(name, pathlen, refname, result); + return resolve_dirlink_packed_ref(name, pathlen, refname, result); len = read(fd, buffer, sizeof(buffer)-1); close(fd); @@ -343,10 +343,10 @@ static int resolve_gitlink_ref_recursive(char *name, int pathlen, const char *re while (isspace(*p)) p++; - return resolve_gitlink_ref_recursive(name, pathlen, p, result, recursion+1); + return resolve_dirlink_ref_recursive(name, pathlen, p, result, recursion+1); } -int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *result) +int resolve_dirlink_ref(const char *path, const char *refname, unsigned char *result) { int len = strlen(path), retval; char *gitdir; @@ -359,7 +359,7 @@ int resolve_gitlink_ref(const char *path, const char *refname, unsigned char *re memcpy(gitdir, path, len); memcpy(gitdir + len, "/.git/", 7); - retval = resolve_gitlink_ref_recursive(gitdir, len+6, refname, result, 0); + retval = resolve_dirlink_ref_recursive(gitdir, len+6, refname, result, 0); free(gitdir); return retval; } diff --git a/refs.h b/refs.h index f61f6d9..5cbb711 100644 --- a/refs.h +++ b/refs.h @@ -60,7 +60,7 @@ extern int check_ref_format(const char *target); /** rename ref, return 0 on success **/ extern int rename_ref(const char *oldref, const char *newref, const char *logmsg); -/** resolve ref in nested "gitlink" repository */ -extern int resolve_gitlink_ref(const char *name, const char *refname, unsigned char *result); +/** resolve ref in nested "dirlink" repository */ +extern int resolve_dirlink_ref(const char *name, const char *refname, unsigned char *result); #endif /* REFS_H */ diff --git a/sha1_file.c b/sha1_file.c index be991ed..c37fbed 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2393,7 +2393,7 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write free(target); break; case S_IFDIR: - return resolve_gitlink_ref(path, "HEAD", sha1); + return resolve_dirlink_ref(path, "HEAD", sha1); default: return error("%s: unsupported file type", path); } diff --git a/tree.c b/tree.c index e4a39aa..d8014eb 100644 --- a/tree.c +++ b/tree.c @@ -141,7 +141,7 @@ struct tree *lookup_tree(const unsigned char *sha1) /* * NOTE! Tree refs to external git repositories - * (ie gitlinks) do not count as real references. + * (ie dirlinks) do not count as real references. * * You don't have to have those repositories * available at all, much less have the objects -- 1.5.0.3 -- Martin Waitz ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] rename dirlink to gitlink. 2007-05-21 23:32 ` Junio C Hamano 2007-05-22 5:59 ` Martin Waitz @ 2007-05-22 11:53 ` Petr Baudis 1 sibling, 0 replies; 7+ messages in thread From: Petr Baudis @ 2007-05-22 11:53 UTC (permalink / raw) To: Junio C Hamano; +Cc: Torgil Svensson, Martin Waitz, git On Tue, May 22, 2007 at 01:32:51AM CEST, Junio C Hamano wrote: > "Torgil Svensson" <torgil.svensson@gmail.com> writes: > > > On 5/21/07, Martin Waitz <tali@admingilde.org> wrote: > >> Unify naming of plumbing dirlink/gitlink concept: > >> > >> perl -pi -e 's/dirlink/gitlink/g' -e 's/DIRLNK/GITLINK/g' > >> --- > > > > Does this mean that the link doesn't necessarily has to be represented > > as a directory (even though current code does it) ? > > I do not think the patch has that much deep meaning. > > Personally I think the patch is similar to renaming "cache" used > in the code to "index" --- needless code shuffling that does not > buy you anything. FWIW, I seriously considered making a patch for that several times - but always found something better to do; that is, it is not so big an itch for me to scratch unless I'd be really bored and miss some goot git@ flamewar badly ;-). However, I still think that using "cache" in the code is a mistake - it's confusing and inconsistent. (BTW, the other thing I hate about the codebase are the filenames. When I want to look at the source of some command, I have to try THREE names: git-something.<tab> (sh, perl, ...), builtin-something.c and something.c. I wish I could just write git-something.<tab>. :-) -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Ever try. Ever fail. No matter. // Try again. Fail again. Fail better. -- Samuel Beckett ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-05-22 11:54 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-05-21 20:08 [PATCH] rename dirlink to gitlink Martin Waitz 2007-05-21 23:12 ` Torgil Svensson 2007-05-21 23:32 ` Junio C Hamano 2007-05-22 5:59 ` Martin Waitz 2007-05-22 6:19 ` Junio C Hamano 2007-05-22 11:39 ` [PATCH] rename gitlink to dirlink Martin Waitz 2007-05-22 11:53 ` [PATCH] rename dirlink to gitlink Petr Baudis
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).