Commit Graph

428 Commits

Author SHA1 Message Date
René Pfeuffer
d0df8977ef Bugfix for long filenames in tar (#1552)
Fixes errors with long file names in tar archives. This may arise with hg repositories with deep directories.
2021-02-18 16:30:35 +01:00
René Pfeuffer
b8bd140934 Debug test failure 2021-02-16 10:18:09 +01:00
René Pfeuffer
7a7ac9a3f2 Bugfix: Conflict in pack parser (#1518)
The change tackles a sporadic error in integration tests, where during or after a change in a git repository a pack file could not be read correctly due to a "short compressed stream". The exception could look like this:

ERROR org.eclipse.jgit.internal.storage.file.ObjectDirectory - Exception caught while accessing pack file scm-home/repositories/8gSNr4ogc5X/data/objects/pack/pack-51a3500283ece83ab8efa7edfb9370e6f97311b5.pack, the pack file might be corrupt. Caught 1 consecutive errors while trying to read this pack.
java.io.EOFException: Short compressed stream at 197
	at org.eclipse.jgit.internal.storage.file.PackFile.decompress(PackFile.java:381)
	at org.eclipse.jgit.internal.storage.file.PackFile.load(PackFile.java:815)
	at org.eclipse.jgit.internal.storage.file.PackFile.get(PackFile.java:284)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedObject(ObjectDirectory.java:455)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:413)
	at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:404)
	at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:132)
	at org.eclipse.jgit.treewalk.CanonicalTreeParser.reset(CanonicalTreeParser.java:191)
	at org.eclipse.jgit.treewalk.TreeWalk.parserFor(TreeWalk.java:1344)
	at org.eclipse.jgit.treewalk.TreeWalk.addTree(TreeWalk.java:732)
	at sonia.scm.repository.spi.Differ.create(Differ.java:102)
	at sonia.scm.repository.spi.Differ.diff(Differ.java:63)
We found out that this seems to be linked to the asynchronous execution of post commit hooks, that originally are triggered in the midst of the processing of a receive pack.

With this change the fireing of these triggers is delayed until the end of the internal git processing. The central class for this is the GitHookEventFacade, where hook events are either

- put into a ThreadLocal, so that they can be triggered later, or
- triggered in a thread that is joined with an internal JGit thread for internal pushes (eg. for modify command or merge command)
2021-02-03 11:08:13 +01:00
René Pfeuffer
bd3671b428 Use repository specific work dirs (#1510)
With this change, work dirs are created in the
directory of the repository and no longer in the
global scm work dir directory. This is relevant due
to two facts:

1. Repositories may contain confidential data and therefore
   reside in special directories (that may be mounted on
   special drives). It may be considered a breach when these
   directories are cloned or otherwise copied to global
   temporary drives.
2. Big repositories may overload global temp spaces. It may be
   easier to create special drives with more space for such
   big repositories.
2021-01-28 12:53:39 +01:00
Eduard Heimbuch
0046c78b40 Git import and export (#1507)
* create git bundle command

* create git unbundle command

* Apply suggestions from code review

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-01-28 12:35:18 +01:00
Eduard Heimbuch
d91c71ace1 Add the repository import and export with metadata for Subversion repositories (#1501)
* Add store exporter to collect the repository metadata
* Add EnvironmentInformationXmlGenerator
* Collect export data and put into compressed tar archive output stream
* Create full repository export endpoint.
* Add full repository export to ui
* Ignore irrelevant files from config store directory
* write metadata stores to file since a baos could teardown the server memory
* Migrate store name for git lfs files (#1504)

Changes the directory name for the git LFS blob store by
removing the repository id from the store name.

This is necessary for im- and exports of lfs blob stores,
because the original name had the repository id as a part
of it and therefore the old store would not be found when
the repository is imported with another id.

Existing blob files will be moved to the new store location
by an update step.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>

* Introduce util for migrations (#1505)

With this util it is more simple to rename
or delete stores.

* Rename files in export

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-01-28 11:40:35 +01:00
Eduard Heimbuch
4fb42de0ca Fix unit test 2021-01-26 14:32:03 +01:00
Eduard Heimbuch
d737c3aa9f Fix unit test 2021-01-26 12:55:01 +01:00
René Pfeuffer
e62a598aa2 Fix initialization bug if master set as default branch
Fixes issue https://github.com/scm-manager/scm-manager/issues/1467
where initialization fails when master is set as default branch.
2020-12-07 15:14:01 +01:00
Konstantin Schaper
2fa4972883 fix git tag command unit test 2020-12-02 09:39:17 +01:00
Konstantin Schaper
9ec8b4efac fix review findings 2020-12-01 15:16:55 +01:00
René Pfeuffer
8cd2c3f493 Use injector 2020-11-30 17:54:56 +01:00
Konstantin Schaper
8986e3d378 Merge branch 'develop' into feature/manage-tags
# Conflicts:
#	scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/HgRepositoryServiceProvider.java
2020-11-30 14:18:05 +01:00
René Pfeuffer
8ca64c3440 Fix signature check for git tags 2020-11-27 13:35:54 +01:00
Konstantin Schaper
6652a039dd fix unit tests 2020-11-27 12:40:02 +01:00
Konstantin Schaper
280f3e005e work on getting signatures running 2020-11-26 13:08:10 +01:00
Konstantin Schaper
b64d34afa4 add hook events to tag command and update unit tests 2020-11-26 11:15:26 +01:00
René Pfeuffer
181806f84b Read last commit date for git branches 2020-11-26 08:31:14 +01:00
Konstantin Schaper
0c5ab90852 work in progress 2020-11-24 22:07:24 +01:00
Sebastian Sdorra
9fe065f796 Merge pull request #1399 from scm-manager/feature/default_branch
Make default branch for git configurable
2020-11-03 08:23:03 +01:00
René Pfeuffer
5eea6e430e Remove code redundancies 2020-10-30 14:24:31 +01:00
René Pfeuffer
c3baf274d1 Set default branch for repository on init 2020-10-30 14:24:31 +01:00
René Pfeuffer
854940a514 Fix unit test 2020-10-30 14:24:31 +01:00
René Pfeuffer
e9a173616b Use branch from request if specified 2020-10-30 14:24:31 +01:00
René Pfeuffer
39e521a8d4 Set default branch after initial commit 2020-10-30 14:12:56 +01:00
Sebastian Sdorra
ecab3ce13b Fix internal server error for git sub modules without tree object 2020-10-28 17:00:12 +01:00
René Pfeuffer
c5f8d975a3 Remove unnecessary null check
The function RevWalk#parseAny indeed never returns null. This check only
was there to satisfy the (therefore wrong) unit test.
2020-10-12 19:02:28 +02:00
René Pfeuffer
e8506ff14d Fix recursive iteration
Due to the api of TreeWalk we have no real change to iterate this
recursively, so we get back to good old loops.
2020-10-08 09:24:56 +02:00
René Pfeuffer
cd9da7e658 Determine correct revision for tags in hooks
The former code only resolved the object id of the tags, when those were
annotated tags (for "simple" tags the code worked fine). Now we even can
handle nested tags (tags that reference other tags).
2020-09-24 08:28:52 +02:00
Eduard Heimbuch
1cad9c3fbc Merge branch 'develop' into feature/rebase 2020-09-21 14:01:34 +02:00
Konstantin Schaper
3e96d89480 implement requested review changes 2020-09-18 08:47:04 +02:00
Sebastian Sdorra
ec19291393 Fire missing BranchCreatedEvent for mercurial
The event is now fired in the builder instead of command implementation
2020-09-17 11:03:13 +02:00
Konstantin Schaper
2d024fe210 update head of scm-git-spi-test.zip back to master 2020-09-17 09:15:53 +02:00
Konstantin Schaper
b30a97948e implement git rebase 2020-09-15 15:48:22 +02:00
René Pfeuffer
96d16fe4cc "Unpeel" annotated tags to get correct changeset
If we just parse the object id of the reference for annotated tags, we
get the annotated tag object and not the reference the tag refers to.
2020-08-27 11:15:13 +02:00
René Pfeuffer
565ec3ff3c Cleanup 2020-08-27 10:48:54 +02:00
Konstantin Schaper
15fac8ba2c remove ref usage and directly use objectId 2020-08-26 15:06:00 +02:00
Konstantin Schaper
ecfc70eb77 wip refactoring 2020-08-26 10:01:51 +02:00
Konstantin Schaper
36231d077a cleanup and update tests 2020-08-25 18:08:31 +02:00
Konstantin Schaper
6d409c65c0 initial implementation 2020-08-25 14:45:48 +02:00
Konstantin Schaper
5a5289f381 fix merge issues 2020-08-11 15:04:52 +02:00
Konstantin Schaper
8576b66559 Merge branch 'develop' into feature/create_gpg_signatures
# Conflicts:
#	CHANGELOG.md
#	scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitHookContextProvider.java
#	scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java
#	scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitReceiveHook.java
2020-08-11 13:33:21 +02:00
Konstantin Schaper
0601770262 resolve review findings 2020-08-11 13:28:16 +02:00
Sebastian Sdorra
e7535903f7 Fix unit test on platforms which are not using UTF-8 as default 2020-08-10 09:22:29 +02:00
René Pfeuffer
a3a26c057e Cleanup 2020-08-07 10:53:08 +02:00
René Pfeuffer
2433c50d64 Add test for "real" merge commits 2020-08-07 08:01:13 +02:00
René Pfeuffer
6f20781812 Add first integration tests for merge detection 2020-08-06 17:12:14 +02:00
Konstantin Schaper
7072761ba1 implementation and unit tests 2020-08-05 13:02:02 +02:00
Eduard Heimbuch
b22ead23de show signature key on changeset 2020-07-29 15:43:14 +02:00
Eduard Heimbuch
ebb6a1fdb8 Merge branch 'develop' into feature/verify_gpg_signatures 2020-07-28 12:36:15 +02:00