git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob a252908d027dc5abddc09f95b91b07b2bb8f861c 2238 bytes (raw)
name: t/t3434-rebase-i18n.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
73
74
75
76
77
78
79
80
81
82
83
84
 
#!/bin/sh
#
# Copyright (c) 2019 Doan Tran Cong Danh
#

test_description='rebase with changing encoding

Initial setup:

1 - 2              main
 \
  3 - 4            first
   \
    5 - 6          second
'

. ./test-lib.sh

compare_msg () {
	iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect &&
	git cat-file commit HEAD >raw &&
	sed "1,/^$/d" raw >actual &&
	test_cmp expect actual
}

test_expect_success setup '
	test_commit one &&
	git branch first &&
	test_commit two &&
	git switch first &&
	test_commit three &&
	git branch second &&
	test_commit four &&
	git switch second &&
	test_commit five &&
	test_commit six
'

test_expect_success 'rebase --rebase-merges update encoding eucJP to UTF-8' '
	git switch -c merge-eucJP-UTF-8 first &&
	git config i18n.commitencoding eucJP &&
	git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
	git config i18n.commitencoding UTF-8 &&
	git rebase --rebase-merges main &&
	compare_msg eucJP.txt eucJP UTF-8
'

test_expect_success 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' '
	git switch -c merge-eucJP-ISO-2022-JP first &&
	git config i18n.commitencoding eucJP &&
	git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second &&
	git config i18n.commitencoding ISO-2022-JP &&
	git rebase --rebase-merges main &&
	compare_msg eucJP.txt eucJP ISO-2022-JP
'

test_rebase_continue_update_encode () {
	old=$1
	new=$2
	msgfile=$3
	test_expect_success "rebase --continue update from $old to $new" '
		(git rebase --abort || : abort current git-rebase failure) &&
		git switch -c conflict-$old-$new one &&
		echo for-conflict >two.t &&
		git add two.t &&
		git config i18n.commitencoding $old &&
		git commit -F "$TEST_DIRECTORY/t3434/$msgfile" &&
		git config i18n.commitencoding $new &&
		test_must_fail git rebase -m main &&
		test -f .git/rebase-merge/message &&
		git stripspace <.git/rebase-merge/message >two.t &&
		git add two.t &&
		git rebase --continue &&
		compare_msg $msgfile $old $new &&
		: git-commit assume invalid utf-8 is latin1 &&
		test_cmp expect two.t
	'
}

test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt
test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt
test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt

test_done

debug log:

solving a252908d02 ...
found a252908d02 in https://public-inbox.org/git/ec7102156e055dfb3659821ebc9fa1b616f74100.1605221039.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/2f62b3f4694096b38deba3359c7705296b4209fd.1605629548.git.gitgitgadget@gmail.com/
found c7c835cde9 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 c7c835cde9b23b26675b5d5b1729e8be6a2b6d26	t/t3434-rebase-i18n.sh

applying [1/1] https://public-inbox.org/git/ec7102156e055dfb3659821ebc9fa1b616f74100.1605221039.git.gitgitgadget@gmail.com/
diff --git a/t/t3434-rebase-i18n.sh b/t/t3434-rebase-i18n.sh
index c7c835cde9..a252908d02 100755

Checking patch t/t3434-rebase-i18n.sh...
Applied patch t/t3434-rebase-i18n.sh cleanly.

skipping https://public-inbox.org/git/2f62b3f4694096b38deba3359c7705296b4209fd.1605629548.git.gitgitgadget@gmail.com/ for a252908d02
index at:
100755 a252908d027dc5abddc09f95b91b07b2bb8f861c	t/t3434-rebase-i18n.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).