summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-01-25 22:19:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-25 22:19:18 (GMT)
commit440acfbe0cec5c2316ef7a706c975143c4902b20 (patch)
tree34a167f09449a657477686fbefcec31b32cd51b7 /t
parent080627942802e767b068a491f3d349227f4e2cdc (diff)
parent6436a20284f33d42103cac93bd82e65bebb31526 (diff)
downloadgit-440acfbe0cec5c2316ef7a706c975143c4902b20.zip
git-440acfbe0cec5c2316ef7a706c975143c4902b20.tar.gz
git-440acfbe0cec5c2316ef7a706c975143c4902b20.tar.bz2
Merge branch 'dl/reflog-with-single-entry'
After expiring a reflog and making a single commit, the reflog for the branch would record a single entry that knows both @{0} and @{1}, but we failed to answer "what commit were we on?", i.e. @{1} * dl/reflog-with-single-entry: refs: allow @{n} to work with n-sized reflog refs: factor out set_read_ref_cutoffs()
Diffstat (limited to 't')
-rwxr-xr-xt/t1503-rev-parse-verify.sh4
-rwxr-xr-xt/t1508-at-combinations.sh13
2 files changed, 15 insertions, 2 deletions
diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
index dc9fe3c..a7e9b48 100755
--- a/t/t1503-rev-parse-verify.sh
+++ b/t/t1503-rev-parse-verify.sh
@@ -86,8 +86,8 @@ test_expect_success 'fails silently when using -q' '
test_expect_success 'fails silently when using -q with deleted reflogs' '
ref=$(git rev-parse HEAD) &&
git update-ref --create-reflog -m "message for refs/test" refs/test "$ref" &&
- git reflog delete --updateref --rewrite refs/test@{0} &&
- test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 &&
+ git reflog delete --updateref --rewrite refs/test@{1} &&
+ test_must_fail git rev-parse -q --verify refs/test@{1} >error 2>&1 &&
test_must_be_empty error
'
diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 4a9964e..e4521b7 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -99,4 +99,17 @@ test_expect_success 'create path with @' '
check "@:normal" blob content
check "@:fun@ny" blob content
+test_expect_success '@{1} works with only one reflog entry' '
+ git checkout -B newbranch master &&
+ git reflog expire --expire=now refs/heads/newbranch &&
+ git commit --allow-empty -m "first after expiration" &&
+ test_cmp_rev newbranch~ newbranch@{1}
+'
+
+test_expect_success '@{0} works with empty reflog' '
+ git checkout -B newbranch master &&
+ git reflog expire --expire=now refs/heads/newbranch &&
+ test_cmp_rev newbranch newbranch@{0}
+'
+
test_done