Merge branch 'lt/tree' into jc/lt-tree-n-cache-tree
authorJunio C Hamano <junkio@cox.net>
Mon, 29 May 2006 05:47:53 +0000 (22:47 -0700)
committerJunio C Hamano <junkio@cox.net>
Mon, 29 May 2006 05:47:53 +0000 (22:47 -0700)
* lt/tree: (98 commits)
  Remove "tree->entries" tree-entry list from tree parser
  Switch "read_tree_recursive()" over to tree-walk functionality
  Make "tree_entry" have a SHA1 instead of a union of object pointers
  Add raw tree buffer info to "struct tree"
  Don't use "sscanf()" for tree mode scanning
  git-fetch: avoid using "case ... in (arm)"
  mailinfo: skip bogus UNIX From line inside body
  mailinfo: More carefully parse header lines in read_one_header_line()
  Allow in body headers beyond the in body header prefix.
  More accurately detect header lines in read_one_header_line
  In handle_body only read a line if we don't already have one.
  Refactor commit messge handling.
  Move B and Q decoding into check header.
  Make read_one_header_line return a flag not a length.
  Fix memory leak in "git rev-list --objects"
  gitview: Move the console error messages to message dialog
  gitview: Add key binding for F5.
  Let git-clone to pass --template=dir option to git-init-db.
  Make cvsexportcommit create parent directories as needed.
  Document current cvsexportcommit limitations.
  ...

Conflicts:

Makefile, builtin.h, git.c are trivially resolved.
builtin-read-tree.c needed adjustment for the tree
parser change.

1  2 
.gitignore
Makefile
builtin-apply.c
builtin-read-tree.c
cache.h
fsck-objects.c

diff --cc .gitignore
Simple merge
diff --cc Makefile
Simple merge
diff --cc builtin-apply.c
Simple merge
index 99e7c750444117fe07b25bd75d454f03da2134fe,da0731ca0e3e22dd8cbb9fbde9201c66de406b4a..b93178a4ba02d234e907d10d39e9d56051171dbc
@@@ -9,9 -9,9 +9,11 @@@
  
  #include "object.h"
  #include "tree.h"
 +#include "cache-tree.h"
++#include "tree-walk.h"
  #include <sys/time.h>
  #include <signal.h>
+ #include "builtin.h"
  
  static int reset = 0;
  static int merge = 0;
@@@ -771,39 -761,6 +774,51 @@@ static int read_cache_unmerged(void
        return deleted;
  }
  
-       struct tree_entry_list *ent;
-       int cnt;
 +static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
 +{
-       for (cnt = 0, ent = tree->entries; ent; ent = ent->next) {
-               if (!ent->directory)
++      struct tree_desc desc;
++      int cnt = 0;
 +
 +      memcpy(it->sha1, tree->object.sha1, 20);
-                       struct tree *subtree = (struct tree *)ent->item.tree;
++      desc.buf = tree->buffer;
++      desc.size = tree->size;
++
++      while (desc.size) {
++              unsigned mode;
++              const char *name;
++              const unsigned char *sha1;
++
++              sha1 = tree_entry_extract(&desc, &name, &mode);
++              update_tree_entry(&desc);
++
++              if (!S_ISDIR(mode))
 +                      cnt++;
 +              else {
 +                      struct cache_tree_sub *sub;
-                       sub = cache_tree_sub(it, ent->name);
++                      struct tree *subtree;
++
++                      subtree = lookup_tree(sha1);
 +                      if (!subtree->object.parsed)
 +                              parse_tree(subtree);
++                      sub = cache_tree_sub(it, name);
 +                      sub->cache_tree = cache_tree();
 +                      prime_cache_tree_rec(sub->cache_tree, subtree);
 +                      cnt += sub->cache_tree->entry_count;
 +              }
 +      }
 +      it->entry_count = cnt;
 +}
 +
 +static void prime_cache_tree(void)
 +{
 +      struct tree *tree = (struct tree *)trees->item;
 +      if (!tree)
 +              return;
 +      active_cache_tree = cache_tree();
 +      prime_cache_tree_rec(active_cache_tree, tree);
 +
 +}
 +
  static const char read_tree_usage[] = "git-read-tree (<sha> | -m [--aggressive] [-u | -i] <sha1> [<sha2> [<sha3>]])";
  
  static struct cache_file cache_file;
diff --cc cache.h
Simple merge
diff --cc fsck-objects.c
index 1922b6d84c51588b22553141f608c9a07182560b,ec99a7a6cbed9efeeb6e745a6a288817878b7856..42778e87d077b99a2b5b8e456290cc0fab57a190
@@@ -8,9 -8,9 +8,10 @@@
  #include "tag.h"
  #include "refs.h"
  #include "pack.h"
 +#include "cache-tree.h"
  
  #define REACHABLE 0x0001
+ #define SEEN      0x0002
  
  static int show_root = 0;
  static int show_tags = 0;