X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-ls-tree.c;h=1cb4dca277b511315d3b914239c57621fc60bcf3;hb=4c7100a9f438c281c18c800b450ea12045d22d62;hp=261147fdbe76cf9d277bd420cc17efedecc2da2f;hpb=7061cf0f205e86613c3a3306fdfedf2a5dcc8a65;p=git.git diff --git a/builtin-ls-tree.c b/builtin-ls-tree.c index 261147fdb..1cb4dca27 100644 --- a/builtin-ls-tree.c +++ b/builtin-ls-tree.c @@ -6,6 +6,7 @@ #include "cache.h" #include "blob.h" #include "tree.h" +#include "commit.h" #include "quote.h" #include "builtin.h" @@ -14,10 +15,10 @@ static int line_termination = '\n'; #define LS_TREE_ONLY 2 #define LS_SHOW_TREES 4 #define LS_NAME_ONLY 8 -static int abbrev = 0; -static int ls_options = 0; +static int abbrev; +static int ls_options; static const char **pathspec; -static int chomp_prefix = 0; +static int chomp_prefix; static const char *ls_tree_prefix; static const char ls_tree_usage[] = @@ -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)) @@ -118,7 +136,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix) chomp_prefix = 0; break; } - if (!strncmp(argv[1]+2, "abbrev=",7)) { + if (!prefixcmp(argv[1]+2, "abbrev=")) { abbrev = strtoul(argv[1]+9, NULL, 10); if (abbrev && abbrev < MINIMUM_ABBREV) abbrev = MINIMUM_ABBREV;