mirror of
https://github.com/git/git.git
synced 2024-11-01 23:07:55 +01:00
d026a25657
70999e9cec
(branch -m: update all per-worktree HEADs - 2016-03-27) added this function in order to update HEADs of all relevant worktrees, when a branch is renamed. It, as a public ref api, kind of breaks abstraction when it uses internal functions of files backend. With the introduction of refs_create_symref(), we can move back pretty close to the code before70999e9cec
, where create_symref() was used for updating HEAD. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
52 lines
1.3 KiB
Bash
Executable file
52 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='test worktree ref store api'
|
|
|
|
. ./test-lib.sh
|
|
|
|
RWT="test-ref-store worktree:wt"
|
|
RMAIN="test-ref-store worktree:main"
|
|
|
|
test_expect_success 'setup' '
|
|
test_commit first &&
|
|
git worktree add -b wt-master wt &&
|
|
(
|
|
cd wt &&
|
|
test_commit second
|
|
)
|
|
'
|
|
|
|
test_expect_success 'resolve_ref(<shared-ref>)' '
|
|
SHA1=`git rev-parse master` &&
|
|
echo "$SHA1 refs/heads/master 0x0" >expected &&
|
|
$RWT resolve-ref refs/heads/master 0 >actual &&
|
|
test_cmp expected actual &&
|
|
$RMAIN resolve-ref refs/heads/master 0 >actual &&
|
|
test_cmp expected actual
|
|
'
|
|
|
|
test_expect_success 'resolve_ref(<per-worktree-ref>)' '
|
|
SHA1=`git -C wt rev-parse HEAD` &&
|
|
echo "$SHA1 refs/heads/wt-master 0x1" >expected &&
|
|
$RWT resolve-ref HEAD 0 >actual &&
|
|
test_cmp expected actual &&
|
|
|
|
SHA1=`git rev-parse HEAD` &&
|
|
echo "$SHA1 refs/heads/master 0x1" >expected &&
|
|
$RMAIN resolve-ref HEAD 0 >actual &&
|
|
test_cmp expected actual
|
|
'
|
|
|
|
test_expect_success 'create_symref(FOO, refs/heads/master)' '
|
|
$RWT create-symref FOO refs/heads/master nothing &&
|
|
echo refs/heads/master >expected &&
|
|
git -C wt symbolic-ref FOO >actual &&
|
|
test_cmp expected actual &&
|
|
|
|
$RMAIN create-symref FOO refs/heads/wt-master nothing &&
|
|
echo refs/heads/wt-master >expected &&
|
|
git symbolic-ref FOO >actual &&
|
|
test_cmp expected actual
|
|
'
|
|
|
|
test_done
|