summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-24 01:28:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-24 01:28:37 (GMT)
commitd6096f17d2d5d9ccb453aabf8edc6ee238b166fc (patch)
tree0699a406f367814d799817402044b89c44491d97
parenta7b3269c4b9acde052d75b6dc54c8f869b77eb44 (diff)
parent913e0e99b6a6e63af6a062622a1f94bd78fd8052 (diff)
downloadgit-d6096f17d2d5d9ccb453aabf8edc6ee238b166fc.zip
git-d6096f17d2d5d9ccb453aabf8edc6ee238b166fc.tar.gz
git-d6096f17d2d5d9ccb453aabf8edc6ee238b166fc.tar.bz2
Merge branch 'maint'
* maint: unpack_trees(): protect the handcrafted in-core index from read_cache() git-p4: Fix one-liner in p4_write_pipe function. Completion: add missing '=' for 'diff --diff-filter' Fix 'git help help'
-rw-r--r--cache.h3
-rwxr-xr-xcontrib/completion/git-completion.bash2
-rwxr-xr-xcontrib/fast-import/git-p42
-rw-r--r--help.c3
-rw-r--r--read-cache.c4
-rw-r--r--unpack-trees.c1
6 files changed, 10 insertions, 5 deletions
diff --git a/cache.h b/cache.h
index a097a95..ab9f97e 100644
--- a/cache.h
+++ b/cache.h
@@ -223,7 +223,8 @@ struct index_state {
struct cache_tree *cache_tree;
time_t timestamp;
void *alloc;
- unsigned name_hash_initialized : 1;
+ unsigned name_hash_initialized : 1,
+ initialized : 1;
struct hash_table name_hash;
};
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a310040..89858c2 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -771,7 +771,7 @@ _git_diff ()
__gitcomp "--cached --stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--no-color --color-words --no-renames --check
- --full-index --binary --abbrev --diff-filter
+ --full-index --binary --abbrev --diff-filter=
--find-copies-harder --pickaxe-all --pickaxe-regex
--text --ignore-space-at-eol --ignore-space-change
--ignore-all-space --exit-code --quiet --ext-diff
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index f9865b4..46136d4 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -76,7 +76,7 @@ def write_pipe(c, str):
def p4_write_pipe(c, str):
real_cmd = p4_build_cmd(c)
- return write_pipe(c, str)
+ return write_pipe(real_cmd, str)
def read_pipe(c, ignore_error=False):
if verbose:
diff --git a/help.c b/help.c
index 3cb1962..dc0786d 100644
--- a/help.c
+++ b/help.c
@@ -555,7 +555,8 @@ static int is_git_command(const char *s)
{
load_command_list();
return is_in_cmdlist(&main_cmds, s) ||
- is_in_cmdlist(&other_cmds, s);
+ is_in_cmdlist(&other_cmds, s) ||
+ !strcmp(s, "help");
}
static const char *prepend(const char *prefix, const char *cmd)
diff --git a/read-cache.c b/read-cache.c
index f0ba224..a857c8e 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1159,7 +1159,7 @@ int read_index_from(struct index_state *istate, const char *path)
size_t mmap_size;
errno = EBUSY;
- if (istate->alloc)
+ if (istate->initialized)
return istate->cache_nr;
errno = ENOENT;
@@ -1199,6 +1199,7 @@ int read_index_from(struct index_state *istate, const char *path)
* index size
*/
istate->alloc = xmalloc(estimate_cache_size(mmap_size, istate->cache_nr));
+ istate->initialized = 1;
src_offset = sizeof(*hdr);
dst_offset = 0;
@@ -1251,6 +1252,7 @@ int discard_index(struct index_state *istate)
cache_tree_free(&(istate->cache_tree));
free(istate->alloc);
istate->alloc = NULL;
+ istate->initialized = 0;
/* no need to throw away allocated active_cache */
return 0;
diff --git a/unpack-trees.c b/unpack-trees.c
index cba0aca..ef21c62 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -376,6 +376,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
state.refresh_cache = 1;
memset(&o->result, 0, sizeof(o->result));
+ o->result.initialized = 1;
if (o->src_index)
o->result.timestamp = o->src_index->timestamp;
o->merge_size = len;