File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1902,6 +1902,7 @@ static void initialize_attr_index(struct merge_options *opt)
1902
1902
struct index_state * attr_index = & opt -> priv -> attr_index ;
1903
1903
struct cache_entry * ce ;
1904
1904
1905
+ attr_index -> repo = opt -> repo ;
1905
1906
attr_index -> initialized = 1 ;
1906
1907
1907
1908
if (!opt -> renormalize )
Original file line number Diff line number Diff line change @@ -86,6 +86,33 @@ EXPECTED
86
86
test_cmp expected actual
87
87
'
88
88
89
+ test_expect_success ' 3-way merge with --attr-source' '
90
+ test_when_finished rm -rf 3-way &&
91
+ git init 3-way &&
92
+ (
93
+ cd 3-way &&
94
+ test_commit initial file1 foo &&
95
+ base=$(git rev-parse HEAD) &&
96
+ git checkout -b brancha &&
97
+ echo bar >>file1 &&
98
+ git commit -am "adding bar" &&
99
+ source=$(git rev-parse HEAD) &&
100
+ git checkout @{-1} &&
101
+ git checkout -b branchb &&
102
+ echo baz >>file1 &&
103
+ git commit -am "adding baz" &&
104
+ merge=$(git rev-parse HEAD) &&
105
+ git checkout -b gitattributes &&
106
+ test_commit "gitattributes" .gitattributes "file1 merge=union" &&
107
+ git checkout @{-1} &&
108
+ tree=$(git --attr-source=gitattributes merge-tree --write-tree \
109
+ --merge-base "$base" --end-of-options "$source" "$merge") &&
110
+ test_write_lines foo bar baz >expect &&
111
+ git cat-file -p "$tree:file1" >actual &&
112
+ test_cmp expect actual
113
+ )
114
+ '
115
+
89
116
test_expect_success ' file change A, B (same)' '
90
117
git reset --hard initial &&
91
118
test_commit "change-a-b-same-A" "initial-file" "AAA" &&
You can’t perform that action at this time.
0 commit comments