cmd/gitannex: Downgrade to protocol version 1

This enables compatibility with versions of git-annex currently
available on GitHub's "ubuntu-latest" image, aka Ubuntu 22.04 Jammy.
Currently, Jammy is shipping git-annex 8.20210223-2ubuntu2.
https://packages.ubuntu.com/jammy/git-annex

Issue #7625
This commit is contained in:
Dan McArdle 2024-04-04 09:16:15 -04:00 committed by Nick Craig-Wood
parent ef42c32cc6
commit a2e38e9883
2 changed files with 23 additions and 23 deletions

View File

@ -168,7 +168,7 @@ func (s *server) getMsg() (*messageParser, error) {
func (s *server) run() error {
// The remote sends the first message.
s.sendMsg("VERSION 2")
s.sendMsg("VERSION 1")
for {
message, err := s.getMsg()

View File

@ -268,7 +268,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -278,7 +278,7 @@ var localBackendTestCases = []testCase{
{
label: "HandlesPrepare",
testProtocolFunc: func(t *testing.T, h *testState) {
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension
h.requireReadLineExact("EXTENSIONS")
@ -304,7 +304,7 @@ var localBackendTestCases = []testCase{
{
label: "HandlesPrepareAndDoesNotTrimWhitespaceFromValue",
testProtocolFunc: func(t *testing.T, h *testState) {
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension
h.requireReadLineExact("EXTENSIONS")
@ -337,7 +337,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("ERROR foo")
require.NoError(t, h.mockStdinW.Close())
@ -349,7 +349,7 @@ var localBackendTestCases = []testCase{
{
label: "ConfigFail",
testProtocolFunc: func(t *testing.T, h *testState) {
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("EXTENSIONS INFO") // Advertise that we support the INFO extension
h.requireReadLineExact("EXTENSIONS")
require.True(t, h.server.extensionInfo)
@ -368,7 +368,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -388,7 +388,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -435,7 +435,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -482,7 +482,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -508,7 +508,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -552,7 +552,7 @@ var localBackendTestCases = []testCase{
require.NoError(t, os.Chdir(t.TempDir()))
t.Cleanup(func() { require.NoError(t, os.Chdir(cwd)) })
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -589,7 +589,7 @@ var localBackendTestCases = []testCase{
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -622,7 +622,7 @@ var localBackendTestCases = []testCase{
fileToTransfer := filepath.Join(t.TempDir(), "file.txt")
require.NoError(t, os.WriteFile(fileToTransfer, []byte("HELLO"), 0600))
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -658,7 +658,7 @@ var localBackendTestCases = []testCase{
fileToTransfer := filepath.Join(t.TempDir(), "file.txt")
require.NoError(t, os.WriteFile(fileToTransfer, []byte("HELLO"), 0600))
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -684,7 +684,7 @@ var localBackendTestCases = []testCase{
fileToTransfer := filepath.Join(t.TempDir(), "file.txt")
require.NoError(t, os.WriteFile(fileToTransfer, []byte("HELLO"), 0600))
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -707,7 +707,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -726,7 +726,7 @@ var localBackendTestCases = []testCase{
fileToTransfer := filepath.Join(t.TempDir(), "file.txt")
require.NoError(t, os.WriteFile(fileToTransfer, []byte("HELLO"), 0600))
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -759,7 +759,7 @@ var localBackendTestCases = []testCase{
require.NoError(t, os.WriteFile(remoteFilePath, []byte("HELLO"), 0600))
require.FileExists(t, remoteFilePath)
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -787,7 +787,7 @@ var localBackendTestCases = []testCase{
fileToTransfer := filepath.Join(t.TempDir(), "file.txt")
require.NoError(t, os.WriteFile(fileToTransfer, []byte("HELLO"), 0600))
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -822,7 +822,7 @@ var localBackendTestCases = []testCase{
fileToTransfer := filepath.Join(t.TempDir(), "file.txt")
require.NoError(t, os.WriteFile(fileToTransfer, []byte("HELLO"), 0600))
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -845,7 +845,7 @@ var localBackendTestCases = []testCase{
testProtocolFunc: func(t *testing.T, h *testState) {
h.preconfigureServer()
h.requireReadLineExact("VERSION 2")
h.requireReadLineExact("VERSION 1")
h.requireWriteLine("INITREMOTE")
h.requireReadLineExact("INITREMOTE-SUCCESS")
@ -963,7 +963,7 @@ func TestGitAnnexHandleInitRemoteBackendDoesNotSupportEmptyDirectories(t *testin
}()
defer wg.Wait()
handle.requireReadLineExact("VERSION 2")
handle.requireReadLineExact("VERSION 1")
handle.requireWriteLine("INITREMOTE")
handle.requireReadLineExact("INITREMOTE-FAILURE this rclone remote does not support empty directories")
}