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>
This commit is contained in:

committed by
Junio C Hamano

parent
8d9721c86b
commit
f35a6d3bce
@ -6,6 +6,7 @@
|
||||
#include "cache.h"
|
||||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
#include "commit.h"
|
||||
#include "quote.h"
|
||||
#include "builtin.h"
|
||||
|
||||
@ -59,7 +60,24 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
|
||||
int retval = 0;
|
||||
const char *type = blob_type;
|
||||
|
||||
if (S_ISDIR(mode)) {
|
||||
if (S_ISDIRLNK(mode)) {
|
||||
/*
|
||||
* Maybe we want to have some recursive version here?
|
||||
*
|
||||
* Something like:
|
||||
*
|
||||
if (show_subprojects(base, baselen, pathname)) {
|
||||
if (fork()) {
|
||||
chdir(base);
|
||||
exec ls-tree;
|
||||
}
|
||||
waitpid();
|
||||
}
|
||||
*
|
||||
* ..or similar..
|
||||
*/
|
||||
type = commit_type;
|
||||
} else if (S_ISDIR(mode)) {
|
||||
if (show_recursive(base, baselen, pathname)) {
|
||||
retval = READ_TREE_RECURSIVE;
|
||||
if (!(ls_options & LS_SHOW_TREES))
|
||||
|
Reference in New Issue
Block a user