Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2020-05-20 20:36:08 +0300
committerJunio C Hamano <gitster@pobox.com>2020-05-20 20:39:01 +0300
commitcdb73ca56f21835b93345442a96c97f6a0589ef7 (patch)
treeff5bb46f3348f16a57ae4c949105d6298b9ec6a8 /t/t1400-update-ref.sh
parentd1eb22da09e0ffebbd6c16ef1d0e952ec7b88b8d (diff)
t: use update-ref and show-ref to reading/writing refs
Reading and writing .git/refs/* assumes that refs are stored in the 'files' ref backend. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1400-update-ref.sh')
-rwxr-xr-xt/t1400-update-ref.sh32
1 files changed, 16 insertions, 16 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index e1197ac818..27171f8261 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -37,15 +37,15 @@ test_expect_success setup '
test_expect_success "create $m" '
git update-ref $m $A &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
test_expect_success "create $m with oldvalue verification" '
git update-ref $m $B $A &&
- test $B = $(cat .git/$m)
+ test $B = $(git show-ref -s --verify $m)
'
test_expect_success "fail to delete $m with stale ref" '
test_must_fail git update-ref -d $m $A &&
- test $B = "$(cat .git/$m)"
+ test $B = "$(git show-ref -s --verify $m)"
'
test_expect_success "delete $m" '
test_when_finished "rm -f .git/$m" &&
@@ -56,7 +56,7 @@ test_expect_success "delete $m" '
test_expect_success "delete $m without oldvalue verification" '
test_when_finished "rm -f .git/$m" &&
git update-ref $m $A &&
- test $A = $(cat .git/$m) &&
+ test $A = $(git show-ref -s --verify $m) &&
git update-ref -d $m &&
test_path_is_missing .git/$m
'
@@ -69,15 +69,15 @@ test_expect_success "fail to create $n" '
test_expect_success "create $m (by HEAD)" '
git update-ref HEAD $A &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
test_expect_success "create $m (by HEAD) with oldvalue verification" '
git update-ref HEAD $B $A &&
- test $B = $(cat .git/$m)
+ test $B = $(git show-ref -s --verify $m)
'
test_expect_success "fail to delete $m (by HEAD) with stale ref" '
test_must_fail git update-ref -d HEAD $A &&
- test $B = $(cat .git/$m)
+ test $B = $(git show-ref -s --verify $m)
'
test_expect_success "delete $m (by HEAD)" '
test_when_finished "rm -f .git/$m" &&
@@ -178,14 +178,14 @@ test_expect_success '--no-create-reflog overrides core.logAllRefUpdates=always'
test_expect_success "create $m (by HEAD)" '
git update-ref HEAD $A &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
test_expect_success 'pack refs' '
git pack-refs --all
'
test_expect_success "move $m (by HEAD)" '
git update-ref HEAD $B $A &&
- test $B = $(cat .git/$m)
+ test $B = $(git show-ref -s --verify $m)
'
test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" '
test_when_finished "rm -f .git/$m" &&
@@ -255,7 +255,7 @@ test_expect_success '(not) change HEAD with wrong SHA1' '
'
test_expect_success "(not) changed .git/$m" '
test_when_finished "rm -f .git/$m" &&
- ! test $B = $(cat .git/$m)
+ ! test $B = $(git show-ref -s --verify $m)
'
rm -f .git/logs/refs/heads/master
@@ -263,19 +263,19 @@ test_expect_success "create $m (logged by touch)" '
test_config core.logAllRefUpdates false &&
GIT_COMMITTER_DATE="2005-05-26 23:30" \
git update-ref --create-reflog HEAD $A -m "Initial Creation" &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
test_expect_success "update $m (logged by touch)" '
test_config core.logAllRefUpdates false &&
GIT_COMMITTER_DATE="2005-05-26 23:31" \
git update-ref HEAD $B $A -m "Switch" &&
- test $B = $(cat .git/$m)
+ test $B = $(git show-ref -s --verify $m)
'
test_expect_success "set $m (logged by touch)" '
test_config core.logAllRefUpdates false &&
GIT_COMMITTER_DATE="2005-05-26 23:41" \
git update-ref HEAD $A &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
test_expect_success 'empty directory removal' '
@@ -319,19 +319,19 @@ test_expect_success "create $m (logged by config)" '
test_config core.logAllRefUpdates true &&
GIT_COMMITTER_DATE="2005-05-26 23:32" \
git update-ref HEAD $A -m "Initial Creation" &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
test_expect_success "update $m (logged by config)" '
test_config core.logAllRefUpdates true &&
GIT_COMMITTER_DATE="2005-05-26 23:33" \
git update-ref HEAD'" $B $A "'-m "Switch" &&
- test $B = $(cat .git/$m)
+ test $B = $(git show-ref -s --verify $m)
'
test_expect_success "set $m (logged by config)" '
test_config core.logAllRefUpdates true &&
GIT_COMMITTER_DATE="2005-05-26 23:43" \
git update-ref HEAD $A &&
- test $A = $(cat .git/$m)
+ test $A = $(git show-ref -s --verify $m)
'
cat >expect <<EOF