summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-04-10 04:20:29 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-10 20:50:43 (GMT)
commitf35a6d3bce79c2995bbf0a3bd9fcad29e54a8d3c (patch)
treefca31eb00aea9a6a82ff493090c2da81af761ccc /sha1_file.c
parent8d9721c86b0169c282ad1c5528317eafeb7fb0f7 (diff)
downloadgit-f35a6d3bce79c2995bbf0a3bd9fcad29e54a8d3c.zip
git-f35a6d3bce79c2995bbf0a3bd9fcad29e54a8d3c.tar.gz
git-f35a6d3bce79c2995bbf0a3bd9fcad29e54a8d3c.tar.bz2
Teach core object handling functions about gitlinks
This teaches the really fundamental core SHA1 object handling routines about gitlinks. We can compare trees with gitlinks in them (although we can not actually generate patches for them yet - just raw git diffs), and they show up as commits in "git ls-tree". We also know to compare gitlinks as if they were directories (ie the normal "sort as trees" rules apply). [jc: amended a cut&paste error] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 4304fe9..ab915fa 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -13,6 +13,7 @@
#include "commit.h"
#include "tag.h"
#include "tree.h"
+#include "refs.h"
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
@@ -2332,6 +2333,8 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
path);
free(target);
break;
+ case S_IFDIR:
+ return resolve_gitlink_ref(path, "HEAD", sha1);
default:
return error("%s: unsupported file type", path);
}