diff --git a/src/FileSystem-Git.package/GitUnitOfWork.class/instance/updateRef.to.message.isSymbolic.targetIsARef..st b/src/FileSystem-Git.package/GitUnitOfWork.class/instance/updateRef.to.message.isSymbolic.targetIsARef..st index 7d3b8a2fc..a9193425c 100644 --- a/src/FileSystem-Git.package/GitUnitOfWork.class/instance/updateRef.to.message.isSymbolic.targetIsARef..st +++ b/src/FileSystem-Git.package/GitUnitOfWork.class/instance/updateRef.to.message.isSymbolic.targetIsARef..st @@ -3,30 +3,24 @@ updateRef: refPath to: target message: reflogMessageString isSymbolic: isSymboli "Updates the reference denoted by refPath to reference the object with the sha1 name in hexHash and adds an entry in the reflog. Symbolic references are resolved, so the non-symbolic reference is updated. If the file denoted by refPath does not yet exist it will be created." - | oldHash targetRef hexHash refValue updaterAndTimestamp | + | updaterAndTimestamp hexHash refValue updateReflog targetRef | repository validateReferenceOrReferenceName: refPath. updaterAndTimestamp := GitStamp now. hexHash := targetIsARefBoolean ifTrue: [self resolveRef: target] ifFalse: [target asHexHash]. refValue := targetIsARefBoolean ifTrue: [self withRefPrefix: target] ifFalse: [target asHexHash]. - oldHash := (self resolveRef: refPath) ifNil: [0 asHexHash]. "also update the reflogs of all symbolic references dereferenced along the way" + updateReflog := reflogMessageString + ifNil: [[:ref | ]] + ifNotNil: [ | oldHash | + oldHash := (self resolveRef: refPath) ifNil: [0 asHexHash]. + [:ref | (self reflogForReference: ref) + logUpdateFrom: oldHash + to: hexHash + by: updaterAndTimestamp + message: reflogMessageString]]. [targetRef := isSymbolicBoolean - ifTrue: [ - reflogMessageString ifNotNil: [ - (self reflogForReference: refPath) - logUpdateFrom: oldHash - to: hexHash - by: updaterAndTimestamp - message: reflogMessageString]. - refPath] - ifFalse: [ - self followSymbolicRefs: refPath do: [:each | - reflogMessageString ifNotNil: [ - (self reflogForReference: each) - logUpdateFrom: oldHash - to: hexHash - by: updaterAndTimestamp - message: reflogMessageString]]]. + ifTrue: [updateReflog value: refPath. refPath] + ifFalse: [self followSymbolicRefs: refPath do: updateReflog]. self basicUpdateRef: targetRef to: refValue] on: Error do: [:e | (repository baseDir resolve: refPath) isDirectory diff --git a/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json b/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json index 7cc1017c4..e0ad36901 100644 --- a/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitUnitOfWork.class/methodProperties.json @@ -91,7 +91,7 @@ "updateRef:ofRemote:to:message:" : "jr 4/5/2017 12:27", "updateRef:to:" : "mad 6/10/2023 14:57", "updateRef:to:message:" : "mad 6/10/2023 14:58", - "updateRef:to:message:isSymbolic:targetIsARef:" : "mad 6/9/2023 20:54", + "updateRef:to:message:isSymbolic:targetIsARef:" : "mad 11/18/2024 13:06", "updateRef:toRef:" : "mad 6/10/2023 14:59", "updateSymbolicRef:to:message:" : "mad 6/10/2023 15:00", "updateSymbolicRef:to:message:targetIsARef:" : "mad 6/10/2023 14:55",