Skip to content

Commit 8b36c89

Browse files
committed
Merge branch 'en/t3433-rebase-stat-dirty-failure' into pu
* en/t3433-rebase-stat-dirty-failure: merge-recursive: fix the refresh logic in update_file_flags t3433: new rebase testcase documenting a stat-dirty-like failure
2 parents d2ecc83 + fb1c18f commit 8b36c89

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

merge-recursive.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,13 @@ static int update_file_flags(struct merge_options *opt,
998998
free(buf);
999999
}
10001000
update_index:
1001-
if (!ret && update_cache)
1002-
if (add_cacheinfo(opt, contents, path, 0, update_wd,
1001+
if (!ret && update_cache) {
1002+
int refresh = (!opt->priv->call_depth &&
1003+
contents->mode != S_IFGITLINK);
1004+
if (add_cacheinfo(opt, contents, path, 0, refresh,
10031005
ADD_CACHE_OK_TO_ADD))
10041006
return -1;
1007+
}
10051008
return ret;
10061009
}
10071010

t/t3433-rebase-across-mode-change.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
test_description='git rebase across mode change'
4+
5+
. ./test-lib.sh
6+
7+
test_expect_success 'setup' '
8+
mkdir DS &&
9+
>DS/whatever &&
10+
git add DS &&
11+
git commit -m base &&
12+
13+
git branch side1 &&
14+
git branch side2 &&
15+
16+
git checkout side1 &&
17+
git rm -rf DS &&
18+
test_ln_s_add unrelated DS &&
19+
git commit -m side1 &&
20+
21+
git checkout side2 &&
22+
>unrelated &&
23+
git add unrelated &&
24+
git commit -m commit1 &&
25+
26+
echo >>unrelated &&
27+
git commit -am commit2
28+
'
29+
30+
test_expect_success 'rebase changes with the apply backend' '
31+
test_when_finished "git rebase --abort || true" &&
32+
git checkout -b apply-backend side2 &&
33+
git rebase side1
34+
'
35+
36+
test_expect_success 'rebase changes with the merge backend' '
37+
test_when_finished "git rebase --abort || true" &&
38+
git checkout -b merge-backend side2 &&
39+
git rebase -m side1
40+
'
41+
42+
test_expect_success 'rebase changes with the merge backend with a delay' '
43+
test_when_finished "git rebase --abort || true" &&
44+
git checkout -b merge-delay-backend side2 &&
45+
git rebase -m --exec "sleep 1" side1
46+
'
47+
48+
test_done

0 commit comments

Comments
 (0)