<commit_before>#!/bin/bash

setUp () {
	createTestRepository

	git clone -q "$REPO" "$REPO-clone"
	cd "$REPO-clone"
}

tearDown () {
	rm -rf "$REPO-clone"

	deleteTestRepository
}

testSyncPush () {
	local output

	git issue init -q
	git issue new -q --no-edit --title='test 1'

	output="$(git issue sync 2>&1)"
	local status=$?

	assert_equal "$output" 'Issues synced.' 'testSyncPush'
	assert_numeq $status 0 'testSyncPush'

	cd "$REPO"
	output="$(git issue list --color=none)"

	assert_equal "$output" '1: test 1' 'testSyncPush'
	assert_numeq $status 0 'testSyncPush'
}

testSyncPull () {
	local output

	cd "$REPO"
	git issue init -q
	git issue new -q --no-edit --title='test 1'

	cd "$REPO-clone"
	output="$(git issue sync 2>&1)"
	local status=$?

	assert_equal "$output" 'Issues synced.' 'testSyncPull'
	assert_numeq $status 0 'testSyncPull'

	output="$(git issue list --color=none)"

	assert_equal "$output" '1: test 1' 'testSyncPull'
	assert_numeq $status 0 'testSyncPull'
}

testSyncNothing () {
	local output

	output="$(git issue sync 2>&1)"
	local status=$?

	assert_equal "$output" 'Nothing to sync.' 'testSyncNothing'
	assert_numeq $status 0 'testSyncNothing'
}

testSyncConflict () {
	local output

	cd "$REPO"
	git issue init -q
	git issue new -q --no-edit --title='test 1' 'Issue in the first repo'

	cd "$REPO-clone"
	git issue init -q
	git issue new -q --no-edit --title='test 1' 'Issue in the second repo'

	output="$(git issue sync 2>&1)"
	local status=$?

	assert_numeq $status 1 'testSyncConflict'
}

. $CWD/tests/common.sh<commit_msg>Test sync with different remote<commit_after>#!/bin/bash

setUp () {
	createTestRepository

	git clone -q "$REPO" "$REPO-clone"
	cd "$REPO-clone"
}

tearDown () {
	rm -rf "$REPO-clone"

	deleteTestRepository
}

testSyncPush () {
	local output

	git issue init -q
	git issue new -q --no-edit --title='test 1'

	output="$(git issue sync 2>&1)"
	local status=$?

	assert_equal "$output" 'Issues synced.' 'testSyncPush'
	assert_numeq $status 0 'testSyncPush'

	cd "$REPO"
	output="$(git issue list --color=none)"

	assert_equal "$output" '1: test 1' 'testSyncPush'
	assert_numeq $status 0 'testSyncPush'
}

testSyncPull () {
	local output

	cd "$REPO"
	git issue init -q
	git issue new -q --no-edit --title='test 1'

	cd "$REPO-clone"
	output="$(git issue sync 2>&1)"
	local status=$?

	assert_equal "$output" 'Issues synced.' 'testSyncPull'
	assert_numeq $status 0 'testSyncPull'

	output="$(git issue list --color=none)"

	assert_equal "$output" '1: test 1' 'testSyncPull'
	assert_numeq $status 0 'testSyncPull'
}

testSyncNothing () {
	local output

	output="$(git issue sync 2>&1)"
	local status=$?

	assert_equal "$output" 'Nothing to sync.' 'testSyncNothing'
	assert_numeq $status 0 'testSyncNothing'
}

testSyncConflict () {
	local output

	cd "$REPO"
	git issue init -q
	git issue new -q --no-edit --title='test 1' 'Issue in the first repo'

	cd "$REPO-clone"
	git issue init -q
	git issue new -q --no-edit --title='test 1' 'Issue in the second repo'

	output="$(git issue sync 2>&1)"
	local status=$?

	assert_numeq $status 1 'testSyncConflict'
}

testSyncRemote () {
	git remote rename origin upstream
	git config issue.remote upstream

	testSyncPull
}

. $CWD/tests/common.sh
{'fraction_non_alphanumeric': 0.1460327261500463, 'fraction_numerical': 0.013584439641864773, 'mean_word_length': 4.023255813953488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2533175', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1163, 'n_words': 366}