Merge branch 'jc/cachetree' into cr/reset
authorJunio C Hamano <gitster@pobox.com>
Fri, 14 Sep 2007 08:19:30 +0000 (01:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Sep 2007 08:19:30 +0000 (01:19 -0700)
* jc/cachetree:
Simplify cache API
git-format-patch --in-reply-to: accept <message@id> with angle brackets
git-add -u: do not barf on type changes
Remove duplicate note about removing commits with git-filter-branch
git-clone: improve error message if curl program is missing or not executable
git.el: Allow the add and remove commands to be applied to ignored files.
git.el: Allow selecting whether to display uptodate/unknown/ignored files.
git.el: Keep the status buffer sorted by filename.
hooks--update: Explicitly check for all zeros for a deleted ref.

1  2 
read-cache.c
diff --combined read-cache.c
index 536f4d0875ffec13706ef7e14805652f08fcc570,d82a99a9158f46cbf81d5dda8de1a28228ac16cb..2e40a344209e010e664758865846b63dc9546c1f
@@@ -346,6 -346,7 +346,7 @@@ int remove_file_from_index(struct index
        int pos = index_name_pos(istate, path, strlen(path));
        if (pos < 0)
                pos = -pos-1;
+       cache_tree_invalidate_path(istate->cache_tree, path);
        while (pos < istate->cache_nr && !strcmp(istate->cache[pos]->name, path))
                remove_index_entry_at(istate, pos);
        return 0;
@@@ -430,35 -431,9 +431,34 @@@ int add_file_to_index(struct index_stat
                die("unable to add %s to index",path);
        if (verbose)
                printf("add '%s'\n", path);
-       cache_tree_invalidate_path(istate->cache_tree, path);
        return 0;
  }
  
 +struct cache_entry *make_cache_entry(unsigned int mode,
 +              const unsigned char *sha1, const char *path, int stage,
 +              int refresh)
 +{
 +      int size, len;
 +      struct cache_entry *ce;
 +
 +      if (!verify_path(path))
 +              return NULL;
 +
 +      len = strlen(path);
 +      size = cache_entry_size(len);
 +      ce = xcalloc(1, size);
 +
 +      hashcpy(ce->sha1, sha1);
 +      memcpy(ce->name, path, len);
 +      ce->ce_flags = create_ce_flags(len, stage);
 +      ce->ce_mode = create_ce_mode(mode);
 +
 +      if (refresh)
 +              return refresh_cache_entry(ce, 0);
 +
 +      return ce;
 +}
 +
  int ce_same_name(struct cache_entry *a, struct cache_entry *b)
  {
        int len = ce_namelen(a);
@@@ -698,6 -673,7 +698,7 @@@ static int add_index_entry_with_check(s
        int ok_to_replace = option & ADD_CACHE_OK_TO_REPLACE;
        int skip_df_check = option & ADD_CACHE_SKIP_DFCHECK;
  
+       cache_tree_invalidate_path(istate->cache_tree, ce->name);
        pos = index_name_pos(istate, ce->name, ntohs(ce->ce_flags));
  
        /* existing match? Just replace it. */