Merge branch 'rs/unpack-trees-tree-walk-conflict-field'
Code clean-up. * rs/unpack-trees-tree-walk-conflict-field: unpack-trees: don't shift conflicts left and right
This commit is contained in:
commit
bd21822572
@ -46,7 +46,7 @@ struct traverse_info {
|
|||||||
int pathlen;
|
int pathlen;
|
||||||
struct pathspec *pathspec;
|
struct pathspec *pathspec;
|
||||||
|
|
||||||
unsigned long conflicts;
|
unsigned long df_conflicts;
|
||||||
traverse_callback_t fn;
|
traverse_callback_t fn;
|
||||||
void *data;
|
void *data;
|
||||||
int show_all_errors;
|
int show_all_errors;
|
||||||
|
@ -464,7 +464,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
|
|||||||
newinfo.pathspec = info->pathspec;
|
newinfo.pathspec = info->pathspec;
|
||||||
newinfo.name = *p;
|
newinfo.name = *p;
|
||||||
newinfo.pathlen += tree_entry_len(p) + 1;
|
newinfo.pathlen += tree_entry_len(p) + 1;
|
||||||
newinfo.conflicts |= df_conflicts;
|
newinfo.df_conflicts |= df_conflicts;
|
||||||
|
|
||||||
for (i = 0; i < n; i++, dirmask >>= 1) {
|
for (i = 0; i < n; i++, dirmask >>= 1) {
|
||||||
const unsigned char *sha1 = NULL;
|
const unsigned char *sha1 = NULL;
|
||||||
@ -565,17 +565,12 @@ static int unpack_nondirectories(int n, unsigned long mask,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct unpack_trees_options *o = info->data;
|
struct unpack_trees_options *o = info->data;
|
||||||
unsigned long conflicts;
|
unsigned long conflicts = info->df_conflicts | dirmask;
|
||||||
|
|
||||||
/* Do we have *only* directories? Nothing to do */
|
/* Do we have *only* directories? Nothing to do */
|
||||||
if (mask == dirmask && !src[0])
|
if (mask == dirmask && !src[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
conflicts = info->conflicts;
|
|
||||||
if (o->merge)
|
|
||||||
conflicts >>= 1;
|
|
||||||
conflicts |= dirmask;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ok, we've filled in up to any potential index entry in src[0],
|
* Ok, we've filled in up to any potential index entry in src[0],
|
||||||
* now do the rest.
|
* now do the rest.
|
||||||
@ -807,13 +802,6 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
|
|||||||
|
|
||||||
/* Now handle any directories.. */
|
/* Now handle any directories.. */
|
||||||
if (dirmask) {
|
if (dirmask) {
|
||||||
unsigned long conflicts = mask & ~dirmask;
|
|
||||||
if (o->merge) {
|
|
||||||
conflicts <<= 1;
|
|
||||||
if (src[0])
|
|
||||||
conflicts |= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* special case: "diff-index --cached" looking at a tree */
|
/* special case: "diff-index --cached" looking at a tree */
|
||||||
if (o->diff_index_cached &&
|
if (o->diff_index_cached &&
|
||||||
n == 1 && dirmask == 1 && S_ISDIR(names->mode)) {
|
n == 1 && dirmask == 1 && S_ISDIR(names->mode)) {
|
||||||
@ -832,7 +820,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (traverse_trees_recursive(n, dirmask, conflicts,
|
if (traverse_trees_recursive(n, dirmask, mask & ~dirmask,
|
||||||
names, info) < 0)
|
names, info) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return mask;
|
return mask;
|
||||||
|
Loading…
Reference in New Issue
Block a user