зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/maint-reset-unmerged-path' into maint
* jc/maint-reset-unmerged-path: reset [<commit>] paths...: do not mishandle unmerged paths
This commit is contained in:
Коммит
7aa50897dd
|
@ -162,7 +162,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
|
||||||
|
|
||||||
for (i = 0; i < q->nr; i++) {
|
for (i = 0; i < q->nr; i++) {
|
||||||
struct diff_filespec *one = q->queue[i]->one;
|
struct diff_filespec *one = q->queue[i]->one;
|
||||||
if (one->mode) {
|
if (one->mode && !is_null_sha1(one->sha1)) {
|
||||||
struct cache_entry *ce;
|
struct cache_entry *ce;
|
||||||
ce = make_cache_entry(one->mode, one->sha1, one->path,
|
ce = make_cache_entry(one->mode, one->sha1, one->path,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
|
@ -379,7 +379,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
|
||||||
if (cached && idx && ce_stage(idx)) {
|
if (cached && idx && ce_stage(idx)) {
|
||||||
struct diff_filepair *pair;
|
struct diff_filepair *pair;
|
||||||
pair = diff_unmerge(&revs->diffopt, idx->name);
|
pair = diff_unmerge(&revs->diffopt, idx->name);
|
||||||
fill_filespec(pair->one, idx->sha1, idx->ce_mode);
|
if (tree)
|
||||||
|
fill_filespec(pair->one, tree->sha1, tree->ce_mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -429,6 +429,21 @@ test_expect_success '--mixed refreshes the index' '
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'resetting specific path that is unmerged' '
|
||||||
|
git rm --cached file2 &&
|
||||||
|
F1=$(git rev-parse HEAD:file1) &&
|
||||||
|
F2=$(git rev-parse HEAD:file2) &&
|
||||||
|
F3=$(git rev-parse HEAD:secondfile) &&
|
||||||
|
{
|
||||||
|
echo "100644 $F1 1 file2" &&
|
||||||
|
echo "100644 $F2 2 file2" &&
|
||||||
|
echo "100644 $F3 3 file2"
|
||||||
|
} | git update-index --index-info &&
|
||||||
|
git ls-files -u &&
|
||||||
|
test_must_fail git reset HEAD file2 &&
|
||||||
|
git diff-index --exit-code --cached HEAD
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'disambiguation (1)' '
|
test_expect_success 'disambiguation (1)' '
|
||||||
|
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче