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)
19021902 struct index_state * attr_index = & opt -> priv -> attr_index ;
19031903 struct cache_entry * ce ;
19041904
1905+ attr_index -> repo = opt -> repo ;
19051906 attr_index -> initialized = 1 ;
19061907
19071908 if (!opt -> renormalize )
Original file line number Diff line number Diff line change @@ -86,6 +86,33 @@ EXPECTED
8686 test_cmp expected actual
8787'
8888
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+
89116test_expect_success ' file change A, B (same)' '
90117 git reset --hard initial &&
91118 test_commit "change-a-b-same-A" "initial-file" "AAA" &&
You can’t perform that action at this time.
0 commit comments