@matheusbsbs / matheus-bagliano / commits / 0af0ac7ebb
Fork 0

Move MERGE_RR from .git/rr-cache/ into .git/

If you want to reuse the rerere cache in another repository, and set a symbolic link to it, you do not want to have the two repositories interfer with each other by accessing the _same_ MERGE_RR. For example, if you use contrib/git-new-workdir to set up a second working directory, and you have a conflict in one working directory, but commit in the other working directory first, the wrong "resolution" will be recorded. The easy solution is to move MERGE_RR out of the rr-cache/ directory, which also corresponds with the notion that rr-cache/ contains cached resolutions, not some intermediate temporary states. Noticed by Kalle Olavi Niemitalo. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 12, 2008 at 15:56 UTC 0af0ac7ebbbd2afbc4399d5658e193460b4caaa3
3 files changed +5 -5
branch.c
+1 -1
@@ -166,7 +166,7 @@ void create_branch(const char *head,
166 void remove_branch_state(void)
167 {
168 unlink(git_path("MERGE_HEAD"));
169 - unlink(git_path("rr-cache/MERGE_RR"));
169 + unlink(git_path("MERGE_RR"));
170 unlink(git_path("MERGE_MSG"));
171 unlink(git_path("SQUASH_MSG"));
172 }
builtin-rerere.c
+1 -1
@@ -429,7 +429,7 @@ static int setup_rerere(struct path_list *merge_rr)
429 if (!is_rerere_enabled())
430 return -1;
431
432 - merge_rr_path = xstrdup(git_path("rr-cache/MERGE_RR"));
432 + merge_rr_path = xstrdup(git_path("MERGE_RR"));
433 fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1);
434 read_rr(merge_rr);
435 return fd;
t/t4200-rerere.sh
+3 -3
@@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '
57 ! git merge first
58 '
59
60 -sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR)
60 +sha1=$(sed -e 's/ .*//' .git/MERGE_RR)
61 rr=.git/rr-cache/$sha1
62 test_expect_success 'recorded preimage' "grep ^=======$ $rr/preimage"
63
@@ -143,7 +143,7 @@ test_expect_success 'rerere kicked in' "! grep ^=======$ a1"
143 test_expect_success 'rerere prefers first change' 'test_cmp a1 expect'
144
145 rm $rr/postimage
146 -echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/rr-cache/MERGE_RR
146 +echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/MERGE_RR
147
148 test_expect_success 'rerere clear' 'git rerere clear'
149
@@ -190,7 +190,7 @@ test_expect_success 'file2 added differently in two branches' '
190 git add file2 &&
191 git commit -m version2 &&
192 ! git merge fourth &&
193 - sha1=$(sed -e "s/ .*//" .git/rr-cache/MERGE_RR) &&
193 + sha1=$(sed -e "s/ .*//" .git/MERGE_RR) &&
194 rr=.git/rr-cache/$sha1 &&
195 echo Cello > file2 &&
196 git add file2 &&