git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob e315283cccdd6c4da63181b61cfaf1b1f7c3f910 1757 bytes (raw)
name: t/t0100-previous.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
#!/bin/sh

test_description='previous branch syntax @{-n}'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'branch -d @{-1}' '
	test_commit A &&
	git checkout -b junk &&
	git checkout - &&
	test_cmp_cmd refs/heads/main git symbolic-ref HEAD &&
	git branch -d @{-1} &&
	test_must_fail git rev-parse --verify refs/heads/junk
'

test_expect_success 'branch -d @{-12} when there is not enough switches yet' '
	git reflog expire --expire=now &&
	git checkout -b junk2 &&
	git checkout - &&
	test_cmp_cmd refs/heads/main git symbolic-ref HEAD &&
	test_must_fail git branch -d @{-12} &&
	git rev-parse --verify refs/heads/main
'

test_expect_success 'merge @{-1}' '
	git checkout A &&
	test_commit B &&
	git checkout A &&
	test_commit C &&
	test_commit D &&
	git branch -f main B &&
	git branch -f other &&
	git checkout other &&
	git checkout main &&
	git merge @{-1} &&
	git cat-file commit HEAD | grep "Merge branch '\''other'\''"
'

test_expect_success 'merge @{-1}~1' '
	git checkout main &&
	git reset --hard B &&
	git checkout other &&
	git checkout main &&
	git merge @{-1}~1 &&
	git cat-file commit HEAD >actual &&
	grep "Merge branch '\''other'\''" actual
'

test_expect_success 'merge @{-100} before checking out that many branches yet' '
	git reflog expire --expire=now &&
	git checkout -f main &&
	git reset --hard B &&
	git branch -f other C &&
	git checkout other &&
	git checkout main &&
	test_must_fail git merge @{-100}
'

test_expect_success 'log -g @{-1}' '
	git checkout -b last_branch &&
	git checkout -b new_branch &&
	echo "last_branch@{0}" >expect &&
	git log -g --format=%gd @{-1} >actual &&
	test_cmp expect actual
'

test_done


debug log:

solving e315283cccd ...
found e315283cccd in https://public-inbox.org/git/patch-v2-4.8-c36060934a6-20221202T000227Z-avarab@gmail.com/
found a16cc3d2983 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 a16cc3d298357be89e58514db83c1d3f04b3ad4d	t/t0100-previous.sh

applying [1/1] https://public-inbox.org/git/patch-v2-4.8-c36060934a6-20221202T000227Z-avarab@gmail.com/
diff --git a/t/t0100-previous.sh b/t/t0100-previous.sh
index a16cc3d2983..e315283cccd 100755

Checking patch t/t0100-previous.sh...
Applied patch t/t0100-previous.sh cleanly.

index at:
100755 e315283cccdd6c4da63181b61cfaf1b1f7c3f910	t/t0100-previous.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).