aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.archive/src
Commit message (Collapse)AuthorAgeFilesLines
* Adapt to type parameter added in commons-compress 1.25.0Matthias Sohn2023-11-245-15/+20
| | | | | | | | In 1.25.0 commons-compress added a generic type parameter to ArchiveOutputStream to avoid unchecked/unconfirmed type casts in subclasses. Change-Id: Ib4c208fc1fb65f73ea57c5bf723fde71b0d6d9f7
* [errorprone] Suppress MissingSummary for translation bundlesMatthias Sohn2023-09-251-0/+1
| | | | Change-Id: I4da51c7e089366b016a0cc64f768a151c24bc956
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-166-30/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link <url>} to <a> ==================== @link does not support being given an external URL. Replaces them with HTML `<a>`. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p> instead - replace <tt>code</tt> by {@code code} - <table> tags don't allow summary attribute, specify caption as <caption>caption</caption> to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn <matthias.sohn@sap.com>
* Add the "compression-level" option to all ArchiveCommand formatsYoussef Elghareeb2021-01-286-4/+67
| | | | | | | | | | | | | Different archive formats support a compression level in the range [0-9]. The value 0 is for lowest compressions and 9 for highest. Highest levels produce output files of smaller sizes but require more memory to do the compression. This change allows passing a "compression-level" option to the git archive command and implements using it for different file formats. Change-Id: I5758f691c37ba630dbac24db67bb7da827bbc8e1 Signed-off-by: Youssef Elghareeb <ghareeb@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-049-342/+45
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8David Pursehouse2018-09-301-4/+3
| | | | | Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8David Pursehouse2018-03-111-2/+5
| | | | | Change-Id: I6714fc3666e1bced22abba94ceb700477349586e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Remove deprecated ArchiveCommand#putEntry methodMatthias Sohn2018-03-095-45/+0
| | | | | | | Use #putEntry(Closeable, ObjectId, String, FileMode, ObjectLoader)} instead. Change-Id: I2c58c07da00c6033c583eb2dc6c3a0889661f5f5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix javadoc in org.eclipse.jgit.archiveMatthias Sohn2017-12-178-40/+45
| | | | | Change-Id: Ibef80b15f17e884f3085e324283cefc738236a4d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* TarFormat: Use commit time as timestamp for entriesYasuhiro Takagi2017-04-051-0/+8
| | | | | | | | This was already done for ZipFormat in 1448ec3. Change-Id: Ie131938a3f640c68718dc793d18dd35be5c71e7c Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-201-1/+1
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix timestamp in Zip archivesShawn Pearce2017-02-201-3/+3
| | | | | | | | | | RevCommit.getCommitTime returns time in seconds since the epoch. ZipArchiveEntry.setTime expects time in milliseconds. Add the missing unit conversion to get the correct result. Correct formatting to be consistent with the rest of the code. Change-Id: I990b92f1d996ec8538d4857755694d91b142eb53
* Add missing @Override annotations in org.eclipse.jgit.archiveMatthias Sohn2017-02-186-0/+17
| | | | Change-Id: I51e37ca7643da6abadbd36e9187ccb58fe713833 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Set commit time to ZipArchiveEntryNaoki Takezoe2017-02-185-3/+75
| | | | | | | | | | | | | | | | Archived zip files for a same commit have different MD5 hash because mdate and mdate in the header of zip entries are not specified. In this case, Commons Compress sets an archived time. In the original git implementation, it's set a commit time: https://github.com/git/git/blob/e2b2d6a172b76d44cb7b1ddb12ea5bfac9613a44/archive.c#L378 By this fix, archive command sets the commit time to ZipArchiveEntry when RevCommit is given as an archiving target. Change-Id: I30dd8710e910cdf42d57742f8709e9803930a123 Signed-off-by: Naoki Takezoe <takezoe@gmail.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix string externalization warnings in BaseFormatMatthias Sohn2015-03-122-4/+7
| | | | Change-Id: Ie40aa1f889191e45e4d4a7a144c3176d521f6cfa Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing @since tags for new API methods in archive bundleMatthias Sohn2015-03-126-0/+17
| | | | Change-Id: I891e2cf9ca89ae1948e9713a412d31ec66faac86 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* ArchiveCommand: Allow to pass options to underlying streamDavid Ostrovsky2015-02-206-13/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current ArchiveCommand design doesn't allow to pass in options to underlying stream implementations. To overcome this, client has to implement custom format implementation (it cannot be derived from the existing one, because the classes are marked as final), and set the options using ThreadLocal, before the method ArchiveOutputStream createArchiveOutputStream(OutputStream s) is get called. This change extends the ArchiveCommand.Format by allowing to pass option map during creation of ArchiveOutputStream. ArchiveCommand is extended correspondingly. That way client can easily pass options to the underlying streams: Map<String, Object> level = ImmutableMap.<String, Object> of( "level", new Integer(9)); new ArchiveCommand(repo) .setFormat("zip") .setFormatOptions(level) .setTree(tree) .setPaths(paths) .setPrefix(prefix) .setOutputStream(sidebandOut) .call(); Change-Id: I1d92a1e5249117487da39d19c7593e4b812ad97a Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* Eliminate warnings for non-nls strings that will never be translatedRobin Rosenberg2014-09-042-6/+6
| | | | | | | Some of these eliminations just reduces the number of warnings on lines where messages are constructed that can/will be translated. Change-Id: I6eddb39ccc8f2488741bb58540d9ec5f5665e2c4
* Allow ArchiveCommand.registerFormat to be called twiceJonathan Nieder2014-04-161-1/+0
| | | | | | | | This should make it possible for the gitiles plugin to register its archive formats after gerrit has already registered them. Signed-off-by: Jonathan Nieder <jrn@google.com> Change-Id: Icb80a446e583961a7278b707d572d6fe456c372c
* Make ArchiveFormats final and implement equals()Jonathan Nieder2014-04-115-5/+55
| | | | | | | | | | This should make it easier to modify ArchiveCommand to allow an archive format to be registered twice while still noticing if different callers try to register different implementations for the same format. Change-Id: I32261bc8dc1877a853b49e0da0a6e78921791812 Signed-off-by: Jonathan Nieder <jrn@google.com>
* Tag som non-localizable strings with NON-NLSRobin Rosenberg2014-01-106-18/+15
| | | | Change-Id: I6882c98c2785f38241a81ba5b93892aab79690a5
* archive: Include entries for directoriesJonathan Nieder2013-12-273-6/+103
| | | | | | | | | | | | Entries for directories are optional and mostly wasted space in most archive formats (except as a place to hang ownership and filesystem permissions), but "git archive" includes them. Follow suit. This will make it easier in a later change to include empty directories as placeholders for missing submodules. Change-Id: I1810c686bcc9eb4d73498e4d3e763e18787b088a Signed-off-by: Jonathan Nieder <jrn@google.com>
* Revert "Close unfinished archive entries on error"Jonathan Nieder2013-09-232-10/+4
| | | | | | | | | | This reverts commit 75d9b31f14d6226a535a80c05cffda29e55d2ceb. Now that we do not try to close the ArchiveOutputStream in the error path, there is no need to artificially close partial entries from before the error. Change-Id: I1f1cb08ec4e9b14c79bf4621f3fa959463034b82 Signed-off-by: Jonathan Nieder <jrn@google.com>
* TarFormat: use tabs for indentDave Borowitz2013-07-171-1/+1
| | | | Change-Id: I2f4c285d2b2f4bdb7a5d1a1026c131417066410d
* Close unfinished archive entries on errorJonathan Nieder2013-07-172-4/+10
| | | | | | | | | | Otherwise the underlying error is hidden by an "IOException: This archives contains unclosed entries." when jgit tries to close the archive. Reported-by: Dave Borowitz <dborowitz@google.com> Change-Id: I594dcdf366200b802e13e5a645fe06597feb7bb4 Signed-off-by: Jonathan Nieder <jrn@google.com>
* Pick default archive format based on filename suffixJonathan Nieder2013-06-065-0/+53
| | | | | | | | | | | | Introduce a setFilename() method for ArchiveCommand so callers can specify the intended filename of the produced archive. If the filename ends with .tar, the format will default to tar; if .zip, zip; if .tar.gz, gzip-compressed tar; and so on. This doesn't affect "jgit archive" because it doesn't support the --output=<file> option yet. A later patch might do that. Change-Id: Ic0236a70f7aa7f2271c3ef11083b21ee986b4df5
* Add long filename, large file, and non-ASCII filename support to TarFormatJonathan Nieder2013-06-061-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Attempts to write entries with too-long filenames currently error out: $ jgit.pgm/target/jgit archive HEAD >test.tar java.lang.RuntimeException: file name 'org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java' is too long ( > 100 bytes) at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.putArchiveEntry(TarArchiveOutputStream.java:288) at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:92) at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:62) at org.eclipse.jgit.api.ArchiveCommand.writeArchive(ArchiveCommand.java:293) at org.eclipse.jgit.api.ArchiveCommand.call(ArchiveCommand.java:322) at org.eclipse.jgit.pgm.Archive.run(Archive.java:97) at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:174) at org.eclipse.jgit.pgm.Main.execute(Main.java:213) at org.eclipse.jgit.pgm.Main.run(Main.java:121) at org.eclipse.jgit.pgm.Main.main(Main.java:95) That's because the default longFileMode is LONGFILE_ERROR, which throws an exception for filenames longer than 100 characters. Switch to LONGFILE_POSIX. While at it, handle large files and filenames with strange encodings, too. This requires commons compress 1.4, which introduced support for large files and POSIX long filenames. Change-Id: I04d5427eec0968b129f55d7a4c6021039a494828
* Add tbz2 archive formatJonathan Nieder2013-06-052-0/+72
| | | | Change-Id: Idb7ff75877a0cfe23f47e10e3f6f93386f5bb145
* Fix javadoc of FormatActivatorMatthias Sohn2013-06-021-5/+7
| | | | | Change-Id: I64b32f71df2964da4cb2de73b34bf7e455ab5b93 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing javadoc for archive codeJonathan Nieder2013-05-295-0/+25
| | | | | | | | Document archive formats, the archive format interface, and the parameters of the GitAPIException constructors. Noticed by eclipse. Reported-by: Dani Megert <Daniel_Megert@ch.ibm.com> Change-Id: I22b5f9d4c0358bbe867c1906feec7c279e214273
* Drop unnecessary "throws" clauses in archive codeJonathan Nieder2013-05-291-2/+2
| | | | | | Noticed by eclipse. Change-Id: I730b290556066038efeaf2436de95415b175f351
* Move FormatActivator.start()/stop() to a separate classJonathan Nieder2013-05-292-44/+93
| | | | | | | | | This makes the functionality of registering all formats from the org.eclipse.jgit.archive package available in contexts where FormatActivator cannot be built because the OSGi core framework is not readily available to build against. Change-Id: If8e3487e933783a7e12f8e1838cbfe0b5862ce80
* Add tgz and txz archive formatsJonathan Nieder2013-05-283-0/+138
| | | | Change-Id: I347e8a9a112d142ccef91cba1d6e997d645ca70a
* Maintain list of archive formats in one placeJonathan Nieder2013-05-281-4/+51
| | | | | | | | | | | | | Add a static start() method to FormatActivator to allow outside classes such as the Archive subcommand of the jgit program to use it without a BundleContext. This way, the list of formats only has to be maintained in one place. While at it, build a list of registered formats at start() time, so stop() doesn't have to repeat the same list of formats. Suggested-by: Shawn Pearce <spearce@spearce.org> Change-Id: I55cb3095043568740880cc9e4f7cde05f49c363c
* Move ArchiveCommand into standard porcelain APIJonathan Nieder2013-05-243-0/+225
Allow use of ArchiveCommand without depending on the jgit command-line tools. To avoid complicating the process of installing and upgrading JGit, this does not add a dependency by the org.eclipse.jgit bundle on commons-compress. Instead, the caller is responsible for registering any formats they want to use by calling ArchiveCommand.registerFormat. This patch puts functionality that requires an archiver into a separate org.eclipse.jgit.archive bundle for people who want it. One can use it by calling ArchiveCommand.registerFormat directly to register its formats or by relying on OSGi class loading to load org.eclipse.jgit.archive.FormatActivator, which takes care of registration automatically. Once the appropriate formats are registered, you can make a tar or zip from a git tree object as follows: ArchiveCommand cmd = git.archive(); try { cmd.setTree(tree).setFormat(fmt).setOutputStream(out).call(); } finally { cmd.release(); } Change-Id: I418e7e7d76422dc6f010d0b3b624d7bec3b20c6e