projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Common option parsing for "git log --diff" and friends
[git.git]
/
read-tree.c
diff --git
a/read-tree.c
b/read-tree.c
index
32fb6fa
..
26f4f7e
100644
(file)
--- a/
read-tree.c
+++ b/
read-tree.c
@@
-133,11
+133,9
@@
static int unpack_trees_rec(struct tree_entry_list **posns, int len,
pathlen = strlen(first);
ce_size = cache_entry_size(baselen + pathlen);
pathlen = strlen(first);
ce_size = cache_entry_size(baselen + pathlen);
- src = xmalloc(sizeof(struct cache_entry *) * src_size);
- memset(src, 0, sizeof(struct cache_entry *) * src_size);
+ src = xcalloc(src_size, sizeof(struct cache_entry *));
- subposns = xmalloc(sizeof(struct tree_list_entry *) * len);
- memset(subposns, 0, sizeof(struct tree_list_entry *) * len);
+ subposns = xcalloc(len, sizeof(struct tree_list_entry *));
if (cache_name && !strcmp(cache_name, first)) {
any_files = 1;
if (cache_name && !strcmp(cache_name, first)) {
any_files = 1;
@@
-177,8
+175,7
@@
static int unpack_trees_rec(struct tree_entry_list **posns, int len,
else
ce_stage = 2;
else
ce_stage = 2;
- ce = xmalloc(ce_size);
- memset(ce, 0, ce_size);
+ ce = xcalloc(1, ce_size);
ce->ce_mode = create_ce_mode(posns[i]->mode);
ce->ce_flags = create_ce_flags(baselen + pathlen,
ce_stage);
ce->ce_mode = create_ce_mode(posns[i]->mode);
ce->ce_flags = create_ce_flags(baselen + pathlen,
ce_stage);
@@
-347,7
+344,7
@@
static void check_updates(struct cache_entry **src, int nr)
if (ce->ce_flags & mask) {
ce->ce_flags &= ~mask;
if (update)
if (ce->ce_flags & mask) {
ce->ce_flags &= ~mask;
if (update)
- checkout_entry(ce, &state);
+ checkout_entry(ce, &state
, NULL
);
}
}
if (total) {
}
}
if (total) {
@@
-414,7
+411,7
@@
static void verify_uptodate(struct cache_entry *ce)
return;
if (!lstat(ce->name, &st)) {
return;
if (!lstat(ce->name, &st)) {
- unsigned changed = ce_match_stat(ce, &st);
+ unsigned changed = ce_match_stat(ce, &st
, 1
);
if (!changed)
return;
errno = 0;
if (!changed)
return;
errno = 0;
@@
-716,7
+713,7
@@
static int read_cache_unmerged(void)
return deleted;
}
return deleted;
}
-static const char read_tree_usage[] = "git-read-tree (<sha> | -m [-u | -i] <sha1> [<sha2> [<sha3>]])";
+static const char read_tree_usage[] = "git-read-tree (<sha> | -m [-
-aggressive] [-
u | -i] <sha1> [<sha2> [<sha3>]])";
static struct cache_file cache_file;
static struct cache_file cache_file;
@@
-727,6
+724,7
@@
int main(int argc, char **argv)
merge_fn_t fn = NULL;
setup_git_directory();
merge_fn_t fn = NULL;
setup_git_directory();
+ git_config(git_default_config);
newfd = hold_index_file_for_update(&cache_file, get_index_file());
if (newfd < 0)
newfd = hold_index_file_for_update(&cache_file, get_index_file());
if (newfd < 0)