projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git-read-tree: -u without -m is meaningless. Don't allow it.
[git.git]
/
read-tree.c
diff --git
a/read-tree.c
b/read-tree.c
index
8eb2432
..
fbd0da0
100644
(file)
--- a/
read-tree.c
+++ b/
read-tree.c
@@
-218,11
+218,11
@@
static int oneway_merge(struct cache_entry **src, struct cache_entry **dst)
if (!a)
return 0;
if (!a)
return 0;
- if (old && same(old, a))
- *
a = *
old;
-
a->ce_flags &= ~htons(CE_STAGEMASK)
;
- *dst++ = a;
- return
1
;
+ if (old && same(old, a))
{
+ *
dst++ =
old;
+
return 1
;
+ }
+ return
merged_entry(a, NULL, dst)
;
}
static void check_updates(struct cache_entry **src, int nr)
}
static void check_updates(struct cache_entry **src, int nr)
@@
-275,7
+275,7
@@
static void merge_cache(struct cache_entry **src, int nr, merge_fn_t fn)
check_updates(active_cache, active_nr);
}
check_updates(active_cache, active_nr);
}
-static char *read_tree_usage = "git-read-tree (<sha> | -m <sha1> [<sha2> [<sha3>]])";
+static char *read_tree_usage = "git-read-tree (<sha> | -m
[-u]
<sha1> [<sha2> [<sha3>]])";
static struct cache_file cache_file;
static struct cache_file cache_file;
@@
-320,6
+320,8
@@
int main(int argc, char **argv)
die("failed to unpack tree object %s", arg);
stage++;
}
die("failed to unpack tree object %s", arg);
stage++;
}
+ if (update && !merge)
+ usage(read_tree_usage);
if (merge) {
static const merge_fn_t merge_function[] = {
[1] = oneway_merge,
if (merge) {
static const merge_fn_t merge_function[] = {
[1] = oneway_merge,