From e447b42f557cb9105d100ba7f050de7a64a080cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20D=C3=B6rbandt?= Date: Wed, 12 Jun 2024 12:02:41 +0200 Subject: [PATCH] Fix rejection of non-empty directories when adding existing repos --- .../class/cloneFromUserAndRegister.st | 2 +- .../class/requestEmptyFSReferenceForName..st | 7 +++++++ .../class/requestFSReferenceForName..st | 7 +------ .../SqueakWorkingCopy.class/methodProperties.json | 5 +++-- 4 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 src/Squot.package/SqueakWorkingCopy.class/class/requestEmptyFSReferenceForName..st diff --git a/src/Squot.package/SqueakWorkingCopy.class/class/cloneFromUserAndRegister.st b/src/Squot.package/SqueakWorkingCopy.class/class/cloneFromUserAndRegister.st index 91f9dba3c..fdee2d3aa 100644 --- a/src/Squot.package/SqueakWorkingCopy.class/class/cloneFromUserAndRegister.st +++ b/src/Squot.package/SqueakWorkingCopy.class/class/cloneFromUserAndRegister.st @@ -4,7 +4,7 @@ cloneFromUserAndRegister url := UIManager default request: 'URL to clone:'. url isEmptyOrNil ifTrue: [^ nil]. name := (self nameFromURL: url) ifNil: [^ nil]. - reference := (self requestFSReferenceForName: name) ifNil: [^ nil]. + reference := (self requestEmptyFSReferenceForName: name) ifNil: [^ nil]. ^ (self cloneFrom: url to: reference named: name) register; yourself \ No newline at end of file diff --git a/src/Squot.package/SqueakWorkingCopy.class/class/requestEmptyFSReferenceForName..st b/src/Squot.package/SqueakWorkingCopy.class/class/requestEmptyFSReferenceForName..st new file mode 100644 index 000000000..dc3afe715 --- /dev/null +++ b/src/Squot.package/SqueakWorkingCopy.class/class/requestEmptyFSReferenceForName..st @@ -0,0 +1,7 @@ +instance creation +requestEmptyFSReferenceForName: aString + | reference | + reference := (self requestFSReferenceForName: aString) ifNil: [^ nil]. + reference children ifEmpty: [^ reference]. + self inform: 'Please choose an empty directory.'. + ^ self requestEmptyFSReferenceForName: aString \ No newline at end of file diff --git a/src/Squot.package/SqueakWorkingCopy.class/class/requestFSReferenceForName..st b/src/Squot.package/SqueakWorkingCopy.class/class/requestFSReferenceForName..st index 1134da603..4a47f2132 100644 --- a/src/Squot.package/SqueakWorkingCopy.class/class/requestFSReferenceForName..st +++ b/src/Squot.package/SqueakWorkingCopy.class/class/requestFSReferenceForName..st @@ -7,9 +7,4 @@ requestFSReferenceForName: aString defaultDirectoryReference ensureCreateDirectory. chosen := UIManager default chooseDirectory: 'Repository location:' from: defaultDirectory. (defaultDirectoryExisted not and: [chosen ~= defaultDirectory]) ifTrue: [defaultDirectoryReference delete]. - ^ chosen ifNotNil: [ | reference | - reference := chosen asFSReference. - reference children ifNotEmpty: [ - self inform: 'Please choose an empty directory.'. - ^ self requestFSReferenceForName: aString]. - reference] \ No newline at end of file + ^ chosen ifNotNil: #asFSReference \ No newline at end of file diff --git a/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json b/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json index 581cda393..75f64ffbc 100644 --- a/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json +++ b/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { "basicImageHash" : "mad 11/29/2023 15:11", "cloneFrom:to:named:" : "mad 9/19/2023 11:53", - "cloneFromUserAndRegister" : "mad 11/13/2023 12:09", + "cloneFromUserAndRegister" : "mad 6/12/2024 11:59", "defaultDirectoryForName:" : "mad 10/22/2023 00:24", "doPostUpdateMigrations" : "mad 11/21/2023 16:06", "gitSuffix" : "mad 11/13/2023 12:03", @@ -23,7 +23,8 @@ "registeredNames" : "mad 9/19/2023 12:16", "registry" : "mad 9/19/2023 11:59", "registry:" : "mad 9/19/2023 11:59", - "requestFSReferenceForName:" : "mad 5/23/2024 21:15", + "requestEmptyFSReferenceForName:" : "mad 6/12/2024 11:58", + "requestFSReferenceForName:" : "mad 6/12/2024 11:59", "requestUnregisteredName" : "mad 11/13/2023 12:01", "requestUnregisteredNameFrom:" : "mad 12/8/2023 19:56", "requestUnregisteredNameFrom:title:" : "mad 12/8/2023 19:56",