diff --git a/CHANGELOG.md b/CHANGELOG.md index 52ea215aac..891c0989ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + ## Unreleased ### Added - enrich commit mentions in markdown viewer by internal links ([#1210](https://github.com/scm-manager/scm-manager/pull/1210)) +## [2.1.1] - 2020-06-23 +### Fixed +- Wait until recommended java installation is available for deb packages ([#1209](https://github.com/scm-manager/scm-manager/pull/1209)) +- Do not force java home of recommended java dependency for rpm and deb packages ([#1195](https://github.com/scm-manager/scm-manager/issues/1195) and [#1208](https://github.com/scm-manager/scm-manager/pull/1208)) +- Migration of non-bare repositories ([#1213](https://github.com/scm-manager/scm-manager/pull/1213)) + ## [2.1.0] - 2020-06-18 ### Added - Option to configure jvm parameter of docker container with env JAVA_OPTS or with arguments ([#1175](https://github.com/scm-manager/scm-manager/pull/1175)) @@ -29,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed active state of sub navigation items, which are using activeWhenMatch ([#1199](https://github.com/scm-manager/scm-manager/pull/1199)) - Handles repositories in custom directories correctly in migration from 1.x ([#1201](https://github.com/scm-manager/scm-manager/pull/1201)) - Usage of short git commit ids in changeset urls ([#1200](https://github.com/scm-manager/scm-manager/pull/1200)) +- Fixes linebreaks in multiline tooltip ([#1207](https://github.com/scm-manager/scm-manager/pull/1207)) ## [2.0.0] - 2020-06-04 ### Added diff --git a/docs/en/development/intellij-idea-configuration.md b/docs/en/development/intellij-idea-configuration.md index f1bdbe155f..f740281518 100644 --- a/docs/en/development/intellij-idea-configuration.md +++ b/docs/en/development/intellij-idea-configuration.md @@ -33,10 +33,6 @@ title: Intellij IDEA Configuration * Languages & Frameworks / Node.js and NPM * Package Manager: yarn -* Languages & Frameworks / Javascript - * JavaScript language version: Flow - * Flow package or executable: .../node_modules/flow-bin - * Languages & Frameworks / Javascript / Code Quality Tools / ESLint * Enable * ESLint package: .../node_modules/eslint diff --git a/lerna.json b/lerna.json index 66f41fc5a6..ffa2cdc5ad 100644 --- a/lerna.json +++ b/lerna.json @@ -5,5 +5,5 @@ ], "npmClient": "yarn", "useWorkspaces": true, - "version": "2.1.0" + "version": "2.1.1" } diff --git a/scm-packaging/deb/src/main/deb/control/postinst b/scm-packaging/deb/src/main/deb/control/postinst index 474eae5df9..e662ab460b 100644 --- a/scm-packaging/deb/src/main/deb/control/postinst +++ b/scm-packaging/deb/src/main/deb/control/postinst @@ -36,4 +36,8 @@ systemctl daemon-reload # enable and start the service sudo systemctl enable scm-server -sudo systemctl start scm-server + +# we start scm-manager after 5 seconds +# this is required, because if we install scm-manager with recommend java +# java is not fully setup if we ran our postint script +echo "sleep 5; sudo systemctl start scm-server" | at now diff --git a/scm-packaging/deb/src/main/fs/etc/default/scm-server b/scm-packaging/deb/src/main/fs/etc/default/scm-server index e942cfec7c..959947d33f 100644 --- a/scm-packaging/deb/src/main/fs/etc/default/scm-server +++ b/scm-packaging/deb/src/main/fs/etc/default/scm-server @@ -36,7 +36,7 @@ USER=scm export SCM_HOME=/var/lib/scm # force jvm path -JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" +# JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" # path to pid PIDFILE=/var/run/scm/scm.pid diff --git a/scm-packaging/rpm/src/main/fs/etc/default/scm-server b/scm-packaging/rpm/src/main/fs/etc/default/scm-server index 6ea672b267..4a5d2fe86c 100644 --- a/scm-packaging/rpm/src/main/fs/etc/default/scm-server +++ b/scm-packaging/rpm/src/main/fs/etc/default/scm-server @@ -36,7 +36,7 @@ USER=scm export SCM_HOME=/var/lib/scm # force jvm path -JAVA_HOME="/usr/lib/jvm/jre-11" +# JAVA_HOME="/usr/lib/jvm/jre-11" # path to pid PIDFILE=/var/run/scm/scm.pid diff --git a/scm-packaging/windows/pom.xml b/scm-packaging/windows/pom.xml index cdc1bcdf4d..3041009d2e 100644 --- a/scm-packaging/windows/pom.xml +++ b/scm-packaging/windows/pom.xml @@ -71,11 +71,11 @@ wget - https://github.com/winsw/winsw/releases/download/v2.8.0/WinSW.NETCore31.x64.exe + https://github.com/winsw/winsw/releases/download/v2.9.0/WinSW.NETCore31.x64.exe false scm-server.exe ${project.build.directory}/windows - ebb2bb0ab0746ff5a20f65c76855a71c53aa806eb55ebd08fd18ded51ea23b58 + 59d29a41652cfc9a564c9c05d77976391833a6fb686bce941ad89f8f8dff120b diff --git a/scm-plugins/scm-git-plugin/package.json b/scm-plugins/scm-git-plugin/package.json index 540c3fb207..f406d25659 100644 --- a/scm-plugins/scm-git-plugin/package.json +++ b/scm-plugins/scm-git-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@scm-manager/scm-git-plugin", "private": true, - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "main": "./src/main/js/index.ts", "scripts": { @@ -20,6 +20,6 @@ }, "prettier": "@scm-manager/prettier-config", "dependencies": { - "@scm-manager/ui-plugins": "^2.1.0" + "@scm-manager/ui-plugins": "^2.1.1" } } diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/update/GitV2UpdateStep.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/update/GitV2UpdateStep.java index 0bbb479ed6..d805fae53c 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/update/GitV2UpdateStep.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/update/GitV2UpdateStep.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - + package sonia.scm.repository.update; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; @@ -38,6 +38,7 @@ import sonia.scm.version.Version; import javax.inject.Inject; import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import static sonia.scm.version.Version.parse; @@ -60,7 +61,8 @@ public class GitV2UpdateStep implements UpdateStep { (repositoryId, path) -> { Repository repository = repositoryMetadataAccess.read(path); if (isGitDirectory(repository)) { - try (org.eclipse.jgit.lib.Repository gitRepository = build(path.resolve("data").toFile())) { + final Path effectiveGitPath = determineEffectiveGitFolder(path); + try (org.eclipse.jgit.lib.Repository gitRepository = build(effectiveGitPath.toFile())) { new GitConfigHelper().createScmmConfig(repository, gitRepository); } catch (IOException e) { throw new UpdateException("could not update repository with id " + repositoryId + " in path " + path, e); @@ -70,6 +72,18 @@ public class GitV2UpdateStep implements UpdateStep { ); } + public Path determineEffectiveGitFolder(Path path) { + Path bareGitFolder = path.resolve("data"); + Path nonBareGitFolder = bareGitFolder.resolve(".git"); + final Path effectiveGitPath; + if (Files.exists(nonBareGitFolder)) { + effectiveGitPath = nonBareGitFolder; + } else { + effectiveGitPath = bareGitFolder; + } + return effectiveGitPath; + } + private org.eclipse.jgit.lib.Repository build(File directory) throws IOException { return new FileRepositoryBuilder() .setGitDir(directory) diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/update/GitV2UpdateStepTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/update/GitV2UpdateStepTest.java new file mode 100644 index 0000000000..c207a4bf54 --- /dev/null +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/update/GitV2UpdateStepTest.java @@ -0,0 +1,92 @@ +/* + * MIT License + * + * Copyright (c) 2020-present Cloudogu GmbH and Contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package sonia.scm.repository.update; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryLocationResolver; +import sonia.scm.update.UpdateStepRepositoryMetadataAccess; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.function.BiConsumer; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class GitV2UpdateStepTest { + + @Mock + RepositoryLocationResolver locationResolver; + @Mock + RepositoryLocationResolver.RepositoryLocationResolverInstance locationResolverInstance; + @Mock + UpdateStepRepositoryMetadataAccess repositoryMetadataAccess; + + @InjectMocks + GitV2UpdateStep updateStep; + + @BeforeEach + void createDataDirectory(@TempDir Path temp) throws IOException { + Files.createDirectories(temp.resolve("data")); + } + + @BeforeEach + void initRepositoryFolder(@TempDir Path temp) { + when(locationResolver.forClass(Path.class)).thenReturn(locationResolverInstance); + when(repositoryMetadataAccess.read(temp)).thenReturn(new Repository("123", "git", "space", "X")); + doAnswer(invocation -> { + invocation.getArgument(0, BiConsumer.class).accept("123", temp); + return null; + }).when(locationResolverInstance).forAllLocations(any()); + } + + @Test + void shouldWriteConfigFileForBareRepositories(@TempDir Path temp) { + updateStep.doUpdate(); + + assertThat(temp.resolve("data").resolve("config")).exists(); + } + + @Test + void shouldWriteConfigFileForNonBareRepositories(@TempDir Path temp) throws IOException { + Files.createDirectories(temp.resolve("data").resolve(".git")); + + updateStep.doUpdate(); + + assertThat(temp.resolve("data").resolve("config")).doesNotExist(); + assertThat(temp.resolve("data").resolve(".git").resolve("config")).exists(); + } +} diff --git a/scm-plugins/scm-hg-plugin/package.json b/scm-plugins/scm-hg-plugin/package.json index 82aa1b2945..8cd1e03641 100644 --- a/scm-plugins/scm-hg-plugin/package.json +++ b/scm-plugins/scm-hg-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@scm-manager/scm-hg-plugin", "private": true, - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "main": "./src/main/js/index.ts", "scripts": { @@ -19,6 +19,6 @@ }, "prettier": "@scm-manager/prettier-config", "dependencies": { - "@scm-manager/ui-plugins": "^2.1.0" + "@scm-manager/ui-plugins": "^2.1.1" } } diff --git a/scm-plugins/scm-legacy-plugin/package.json b/scm-plugins/scm-legacy-plugin/package.json index 3f0dcc4e85..1b9335e950 100644 --- a/scm-plugins/scm-legacy-plugin/package.json +++ b/scm-plugins/scm-legacy-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@scm-manager/scm-legacy-plugin", "private": true, - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "main": "./src/main/js/index.tsx", "scripts": { @@ -19,6 +19,6 @@ }, "prettier": "@scm-manager/prettier-config", "dependencies": { - "@scm-manager/ui-plugins": "^2.1.0" + "@scm-manager/ui-plugins": "^2.1.1" } } diff --git a/scm-plugins/scm-svn-plugin/package.json b/scm-plugins/scm-svn-plugin/package.json index ea2cacc2d8..43854a0082 100644 --- a/scm-plugins/scm-svn-plugin/package.json +++ b/scm-plugins/scm-svn-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@scm-manager/scm-svn-plugin", "private": true, - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "main": "./src/main/js/index.ts", "scripts": { @@ -19,6 +19,6 @@ }, "prettier": "@scm-manager/prettier-config", "dependencies": { - "@scm-manager/ui-plugins": "^2.1.0" + "@scm-manager/ui-plugins": "^2.1.1" } } diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java index ed502338cc..e1ea9dde09 100644 --- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java +++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - + package sonia.scm.repository; //~--- non-JDK imports -------------------------------------------------------- @@ -76,6 +76,7 @@ public class SvnRepositoryHandler private static final Logger logger = LoggerFactory.getLogger(SvnRepositoryHandler.class); + private SvnRepositoryHook hook; @Inject public SvnRepositoryHandler(ConfigurationStoreFactory storeFactory, @@ -94,7 +95,8 @@ public class SvnRepositoryHandler // register hook if (eventFacade != null) { - FSHooks.registerHook(new SvnRepositoryHook(eventFacade, this)); + hook = new SvnRepositoryHook(eventFacade, this); + FSHooks.registerHook(hook); } else if (logger.isWarnEnabled()) { @@ -212,4 +214,12 @@ public class SvnRepositoryHandler String getRepositoryId(File directory) { return new SvnConfigHelper().getRepositoryId(directory); } + + @Override + public void close() throws IOException { + if (hook != null) { + FSHooks.unregisterHook(hook); + } + super.close(); + } } diff --git a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java index 9282fd2487..bd12979dc2 100644 --- a/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java +++ b/scm-plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - + package sonia.scm.repository; @@ -59,6 +59,8 @@ public class SvnRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase { private HookEventFacade facade = new HookEventFacade(repositoryManagerProvider, hookContextFactory); + private SvnRepositoryHandler handler; + @Override protected void postSetUp() throws IOException, RepositoryPathNotFoundException { initMocks(this); @@ -82,7 +84,7 @@ public class SvnRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase { protected RepositoryHandler createRepositoryHandler(ConfigurationStoreFactory factory, RepositoryLocationResolver locationResolver, File directory) { - SvnRepositoryHandler handler = new SvnRepositoryHandler(factory, null, locationResolver, null); + SvnRepositoryHandler handler = new SvnRepositoryHandler(factory, facade, locationResolver, null); handler.init(contextProvider); @@ -95,16 +97,20 @@ public class SvnRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase { } @Test - public void getDirectory() { + public void getDirectory() throws IOException { when(factory.withType(any())).thenCallRealMethod(); SvnRepositoryHandler repositoryHandler = new SvnRepositoryHandler(factory, facade, locationResolver, null); - SvnConfig svnConfig = new SvnConfig(); - repositoryHandler.setConfig(svnConfig); + try { + SvnConfig svnConfig = new SvnConfig(); + repositoryHandler.setConfig(svnConfig); - initRepository(); - File path = repositoryHandler.getDirectory(repository.getId()); - assertEquals(repoPath.toString()+File.separator+ RepositoryDirectoryHandler.REPOSITORIES_NATIVE_DIRECTORY, path.getAbsolutePath()); + initRepository(); + File path = repositoryHandler.getDirectory(repository.getId()); + assertEquals(repoPath.toString() + File.separator + RepositoryDirectoryHandler.REPOSITORIES_NATIVE_DIRECTORY, path.getAbsolutePath()); + } finally { + repositoryHandler.close(); + } } } diff --git a/scm-ui/ui-components/package.json b/scm-ui/ui-components/package.json index 87871564f7..7bbd35e789 100644 --- a/scm-ui/ui-components/package.json +++ b/scm-ui/ui-components/package.json @@ -1,6 +1,6 @@ { "name": "@scm-manager/ui-components", - "version": "2.1.0", + "version": "2.1.1", "description": "UI Components for SCM-Manager and its plugins", "main": "src/index.ts", "files": [ diff --git a/scm-ui/ui-components/src/Tooltip.stories.tsx b/scm-ui/ui-components/src/Tooltip.stories.tsx index f6f4cbad5b..13cfb93228 100644 --- a/scm-ui/ui-components/src/Tooltip.stories.tsx +++ b/scm-ui/ui-components/src/Tooltip.stories.tsx @@ -32,24 +32,38 @@ import Button from "./buttons/Button"; const Wrapper = styled.div` margin: 2rem; - max-width: 400px; + width: 100%; `; const Spacing = styled.div` padding: 2em 6em; + width: 50%; + margin: 0 auto; `; const positions = ["right", "top", "left", "bottom"]; const message = "Heart of Gold"; +const mutltiline = `Characters: + +- Arthur Dent +- Ford Prefect +- Zaphod Beeblebrox +- Marvin the Paranoid Android +- Trillian +- Slartibartfast`; + +const shortMultiline = `* a +* b +* c`; + const RoutingDecorator = (story: () => ReactNode) => {story()}; storiesOf("Tooltip", module) .addDecorator(RoutingDecorator) - .addDecorator(storyFn => {storyFn()}) .add("Default", () => ( -
+ {positions.map(position => ( @@ -57,5 +71,27 @@ storiesOf("Tooltip", module) ))} -
+ + )) + .add("Multiline", () => ( + + {positions.map(position => ( + + + + right - - -
+ + +
+
+ - - + top - -
-
+ + +
+
+ - - + left - -
-
+ + +
+
+ - - + bottom - -
+ + + + + +`; + +exports[`Storyshots Tooltip Multiline 1`] = ` +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+`; + +exports[`Storyshots Tooltip Short Multiline 1`] = ` +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + +
`; diff --git a/scm-ui/ui-plugins/package.json b/scm-ui/ui-plugins/package.json index 296e4570ea..6ca49827fd 100644 --- a/scm-ui/ui-plugins/package.json +++ b/scm-ui/ui-plugins/package.json @@ -1,12 +1,12 @@ { "name": "@scm-manager/ui-plugins", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "bin": { "ui-plugins": "./bin/ui-plugins.js" }, "dependencies": { - "@scm-manager/ui-components": "^2.1.0", + "@scm-manager/ui-components": "^2.1.1", "@scm-manager/ui-extensions": "^2.1.0", "classnames": "^2.2.6", "query-string": "^5.0.1", diff --git a/scm-ui/ui-webapp/package.json b/scm-ui/ui-webapp/package.json index 1655fa19aa..c9aa79a570 100644 --- a/scm-ui/ui-webapp/package.json +++ b/scm-ui/ui-webapp/package.json @@ -1,9 +1,9 @@ { "name": "@scm-manager/ui-webapp", - "version": "2.1.0", + "version": "2.1.1", "private": true, "dependencies": { - "@scm-manager/ui-components": "^2.1.0", + "@scm-manager/ui-components": "^2.1.1", "@scm-manager/ui-extensions": "^2.1.0", "classnames": "^2.2.5", "history": "^4.10.1",