diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2024-02-21 18:22:04 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-02-21 18:23:27 +0100 |
commit | 265550e63719c47ac9fc59fce107914acf0f8522 (patch) | |
tree | 56931e98a84a0beef4386fe6b05d11db1f69ad40 /org.eclipse.jgit.pgm | |
parent | 3fc0ec18228d392aecf5d15198e001815726b5d5 (diff) | |
parent | 5481bfda90e403d49156b04446b06a8efd304449 (diff) | |
download | jgit-265550e63719c47ac9fc59fce107914acf0f8522.tar.gz jgit-265550e63719c47ac9fc59fce107914acf0f8522.zip |
Merge branch 'master' into next
* master:
Delete org.eclipse.jgit.ssh.apache.agent/bin/.project
Allow to discover bitmap on disk created after the packfile
Update jetty to 10.0.20
Update maven plugins
Update org.assertj:assertj-core to 3.25.3
Update org.mockito:mockito-core to 5.10.0
Update org.apache.commons:commons-compress to 1.26.0
Update byte-buddy to 1.14.12
Add SystemReader.Delegate to reduce boiler-plate code needed to subclass
storage.file: Do not throw NSFE when deleting tmp files
FS.detectSymlinkSupport: fix a race
RefDirectory: Do not unlock until after deleting loose ref
Add missing javadoc description for declared exception
SnapshottingRefDirectory: Invalidate snapshot after locking ref for update
SnapshottingRefDir: Replace lambas with method refs
SnapshottingRefDir: Reduce casts with overrides
[errorprone] Fix wrong comparison which always evaluated to false
[errorprone] Remove unnecessary comparison
Errorprone EscapedEntity: Do not use HTML entities inside @code javadoc
ChangedPathFilter: Suppress warning about backing array (errorprone)
PackWriterBitmapPreparer: Do not generate bitmaps for excessive branch tips.
Don't use localized String during JVM shutdown
RawParseUtils.nextLfSkippingSplitLines: fulfil contract as stated
[gpg] Refactor the GpgSignatureVerifier
RawParseUtils: utility method to get a header value
Improve handling of NFS stale handle errors
Fix handling of missing pack index file
Add tests for handling pack files removal during fetch
RebaseCommand: fix stopping on root commit conflicts
Improve handling of NFS stale handle errors
Fix handling of missing pack index file
CherryPick: add ability to customise cherry-picked commit message
RawParseUtils: Add missing @since tag for new API method
Silence API warning for new constant
[ssh] Bump Apache MINA sshd 2.11.0 -> 2.12.0
Introduce a PriorityQueue sorting RevCommits by commit timestamp
Remove org.eclipse.jgit.benchmark/.factorypath
Update jmh to 1.37 for org.eclipse.jgit.benchmark
Add tests for handling pack files removal during fetch
PackWriterBitmapPreparer: Set limit on excessive branch count
Update jna to 5.14.0
DfsInserter/PackParser: keep min size for index in the inserter
FooterLines: handle extraction from messages without headers
Silence API warnings
Remove invalid/unnecessary Maven settings
Update maven plugins
Update org.eclipse.dash:license-tool-plugin to 1.1.0
Enable using slf4j 2.x
Update Tycho to 4.0.4
Update mockito to 5.8.0
Add 4.31 target platform and update orbit to 4.31
Update ecj to 3.36.0
Renormalize line endings based on .gitattributes
Configure .gitattributes to manage line endings
Normalize line endings to LF for all text files
BasePackFetchConnection: Skip object/ref lookups if local repo is empty
LooseObjects: Use File#exists when possible
Remove invalid spotbugs configuration
Fix PMD plugin configuration
DfsReader: give subclasses visiblity over the pack bitmap index
PackBitmapIndex/StoredBitmap: Expose size and counts
PackWriter/Statistics: Remove the bitmapt hit stats
Configure Github issue reporting
Make sure ref to prune is in packed refs
FooterLine: Protect from ill-formed message
API filter for PackStatistics.objectsWithBitmapsFound
StartGenerator: Fix parent rewrite with non-default RevFilter
Update MANIFEST.MF
Document option gc.writeCommitGraph
Bump last release version to 6.8.0.202311291450-r
Prepare 6.9.0-SNAPSHOT builds
BitmapWalkerTest: New test for the walker
PackWriter: store the objects with bitmaps in the statistics
FooterLine: First line cannot be a footer
Reapply "Improve footer parsing to allow multiline footers."
Revert "Improve footer parsing to allow multiline footers."
Prepare 6.8.1-SNAPSHOT builds
JGit v6.8.0.202311291450-r
Rename method parameter to fix warning about hidden field
Fix warnings about empty control flow statements
BitmapIndexImpl: externalize error message
Suppress not-externalized string warnings
Silence API error for new method BitmapIndex#addBitmapLookupListener
Update Orbit to orbit-aggregation/2023-12
Adapt to type parameter added in commons-compress 1.25.0
Improve footer parsing to allow multiline footers.
Make the tests buildable by bazel test
Prepare 6.8.0-SNAPSHOT builds
JGit v6.8.0.202311212206-rc1
BitmapIndex: Add interface to track bitmaps found (or not)
BitmapWalker: Remove BitmapWalkListener
Update repository URLs in CONTRIBUTING.md
Fix typo in FileUtils.isStaleFileHandle() javadoc
Fix branch ref exist check
gpg.bc: Supress errorprone InsecureCryptoUsage
Adjust javadoc to pass errorprone checks
Update org.apache.commons:commons-compress to 1.25.0
Fix annotation of deprecated constant CONFIG_KEY_STREAM_FILE_TRESHOLD
BitmapWalkListener: Use plain interface with noop instance
BitmapWalkListener: Add method and rename for commits
Update bouncycastle to 1.77
PatchApplier: wrap output's TemporaryBuffer with a CountingOutputStream
BitmapWalker: announce walked objects via listener interface
Prepare 6.8.0-SNAPSHOT builds
Update jetty to 10.0.18
SSH: bump org.apache.sshd to 2.11.0
JGit v6.8.0.202311151710-m2
Fix typo in constant name CONFIG_KEY_STREAM_FILE_TRESHOLD
Simplify StringUtils#commonPrefix
Optimize RefDirectory.getRefsByPrefix(String...)
CommitGraphWriter: Remove unnecesary progress update call
Use try-with-resource to ensure UploadPack is closed
Fix hiding field warning
Fix warning for empty code blocks
Fix boxing warnings
errorprone: remove unnecessary parentheses
Update mockito to 5.7.0 and bytebuddy to 1.14.9
Enable Maven reproducible builds
Upgrade bazlets to the latest revision
Revert "Optimise Git protocol v2 `ref-prefix` scanning"
Document GIT_TRACE_PERFORMANCE to show timings
config-options.md: fix sort order
ComboBitset: Add Javadoc
CommitGraphWriter: Add progress monitor to bloom filter computation
CommitGraphWriter: Use ProgressMonitor from the OutputStream
CommitGraphWriter: Unnest generation-number progress
Optimise Git protocol v2 `ref-prefix` scanning
UploadPackTest: Cover using wanted-refs as advertised set
UploadPack: use want-refs as advertised set in fetch v2
BasePackFetchConnection: Avoid full clone with useNegotiationTip
Checkout: better directory handling
.gitignore: ignore all Maven output directories `target/`
benchmarks: use org.eclipse.jgit-parent as parent pom
Generate SBOMs using cyclonedx maven plugin
DfsPackFile: Do not attempt to read stream if pack doesn't have it
PackObjectSizeIndexLoader: Log wrong bytes on exception
Silence API warnings for API added in 5.13.3
FileBasedConfig: in-process synchronization for load() and save()
FileUtils.rename(): better retry handling
FileBasedConfig: ensure correct snapshot if no file
DeleteBranchCommand: update config only at the end
Config.removeSection() telling whether it changed the config
RebaseCommand: return correct status on stash apply conflicts
Use net.i2p.crypto.eddsa 0.3.0 from new Orbit build
PackConfig: fix @since tags
Remove unused API problem filters
Add support for git config repack.packKeptObjects
Do not exclude objects in locked packs from bitmap processing
[errorprone] Fix InconsistentCapitalization
TestRepository: Add getInstant method
Update orbit to orbit-aggregation/2023-12
Prepare 6.8.0-SNAPSHOT builds
JGit v6.8.0.202310031045-m1
UploadPack: Delay freeing refs in sendPack()
ByteBufferInputStream: add missing @since 6.8
Fix log level for successful execution of ShutdownHook#notify to debug
Eclipse features: update copyright year
SSH agent: correct plug-in title
Fix DefaultCharset bug pattern flagged by error prone
Activate additional error prone checks
WorkingTreeIterator: directly filter input stream
[errorprone] Add missing javadoc summary
[errorprone] Fix BadImport
[errorprone] Prevent int expression may overflow
[errorprone] Suppress ByteBufferBackingArray
[errorprone] Suppress JavaLangClash to avoid breaking change
[errorprone] Fix EqualsGetClass
[errorprone] MockSystemReader: fix CatchAndPrintStackTrace
[errorprone] MetaFilter: fix IdentityHashMapUsage
[errorprone] InternalFetchConnection: Suppress CatchAndPrintStackTrace
[errorprone] Don't swallow exception
[errorprone] Fix inconsistent capitalization
[errorprone] PageRef#isStringRef: suppress UnusedMethod
[errorprone] FileReftableStack: fix EqualsUnsafeCast
[errorprone] Suppress MissingSummary for translation bundles
[errorprone] CommandLineMergeTool: Remove unused constuctor
[errorprone] SimilarityRenameDetector: suppress IntLongMath
Add comment why protocol list uses WeakReference
[errorprone] Transport: Suppress ModifyCollectionInEnhancedForLoop
[errorprone] Rename method parameter to silence InvalidParam
[errorprone] MyersDiff#main: fix CatchAndPrintStackTrace
[errorprone] TagCommand: Remove unused parameter of private method
[errorprone] PathFilter#getPathsBestEffort: fix ArrayAsKeyOfSetOrMap
[errorprone] DirCacheEntry: suppress JavaInstantGetSecondsGetNano
[errorprone] Directly implement functional interface
[errorprone] InterruptTimer#terminate: ensure Thread#join succeeds
[errorprone] RawParseUtils@parseHexInt64: suppress IntLongMath
[errorprone] Exceptions should not override #toString
[errorprone] Fix invalid param in javadoc
[errorprone] FS#searchPath: handle surprising behavior of String#split
[errorprone] FileStoreAttributes#FUTURE_RUNNER: Fix corePoolSize
[errorprone] Express duration using seconds which is clearer
[errorprone] Use ArrayList instead of LinkedList
[errorprone] AddCommand#filepattern: use a more specific type
[errorprone] Suppress UnnecessaryParentheses
[errorprone] Remove unnecessary parentheses
tools/BUILD: Sort errorprone rules alphabetically
Update jetty to 10.0.16
Update bazel to 6.3.2
DfsPackFile: remove unnecessary @SuppressWarnings("boxing")
CommitGraphWriter: Remove unnecessary semicolon
CommitGraphWriter: fix boxing warnings
CommitGraphWriter#createCoreChunks: Remove not-thrown exceptions
CommitGraphWriter: Decouple Stats from computing bloom filters
CommitGraphWriter: Move bloom filter calculation out of createChunks
Documentation: Move writeChangedPaths flag from commitGraph to gc section.
[errorprone] Fix wrong comparison which always evaluated to false
[errorprone] Remove unnecessary comparison
Update org.eclipse.jdt:ecj to 3.35.0
Update org.apache.commons:commons-compress to 1.24.0
[errorprone] Suppress ImmutableEnumChecker for ShutdownHook
Update bytebuddy to 1.14.8
Use ShutdownHook to gracefully handle JVM shutdown
Add ShutdownHook to cleanup FileLocks on graceful JVM shutdown
Unregister ShutdownHook when GC#PidLock is closed
OSGi: move plugin localization to subdirectory
ssh: Remove redundant null check for home.getAbsoluteFile()
RevertCommand: support for inserting a Gerrit change ID
[releng] Bump japicmp base version to 6.7.0.202309050840-r
DfsPackFile: Record index loads only in one place
DfsPackfile: Emit the index load with the index object
Prepare 6.8.0-SNAPSHOT builds
Prepare 6.7.1-SNAPSHOT builds
Switch back to wagon-ssh-external
Fix generation of maven site
Ensure home directory not null before using in Sshdsessionfactory
CommitGraphWriter: Make the list of chunks immutable
CommitGraphWriter: Assert written bytes
JGit v6.7.0.202309050840-r
Remove unused API problem filters
[releng] Bump japicmp base version to 6.6.0.202305301015-r
Fix list of 3rd party bundles in p2 repo
Add missing source bundle org.osgi.service.cm.source to target platform
Prepare 6.6.2-SNAPSHOT builds
JGit v6.6.1.202309021850-r
Checkout: better directory handling
CommitGraphWriter: throw exception on unknown chunk
Document commit-graph options supported by JGit
Fix warning raised for local variable hiding DfsPackFile#index
Suppress boxing warnings in DfsPackFile
Remove unused API problem filters
Suppress boxing warnings in tests
Fix warning about empty block
Update mockito to 5.5.0
Update byte-buddy to 1.14.7
Prepare 6.7.0-SNAPSHOT builds
JGit v6.7.0.202308301100-rc1
Remove the cbi-snapshots Maven repository
Update Orbit to orbit-aggregation/release/4.29.0
Add target platform for Eclipse 2023-09 (4.29)
Use release p2 repo for Eclipse 2023-06 (4.28)
Update tycho to 4.0.2
Update jmh to 1.37
Update bouncycastle to 1.76
Fix some tests in ConfigTest
Handle global git config $XDG_CONFIG_HOME/git/config
IO: use JDK convenience methods
org.eclipse.jgit.junit.ssh/.settings/.api_filters: fix unclosed tags
ReadChangedPathFilter: fix Non-externalized string literal warning
Introduce core.packedIndexGitUseStrongRefs config key
DfsReader: Make PackLoadListener interface visible to subclasses
DfsGarbageCollector: provide commit graph stats
DfsGarbageCollector: put only GC commits into the commit graph
DfsReader: Expose when indices are loaded
Update to Tycho 4.0.1
Prepare 6.7.0-SNAPSHOT builds
JGit v6.7.0.202308011830-m2
Add missing @since tags
Fix errorprone warning about precedence
Move footer-line parsing methods from RevCommit to FooterLine
Merge: Add diff3 style merge conflict formatter.
RevCommitCG: Read changed-path-filters directly from commit graph
Update commons-codec to 1.16.0
Add missing @since tags for new API methods
Add missing package import needed to use MurmurHash3
Identify a commit that generates a diffEntry on a rename Event.
Pack: open reverse index from file if present
PackReverseIndexV1: reverse index parsed from version 1 file
PackReverseIndex: open file if present otherwise compute
PackReverseIndex: verify checksums
ComputedPackReverseIndex: Clarify custom bucket sort algorithm
CommitGraphWriter: add option for writing/using bloom filters
CommitGraphWriter: reuse changed path filters
RevWalk: use changed path filters
CommitGraphLoader: read changed-path filters
CommitGraphWriter: write changed-path filters
ssh: PKCS#11 support
GC: Remove handling of extra pack for RefTree
Remove unnecessary @SuppressWarnings("serial")
Remove unused API problem filters
Remove redundant specification of type arguments
DfsPackParser: Create object indices if config says so
PackParserTest: Extract pack-writing helper code to its own class
DfsInserter: generate object size index if config says so
DfsInserter: populate full size on object insertion
DFSGarbargeCollector: Write object size indices
DfsReader/PackFile: Implement isNotLargerThan using the obj size idx
[releng] Use tycho 4.0.0 instead of 4.0.0-SNAPSHOT
Add verification in GcKeepFilesTest that bitmaps are generated
Express the explicit intention of creating bitmaps in GC
GC: prune all packfiles after the loosen phase
Update mockito to 5.4.0 and bytebuddy to 1.14.5
Fix S3Repository getSize to handle larger object sizes
DfsPackFile: make #getReverseIdx public
Add missing bazel dependency to benchmarks
Update JMH to 1.36
Update bouncycastle to 1.75
Update org.eclipse.jdt:ecj to 3.34.0
Update eclipse-jarsigner-plugin to 1.4.2
Update maven-surefire-report-plugin to 3.0.0
Update maven-project-info-reports-plugin to 3.4.3
Update maven-compiler-plugin to 3.11.0
Update maven-enforcer-plugin to 3.3.0
Update build-helper-maven-plugin to 3.4.0
Update spring-boot-maven-plugin to 2.7.13
Update maven-source-plugin to 3.3.0
Prepare 5.13.3-SNAPSHOT builds
JGit v5.13.2.202306221912-r
PackReverseIndex: separate out the computed implementation
Default for global (user) git ignore file
Fix all Javadoc warnings and fail on them
Mark COMMIT_GENERATION_* constants final
Update Orbit to R20230531010532 for 2023-06
Revert "RefDirectory: Throw exception if CAS of packed ref list fails"
PackReverseIndex: use static builder instead of constructor
Gc#writePack: write the reverse index file to disk
Bazel: Fix remote build execution for Java 17
Bump bazel vesion to 6.2.0
Prepare 6.6.1-SNAPSHOT builds
JGit v6.6.0.202305301015-r
Bump bazel vesion to 6.2.0
Update to Orbit S20230516204213
Prepare 6.6.0-SNAPSHOT builds
Prepare 6.7.0-SNAPSHOT builds
JGit v6.6.0.202305241045-m3
GraphObjectIndex: fix search in findGraphPosition
Update to Tycho 4.0.0-SNAPSHOT
PGP sign p2 artefacts
Revert 'Use net.i2p.crypto:eddsa directly from Maven Central'
Update dash license-tool-plugin to 1.0.2
Also add suppressed exception if unchecked exception occurs in finally
Candidate: use "Objects.equals" instead of "=="
Use hamcrest 2.2 directly from Maven Central
Use commons-logging directly from Maven Central
Update jna to 5.13.0
Use bytebuddy directly from Maven Central
Use jna directly from Maven Central
Use net.i2p.crypto:eddsa directly from Maven Central
Use org.tukaani:xz directly from Maven Central
Use args4j directly from Maven Central
Use gson directly from Maven Central
Remove unused $NON-NLS-1$
Remove unused API filters
Switch to Apache MINA sshd 2.10.0
[releng] API filter for PackIndex.DEFAULT_WRITE_REVERSE_INDEX
PackExt: add a #getTmpExtension method
UploadPack: Record negotiation stats on fetchV2 call
RewriteGeneratorTest: Introduce test cases for the RewriteGenerator
PackWriter: write the PackReverseIndex file
Prepare 6.6.0-SNAPSHOT builds
JGit v6.6.0.202305031100-m2
Update Maven plugins
Add TransportHttp#getAdditionalHeaders
Add 4.27 (2023-03) and 4.28 (2023-06) target platforms
Fix inProcessPackedRefsLock not shared with copies of the instance
Update slf4j to 1.7.36 and consume it directly from Maven Central
Update assertj-core to 3.24.2
Update plexus-compiler to 2.13.0
Update Apache commons-codec to 1.15
Update org.apache.commons:commons-compress to 1.23.0
Update javaEWAH to 1.2.3 and use it directly from Maven central
Update org.eclipse.jdt:ecj to 3.33.0
Add missing @since tag to IntComparator
Update to jakarta.servlet:jakarta.servlet-api:4.0.4
Support rebasing independent branches
Support cherry-picking a root commit
AddCommand: ability to switch off renormalization
Update jetty to 10.0.15 and use it from Maven central directly
Update bouncycastle to 1.73
[errorprone] Fix MissingOverride error
PackReverseIndexWriter: write out version 1 reverse index file
IntList: add #sort using quick sort for O(n log n) runtime.
[bazel] Move ToolTestCase to src folder (6.2)
GcConcurrentTest: @Ignore flaky testInterruptGc
Fix CommitTemplateConfigTest
Fix after_open config and Snapshotting RefDir tests to work with bazel
[bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
Demote severity of some error prone bug patterns to warnings
[bazel] Fix version number of bcpg-jdk18on
Parse pull.rebase=preserve as alias for pull.rebase=merges
Use bouncycastle libraries directly from Maven Central
UploadPack: Fix NPE when traversing a tag chain
Add missing @since tag for BatchRefUpdate#getRefDatabase
Add missing since tag for SshBasicTestBase
Add missing since tag for SshTestHarness#publicKey2
Silence API errors
Prevent infinite loop rescanning the pack list on PackMismatchException
Remove blank in maven.config
PackedBatchRefUpdate#execute: reduce nesting of try-catch blocks
PackedBatchRefUpdate: Handle the case where loose refs fail to pack
Remove blank in maven.config
Add protocol configuration to Amazon S3 transport
[pgm] Implement git tag --contains option
ListTagCommand: implement git tag --contains
RevWalk: use generation number to optimize getMergedInto()
DfsPackFile: Extract block aligment code
Ensure parsed RevCommitCG has derived data from commit-graph
PatchApplierTest: specify charset to avoid warning
GcConcurrentTest: @Ignore flaky testInterruptGc
PatchApplier: Check for existence of src/dest files before any operation
Revert "RefDirectory: Throw exception if CAS of packed ref list fails"
RefDirectory.delete: Prevent failures when packed-refs is outdated
RefDirectory.pack: Only rely on packed refs from disk
RefDirectory: Make pack() and commitPackRefs() void
Implement a snapshotting RefDirectory for use in request scope
Fix RefDirectoryTest.testGetRefs_LooseSorting_Bug_348834
PackedBatchRefUpdate: Ensure updates are applied on latest packed refs
Downgrade maven-site-plugin to 3.12.1
Use wagon-ssh-external to deploy Maven site
Record my e-mail change in .mailmap
[releng] Bump japicmp base version
PatchApplier: missing @since, and minor formatting
BasePackFetchConnection: support negotiationTip feature
DirCache: support option index.skipHash
PatchApplierTest: Remove test data with Apache license
Fix PatchApplier error handling.
Ensure FileCommitGraph scans commit-graph file if it already exists
GC: Close File.lines stream
GC: Close File.lines stream
Rerun flaky tests 3 times
Prepare 6.5.1-SNAPSHOT builds
JGit v6.5.0.202303070854-r
Ignore generated org.eclipse.jgit.benchmarks/dependency-reduced-pom.xml
[sshd] Fix calculation of timeout in AbstractClientProxyConnector
Silence API error raised for removed BranchRebaseMode#PRESERVE
[errorprone] Suppress [Finally] warnings
Update Orbit to R20230302014618 for 2023-03
Improve test coverage when core.trustPackedRefsStat set to after_open
Prepare 6.6.0-SNAPSHOT builds
Prepare 6.5.0-SNAPSHOT builds
JGit v6.5.0.202302281825-rc1
Prepare 6.5.0-SNAPSHOT builds
Change config pull.rebase=preserve to pull.rebase=merges
BatchingProgressMonitor: expose time spent per task
PackWriter: offer to write an object-size index for the pack
Fix formatting in GC#doGc
PackExt: Define new extension for the object size index
JGit v6.5.0.202302221508-m3
If tryLock fails to get the lock another gc has it
Fix GcConcurrentTest#testInterruptGc
Don't swallow IOException in GC.PidLock#lock
Check if FileLock is valid before using or releasing it
Use Java 11 ProcessHandle to get pid of the current process
UploadPack: use allow-any-sha1-in-want configuration
Acquire file lock "gc.pid" before running gc
Silence API errors introduced by 9424052f
Externalize strings introduced in c9552aba
Silence API error introduced by 596c445a
PackConfig: add entry for minimum size to index
Fix getPackedRefs to not throw NoSuchFileException
PackObjectSizeIndex: interface and impl for the object-size index
UInt24Array: Array of unsigned ints encoded in 3 bytes.
PackIndex: expose the position of an object-id in the index
Add pack options to preserve and prune old pack files
DfsPackFile/DfsGC: Write commit graphs and expose in pack
ObjectReader: Allow getCommitGraph to throw IOException
Allow to perform PackedBatchRefUpdate without locking loose refs
Document option "core.sha1Implementation" introduced in 59029aec
UploadPack: consume delimiter in object-info command
PatchApplier fix - init cache with provided tree
Prepare 6.5.0-SNAPSHOT builds
JGit v6.5.0.202302011120-m2
Avoid error-prone warning
Fix unused exception error-prone warning
UploadPack: advertise object-info command if enabled
Shortcut during git fetch for avoiding looping through all local refs
FetchCommand: fix fetchSubmodules to work on a Ref to a blob
Silence API warnings introduced by I466dcde6
Allow the exclusions of refs prefixes from bitmap
Move MemRefDatabase creation in a separate method.
PackWriterBitmapPreparer: do not include annotated tags in bitmap
BatchingProgressMonitor: avoid int overflow when computing percentage
DfsReaderIoStats: Add Commit Graph fields into DfsReaderIoStats
[pgm] Fetch-CLI: add support for shallow
Speedup GC listing objects referenced from reflogs
Re-add servlet-api 4.0 to the target platform
Upgrade maven plugins
Cache trustFolderStat/trustPackedRefsStat value per-instance
Refresh 'objects' dir and retry if a loose object is not found
Prepare 6.5.0-SNAPSHOT builds
JGit v6.5.0.202301111425-m1
Update Orbit to S20230101190934
Update to releases p2 repo for 4.26 simultaneous release
RevWalk: integrate commit-graph with commit parsing
FileSnapshotTest: Add more MISSING_FILE coverage
GC: disable writing commit-graph for shallow repos
Introduce core.trustPackedRefsStat config
RefDatabase: fix javadoc formatting
Pull up additionalRefsNames from RefDirectory to RefDatabase
Add TernarySearchTree
CommitGraph: teach ObjectReader to get commit-graph
PatchApplier: fix handling of last newline in text patch
CommitGraph: add commit-graph for FileObjectDatabase
Reformat PatchApplier and PatchApplierTest
PackWriter#prepareBitmapIndex: add clarifying comments
IO#readFully: provide overload that fills the full array
Fix API warnings for the new CommitGraph
PackReverseIndex#findPosition: fix typo in method name
GC: Write commit-graph files when gc
CommitGraph: add core.commitGraph config
CommitGraph: implement commit-graph read
Gc#deleteOrphans: avoid dependence on PackExt alphabetical ordering
WalkPushConnection: Sanitize paths given to transports
Fix documentation for core.trustFolderStat
GraphCommits: Remove unused getter by position
CommitGraphWriter: fix UnusedException errorprone error
Update jetty to 10.0.13
PackExt: Add a commit graph extension.
BatchRefUpdate: Consistent switch branches in ref update
RefWriter#writePackedRefs: Remove a redundant "if" check
commitgraph package: fix exports/imports, add @since tag for new API
CommitGraph: implement commit-graph writer
[releng] bump japicmp base version
Prepare 6.4.1-SNAPSHOT builds
JGit v6.4.0.202211300538-r
Fix crashes on rare combination of file names
Prepare 6.5.0-SNAPSHOT builds
Prepare 6.4.0-SNAPSHOT build
JGit v6.4.0.202211231055-rc1
[pgm] Add options --name-only, --name-status to diff, log, show
Update Orbit to R20221123021534 for 2022-12
RBE: Update toolchain with bazel-toolchains 5.1.2 release
SshTestGitServer: : ensure UploadPack is closed to fix resource leak
UploadPackTest: ensure UploadPack is closed to fix resource leak
[pgm] Ensure UploadPack is closed to fix resource leak
UploadPackServlet#doPost use try-with-resource to ensure up is closed
Fix warnings in PatchApplierTest
Fix boxing warnings in TransportTest
Silence warnings about unclosed BasePackPushConnection
Fix warning about non-externalized String
Remove unused imports
Suppress non-externalized String warnings
Remove unused API problem filters
Silence API errors
Silence API errors
Silence API warnings
Add 4.26 target platform
Use "releases" repository for 4.25 target platform
Update Apache Mina SSHD to 2.9.2
Update Orbit to S20221118032057
DfsBlockCache: Report IndexEventConsumer metrics for reverse indexes.
DfsStreamKey: Replace ForReverseIndex to separate metrics.
Prepare 6.4.0-SNAPSHOT builds
RawText.isBinary(): handle complete buffer correctly
JGit v6.4.0.202211160543-m3
PackExt: Add a reverse index extension.
[benchmarks] Remove profiler configuration
Add SHA1 benchmark
[benchmarks] Set version of maven-compiler-plugin to 3.8.1
Fix running JMH benchmarks
Add option to allow using JDK's SHA1 implementation
Fix API breakage caused by extracting WorkTreeUpdater
Update Orbit to S20221109014815
Use replace instead of replaceAll in toCleanString
Extract Exception -> HTTP status code mapping for reuse
Don't handle internal git errors as an HTTP error
Fix the path for JSchText.properties
Fix crashes on rare combination of file names
Fix Maven SHA1 for Bazel build
UploadPack: Receive and parse client session-id
TransferConfig: Move reading advertisesid setting into TransferConfig
FirstWant: Parse client session-id if received.
ReceivePack: Receive and parse client session-id.
Ignore IllegalStateException if JVM is already shutting down
Prepare 6.4.0-SNAPSHOT builds
Allow to perform PackedBatchRefUpdate without locking loose refs
JGit v6.4.0.202210260700-m2
PushCommand: allow users to disable use of bitmaps for push
I/O redirection for the pre-push hook
PackParser: populate full size of the PackedObjectInfos
PackedObjectInfo: add the full size to the description
ObjectReader: New #isNotLargerThan method
Fail build if there are license issues with dependencies
Update org.apache.httpcomponents:httpcore to 4.4.15
Update Orbit to S20220927175816
Update JMH to 1.35
Update org.eclipse.jdt:ecj to 3.31.0
Update plexus compiler to 2.12.1
Update org.apache.maven.wagon:wagon-ssh to 3.5.2
pgm/BUILD: Add dependencty to java EWAH
[sshd] Guard against numerical overflow
Remove unused imports
Remove unused API filters
ObjectDirectory: avoid using File.getCanonicalPath()
AutoCRLFOutputStream: use BufferedOutputStream
CloneCommand: set HEAD also when not checking out
Pass on shallowSince only if not null
Fix wrong @since tag
Split out ApplyCommand logic to PatchApplier class
Prepare 6.4.0-SNAPSHOT builds
Fix typo in FetchV2Request javadoc
Prepare 6.3.1-SNAPSHOT builds
DfsBundleWriter: Add test case about GC_REST pack.
JGit v6.3.0.202209071007-r
JGit v6.3.0.2022009070944-r
[merge] Fix merge conflicts with symlinks
Update DEPENDENCIES for 6.3.0
Update tycho to 2.7.5
Move WorkTreeUpdater to merge package
WorkTreeUpdater: use DirCacheCheckout#StreamSupplier
DirCacheCheckout#getContent: also take InputStream supplier
Revert "Adds FilteredRevCommit that can overwrites its parents in the DAG."
Revert "Option to pass start RevCommit to be blamed on to the BlameGenerator."
WorkTreeUpdater: remove safeWrite option
Update Orbit to R20220830213456 for 2022-09
BaseSuperprojectWriter: report invalid paths as manifest errors
ApplyCommand: fix ApplyResult#updatedFiles
WorkTreeUpdater: rename metadata maps
WorkTreeUpdater#Result: hide data members
Add javadoc on RevCommit
Option to pass start RevCommit to be blamed on to the BlameGenerator.
WorkTreeUpdater: re-format and clean-up
Prepare 6.3.0-SNAPSHOT builds
Adds FilteredRevCommit that can overwrites its parents in the DAG.
JGit v6.3.0.202208161710-m3
DirCacheCheckout: load WorkingTreeOptions only once
WorkTreeUpdater: Fix unclosed streams
Fix adding symlinks to the index when core.symlinks=false
Remove unused API problem filters
Add missing @since tag for RevCommit#parents introduced in 61b4d105e4
Fix API errors caused by 23a71696cd
Provide default shallowCommits getter and setter in ObjectDatabase
Reapply "Create util class for work tree updating in both filesystem and index."
ResolveMerger: add coverage for inCore file => directory transition
Provide encoding to String#getBytes()
Revert "Create util class for work tree updating in both filesystem and index."
Provide a default implementation for set/get shallowCommits on DfsObjDatabase
Revert "Adds FilteredRevCommit that can overwrites its parents in the DAG."
Revert "Option to pass start RevCommit to be blamed on to the BlameGenerator."
CleanCommand: fix prefix matching
Option to pass start RevCommit to be blamed on to the BlameGenerator.
Adds FilteredRevCommit that can overwrites its parents in the DAG.
Add the ability to override parents on RevCommit.
Refactor NameConflictTreeWalk.fastMin method
Fix BUILD rules for FilteredRenameDetectorTest
Rename fastMinHasMatch to allTreesNamesMatchFastMinRef
Document TreeWalk#min()
Squash error-prone messages
Use constants for git packet protocol line identifiers
ObjectDirectory: improve reading of shallow file
Fetch: add support for shallow
[tests] Stabilize the HTTP server's request log
NameConflictTreeWalk: respect git order on multi-tree iteration
Update Orbit to S20220726152247 and bouncycastle to 1.71
Create util class for work tree updating in both filesystem and index.
Fix the handling of .git/info/exclude and core.excludesFile
Remove version constraints from org.tukaani.xz package
Change-Id: I31997b67bf432ae3bf6b1cde076fa9307b1e00f4
Diffstat (limited to 'org.eclipse.jgit.pgm')
85 files changed, 431 insertions, 211 deletions
diff --git a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs index 2abe9529d3..b27b6c3c7d 100644 --- a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs @@ -52,7 +52,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled diff --git a/org.eclipse.jgit.pgm/BUILD b/org.eclipse.jgit.pgm/BUILD index 2593122f40..a267b155ac 100644 --- a/org.eclipse.jgit.pgm/BUILD +++ b/org.eclipse.jgit.pgm/BUILD @@ -8,6 +8,7 @@ java_library( visibility = ["//visibility:public"], runtime_deps = [ ":services", + "//lib:javaewah", "//org.eclipse.jgit.gpg.bc:gpg-bc", ], deps = [ diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF index 5a38ce7fd6..bcb086f2ac 100644 --- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Automatic-Module-Name: org.eclipse.jgit.pgm Bundle-SymbolicName: org.eclipse.jgit.pgm Bundle-Version: 7.0.0.qualifier Bundle-Vendor: %Bundle-Vendor -Bundle-Localization: plugin +Bundle-Localization: OSGI-INF/l10n/plugin Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: javax.servlet;version="[3.1.0,5.0.0)", org.apache.commons.logging;version="[1.2,2.0)", diff --git a/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin b/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin index ea1d1e3faa..08d37278de 100644 --- a/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin +++ b/org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin @@ -46,6 +46,7 @@ org.eclipse.jgit.pgm.debug.BenchmarkReftable org.eclipse.jgit.pgm.debug.DiffAlgorithms org.eclipse.jgit.pgm.debug.LfsStore org.eclipse.jgit.pgm.debug.MakeCacheTree +org.eclipse.jgit.pgm.debug.ReadChangedPathFilter org.eclipse.jgit.pgm.debug.ReadDirCache org.eclipse.jgit.pgm.debug.ReadReftable org.eclipse.jgit.pgm.debug.RebuildCommitGraph diff --git a/org.eclipse.jgit.pgm/plugin.properties b/org.eclipse.jgit.pgm/OSGI-INF/l10n/plugin.properties index bfa216c8a1..bfa216c8a1 100644 --- a/org.eclipse.jgit.pgm/plugin.properties +++ b/org.eclipse.jgit.pgm/OSGI-INF/l10n/plugin.properties diff --git a/org.eclipse.jgit.pgm/build.properties b/org.eclipse.jgit.pgm/build.properties index 302dded85a..ca8f30b9ed 100644 --- a/org.eclipse.jgit.pgm/build.properties +++ b/org.eclipse.jgit.pgm/build.properties @@ -3,7 +3,7 @@ source.. = src/,\ / output.. = bin/ bin.includes = META-INF/,\ + OSGI-INF/,\ .,\ - plugin.properties,\ about.html,\ resources/simplelogger.properties diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml index e541e1a9ba..a33dcbaca1 100644 --- a/org.eclipse.jgit.pgm/pom.xml +++ b/org.eclipse.jgit.pgm/pom.xml @@ -205,7 +205,7 @@ <target> <copy file="META-INF/SOURCE-MANIFEST.MF" tofile="${source-bundle-manifest}" overwrite="true"/> <replace file="${source-bundle-manifest}"> - <replacefilter token=".qualifier" value=".${maven.build.timestamp}"/> + <replacefilter token=".qualifier" value=".${commit.time.version}"/> </replace> </target> </configuration> diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties index b14531a1bd..50ee809b98 100644 --- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties +++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties @@ -40,6 +40,7 @@ cannotRenameDetachedHEAD=Cannot rename detached HEAD cannotResolve=Cannot resolve {0} cannotSetupConsole=Cannot setup console cannotUseObjectsWithGlog=Cannot use --objects with glog +cannotUseNameStatusOnlyAndNameOnly=Cannot use --name-only, --name-status are mutually exclusive cantFindGitDirectory=error: can't find git directory cantWrite=Can''t write {0} changesNotStagedForCommit=Changes not staged for commit: @@ -136,6 +137,7 @@ metaVar_commitOrTag=COMMIT|TAG metaVar_commitPaths=paths metaVar_configFile=FILE metaVar_connProp=conn.prop +metaVar_depth=<depth> metaVar_diffAlg=ALGORITHM metaVar_directory=DIRECTORY metaVar_extraArgument=ours|theirs @@ -143,6 +145,7 @@ metaVar_file=FILE metaVar_filepattern=filepattern metaVar_gitDir=GIT_DIR metaVar_hostName=HOSTNAME +metaVar_instant=<instant> metaVar_lfsStorage=STORAGE metaVar_linesOfContext=lines metaVar_message=message @@ -167,6 +170,8 @@ metaVar_s3Region=REGION metaVar_s3StorageClass=STORAGE-CLASS metaVar_seconds=SECONDS metaVar_service=SERVICE +metaVar_shallowExclude=<revision> +metaVar_shallowSince=<date> metaVar_tagLocalUser=<GPG key ID> metaVar_tool=TOOL metaVar_treeish=tree-ish @@ -250,6 +255,7 @@ unsupportedOperation=Unsupported operation: {0} untrackedFiles=Untracked files: updating=Updating {0}..{1} usage_Abbrev=Instead of using the default number of hexadecimal digits (which will vary according to the number of objects in the repository with a default of 7) of the abbreviated object name, use <n> digits, or as many digits as needed to form a unique object name. An <n> of 0 will suppress long format, only showing the closest tag. +usage_addRenormalize=Apply the "clean" process freshly to tracked files to forcibly add them again to the index. This implies -u. usage_Aggressive=This option will cause gc to more aggressively optimize the repository at the expense of taking much more time usage_AlwaysFallback=Show uniquely abbreviated commit object as fallback usage_bareClone=Make a bare Git repository. That is, instead of creating [DIRECTORY] and placing the administrative files in [DIRECTORY]/.git, make the [DIRECTORY] itself the $GIT_DIR. @@ -293,6 +299,7 @@ usage_MakeCacheTree=Show the current cache tree structure usage_Match=Only consider tags matching the given glob(7) pattern or patterns, excluding the "refs/tags/" prefix. usage_MergeBase=Find as good common ancestors as possible for a merge usage_MergesTwoDevelopmentHistories=Merges two development histories +usage_PackKeptObjects=Include objects in packs locked by a ".keep" file when repacking usage_PreserveOldPacks=Preserve old pack files by moving them into the preserved subdirectory instead of deleting them after repacking usage_PrunePreserved=Remove the preserved subdirectory containing previously preserved old pack files before repacking, and before preserving more old pack files usage_ReadDirCache= Read the DirCache 100 times @@ -373,6 +380,7 @@ usage_detectRenames=detect renamed files usage_diffAlgorithm=the diff algorithm to use. Currently supported are: 'myers', 'histogram' usage_DiffTool=git difftool is a Git command that allows you to compare and edit files between revisions using common diff tools.\ngit difftool is a frontend to git diff and accepts the same options and arguments. usage_MergeTool=git-mergetool - Run merge conflict resolution tools to resolve merge conflicts.\nUse git mergetool to run one of several merge utilities to resolve merge conflicts. It is typically run after git merge. +usage_depth=Limit fetching to the specified number of commits from the tip of each remote branch history. usage_directoriesToExport=directories to export usage_disableTheServiceInAllRepositories=disable the service in all repositories usage_displayAListOfAllRegisteredJgitCommands=Display a list of all registered jgit commands @@ -413,6 +421,7 @@ usage_mergeStrategy=Use the given merge strategy. Can be supplied more than once usage_message=Set the commit message to be used for the merge commit (in case one is created). usage_moveRenameABranch=move/rename a branch usage_nameStatus=show only name and status of files +usage_nameOnly=show only name of files usage_noCheckoutAfterClone=no checkout of HEAD is performed after the clone is complete usage_noCommit=Don't commit after a successful merge usage_noPrefix=do not show any source or destination prefix @@ -445,6 +454,8 @@ usage_resetMixed=Resets the index but not the working tree usage_runLfsStore=Run LFS Store in a given directory usage_S3NoSslVerify=Skip verification of Amazon server certificate and hostname usage_setTheGitRepositoryToOperateOn=set the git repository to operate on +usage_shallowExclude=Deepen or shorten the history of a shallow repository to exclude commits reachable from a specified remote branch or tag. +usage_shallowSince=Deepen or shorten the history of a shallow repository to include all reachable commits after <date>. usage_show=Display one commit usage_showRefNamesMatchingCommits=Show ref names matching commits usage_showPatch=display patch @@ -460,6 +471,7 @@ usage_trustExitCode=git-difftool invokes a diff tool individually on each file. usage_noTrustExitCode=This option can be used to override --trust-exit-code setting. usage_notags=do not fetch tags usage_tagAnnotated=create an annotated tag, unsigned unless -s or -u are given, or config tag.gpgSign is true +usage_tagContains=Only list tags which contain the specified commit usage_tagDelete=delete tag usage_tagLocalUser=create a signed annotated tag using the specified GPG key ID usage_tagMessage=create an annotated tag with the given message, unsigned unless -s or -u are given, or config tag.gpgSign is true, or tar.forceSignAnnotated is true and -a is not given diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleAuthenticator.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleAuthenticator.java index 681cf5d626..201fa3d22d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleAuthenticator.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleAuthenticator.java @@ -38,7 +38,6 @@ public class ConsoleAuthenticator extends CachedAuthenticator { private final Console cons = System.console(); - /** {@inheritDoc} */ @Override protected PasswordAuthentication promptPasswordAuthentication() { final String realm = formatRealm(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java index 63ce838f0b..5bdfc7bb51 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java @@ -43,13 +43,11 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { private final Console cons = System.console(); - /** {@inheritDoc} */ @Override public boolean isInteractive() { return true; } - /** {@inheritDoc} */ @Override public boolean supports(CredentialItem... items) { for (CredentialItem i : items) { @@ -71,7 +69,6 @@ public class ConsoleCredentialsProvider extends CredentialsProvider { return true; } - /** {@inheritDoc} */ @Override public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java index 1115d2d113..4440e26f6d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java @@ -14,8 +14,6 @@ package org.eclipse.jgit.pgm; -import static java.lang.Character.valueOf; - import java.io.IOException; import java.text.MessageFormat; @@ -59,8 +57,8 @@ abstract class AbstractFetchCommand extends TextBuiltin { shownURI = true; } - outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType, //$NON-NLS-1$ - src, dst); + outw.format(" %c %-17s %-10s -> %s", Character.valueOf(type), //$NON-NLS-1$ + longType, src, dst); outw.println(); } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java index 460f24618e..2ebab5e5d2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java @@ -22,20 +22,26 @@ import org.kohsuke.args4j.Option; @Command(common = true, usage = "usage_addFileContentsToTheIndex") class Add extends TextBuiltin { + @Option(name = "--renormalize", usage = "usage_addRenormalize") + private boolean renormalize = false; + @Option(name = "--update", aliases = { "-u" }, usage = "usage_onlyMatchAgainstAlreadyTrackedFiles") private boolean update = false; @Argument(required = true, metaVar = "metaVar_filepattern", usage = "usage_filesToAddContentFrom") private List<String> filepatterns = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() throws Exception { try (Git git = new Git(db)) { AddCommand addCmd = git.add(); - addCmd.setUpdate(update); - for (String p : filepatterns) + if (renormalize) { + update = true; + } + addCmd.setUpdate(update).setRenormalize(renormalize); + for (String p : filepatterns) { addCmd.addFilepattern(p); + } addCmd.call(); } catch (GitAPIException e) { throw die(e.getMessage(), e); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java index 0acad86f40..24a75a86e8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java @@ -11,8 +11,6 @@ package org.eclipse.jgit.pgm; -import static java.lang.Integer.valueOf; - import java.io.EOFException; import java.io.File; import java.io.FileInputStream; @@ -42,13 +40,11 @@ class AmazonS3Client extends TextBuiltin { @Argument(index = 3, metaVar = "metaVar_KEY", required = true) private String key; - /** {@inheritDoc} */ @Override protected final boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() throws Exception { final AmazonS3 s3 = new AmazonS3(properties()); @@ -68,7 +64,7 @@ class AmazonS3Client extends TextBuiltin { if (n < 0) throw new EOFException(MessageFormat.format( CLIText.get().expectedNumberOfbytes, - valueOf(len))); + Integer.valueOf(len))); outs.write(tmp, 0, n); len -= n; } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java index 4028105b87..f98f8cb728 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java @@ -41,7 +41,6 @@ class Archive extends TextBuiltin { @Option(name = "--output", aliases = { "-o" }, metaVar = "metaVar_file", usage = "usage_archiveOutput") private String output; - /** {@inheritDoc} */ @Override protected void run() throws Exception { if (tree == null) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java index 1a3a2f6f4b..d2285ae64a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java @@ -13,8 +13,6 @@ package org.eclipse.jgit.pgm; -import static java.lang.Integer.valueOf; -import static java.lang.Long.valueOf; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_ABBREV_STRING_LENGTH; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH; @@ -104,7 +102,6 @@ class Blame extends TextBuiltin { /** Used to get a current time stamp for lines without commit. */ private final PersonIdent dummyDate = new PersonIdent("", ""); //$NON-NLS-1$ //$NON-NLS-2$ - /** {@inheritDoc} */ @Override protected void run() { if (file == null) { @@ -198,13 +195,14 @@ class Blame extends TextBuiltin { maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line)); } - String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); //$NON-NLS-1$ + String pathFmt = MessageFormat.format(" %{0}s", //$NON-NLS-1$ + Integer.valueOf(pathWidth)); String numFmt = MessageFormat.format(" %{0}d", //$NON-NLS-1$ - valueOf(1 + (int) Math.log10(maxSourceLine + 1))); + Integer.valueOf(1 + (int) Math.log10(maxSourceLine + 1))); String lineFmt = MessageFormat.format(" %{0}d) ", //$NON-NLS-1$ - valueOf(1 + (int) Math.log10(end + 1))); + Integer.valueOf(1 + (int) Math.log10(end + 1))); String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$ - valueOf(authorWidth), valueOf(dateWidth)); + Integer.valueOf(authorWidth), Integer.valueOf(dateWidth)); for (int line = begin; line < end;) { RevCommit c = blame.getSourceCommit(line); @@ -221,12 +219,13 @@ class Blame extends TextBuiltin { outw.format(pathFmt, path(line)); } if (showSourceLine) { - outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1)); + outw.format(numFmt, + Integer.valueOf(blame.getSourceLine(line) + 1)); } if (!noAuthor) { outw.format(authorFmt, author, date); } - outw.format(lineFmt, valueOf(line + 1)); + outw.format(lineFmt, Integer.valueOf(line + 1)); outw.flush(); blame.getResultContents().writeLine(outs, line); outs.flush(); @@ -340,7 +339,7 @@ class Blame extends TextBuiltin { if (!showRawTimestamp) return dateFmt.format(author.getWhen()); return String.format("%d %s", //$NON-NLS-1$ - valueOf(author.getWhen().getTime() / 1000L), + Long.valueOf(author.getWhen().getTime() / 1000L), dateFmt.format(author.getWhen())); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java index 27668b5378..e680394a79 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java @@ -148,7 +148,6 @@ class Branch extends TextBuiltin { private int maxNameLength; - /** {@inheritDoc} */ @Override protected void run() { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java index 98724bfceb..229d54d44f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java @@ -51,7 +51,6 @@ class Checkout extends TextBuiltin { @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) private List<String> paths = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() throws Exception { if (createBranch) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clean.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clean.java index 6db73e632d..348f2e7dbb 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clean.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clean.java @@ -32,7 +32,6 @@ class Clean extends TextBuiltin { @Option(name = "--dryRun", aliases = { "-n" }) private boolean dryRun = false; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index f28915d3fa..1efba55f05 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -13,7 +13,10 @@ package org.eclipse.jgit.pgm; import java.io.File; import java.io.IOException; import java.text.MessageFormat; +import java.time.Instant; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.eclipse.jgit.api.CloneCommand; import org.eclipse.jgit.api.Git; @@ -48,6 +51,15 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { @Option(name = "--quiet", usage = "usage_quiet") private Boolean quiet; + @Option(name = "--depth", metaVar = "metaVar_depth", usage = "usage_depth") + private Integer depth = null; + + @Option(name = "--shallow-since", metaVar = "metaVar_shallowSince", usage = "usage_shallowSince") + private Instant shallowSince = null; + + @Option(name = "--shallow-exclude", metaVar = "metaVar_shallowExclude", usage = "usage_shallowExclude") + private List<String> shallowExcludes = new ArrayList<>(); + @Option(name = "--recurse-submodules", usage = "usage_recurseSubmodules") private boolean cloneSubmodules; @@ -60,13 +72,11 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { @Argument(index = 1, metaVar = "metaVar_directory") private String localName; - /** {@inheritDoc} */ @Override protected final boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() throws Exception { if (localName != null && gitdir != null) @@ -97,6 +107,16 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { .setMirror(isMirror).setNoCheckout(noCheckout).setBranch(branch) .setCloneSubmodules(cloneSubmodules).setTimeout(timeout); + if (depth != null) { + command.setDepth(depth.intValue()); + } + if (shallowSince != null) { + command.setShallowSince(shallowSince); + } + for (String shallowExclude : shallowExcludes) { + command.addShallowExclude(shallowExclude); + } + command.setGitDir(gitdir == null ? null : new File(gitdir)); command.setDirectory(localNameF); boolean msgs = quiet == null || !quiet.booleanValue(); @@ -126,7 +146,6 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { } } - /** {@inheritDoc} */ @Override public void initializedSubmodules(Collection<String> submodules) { try { @@ -140,7 +159,6 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { } } - /** {@inheritDoc} */ @Override public void cloningSubmodule(String path) { try { @@ -152,7 +170,6 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { } } - /** {@inheritDoc} */ @Override public void checkingOut(AnyObjectId commit, String path) { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java index 7a197a75a5..fb5a8fffc1 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java @@ -141,7 +141,6 @@ public class CommandRef { return r; } - /** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java index b0713f782c..8df028d2e2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java @@ -84,7 +84,6 @@ class Commit extends TextBuiltin { @Argument(metaVar = "metaVar_commitPaths", usage = "usage_CommitPaths") private List<String> paths = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java index 979c6fa945..52f40c2957 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Config.java @@ -68,7 +68,6 @@ class Config extends TextBuiltin { @Option(name = "--file", aliases = { "-f" }, metaVar = "metaVar_file", usage = "usage_configFile") private File configFile; - /** {@inheritDoc} */ @Override protected void run() { if (!list) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java index 47e4b6ba79..06e37da841 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ConvertRefStorage.java @@ -28,7 +28,6 @@ class ConvertRefStorage extends TextBuiltin { "-r" }, usage = "usage_convertRefStorageRefLogs") private boolean writeLogs = true; - /** {@inheritDoc} */ @Override protected void run() throws Exception { ((FileRepository) db).convertRefStorage(format, writeLogs, backup); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java index f987f2c806..ec201a55ef 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java @@ -64,13 +64,11 @@ class Daemon extends TextBuiltin { @Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport") List<File> directory = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() throws Exception { PackConfig packConfig = new PackConfig(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java index 116db037d4..913d7c790d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java @@ -47,7 +47,6 @@ class Describe extends TextBuiltin { @Option(name = "--abbrev", usage = "usage_Abbrev") private Integer abbrev; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java index cdbcbc0d1b..52665a1c71 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java @@ -12,7 +12,6 @@ package org.eclipse.jgit.pgm; -import static java.lang.Integer.valueOf; import static org.eclipse.jgit.lib.Constants.HEAD; import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH; @@ -48,6 +47,10 @@ import org.kohsuke.args4j.Option; class Diff extends TextBuiltin { private DiffFormatter diffFmt; + private boolean showNameOnly = false; + + private boolean showNameAndStatusOnly = false; + @Argument(index = 0, metaVar = "metaVar_treeish") private AbstractTreeIterator oldTree; @@ -81,7 +84,22 @@ class Diff extends TextBuiltin { private Integer renameLimit; @Option(name = "--name-status", usage = "usage_nameStatus") - private boolean showNameAndStatusOnly; + void nameAndStatusOnly(boolean on) { + if (showNameOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameAndStatusOnly = on; + } + + @Option(name = "--name-only", usage = "usage_nameOnly") + void nameOnly(boolean on) { + if (showNameAndStatusOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameOnly = on; + } @Option(name = "--ignore-space-at-eol") void ignoreSpaceAtEol(@SuppressWarnings("unused") boolean on) { @@ -136,14 +154,12 @@ class Diff extends TextBuiltin { // END -- Options shared with Log - /** {@inheritDoc} */ @Override protected void init(Repository repository, String gitDir) { super.init(repository, gitDir); diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); } - /** {@inheritDoc} */ @Override protected void run() { diffFmt.setRepository(db); @@ -183,6 +199,9 @@ class Diff extends TextBuiltin { if (showNameAndStatusOnly) { nameStatus(outw, diffFmt.scan(oldTree, newTree)); outw.flush(); + } else if(showNameOnly) { + nameOnly(outw, diffFmt.scan(oldTree, newTree)); + outw.flush(); } else { diffFmt.format(oldTree, newTree); diffFmt.flush(); @@ -208,16 +227,41 @@ class Diff extends TextBuiltin { out.println("M\t" + ent.getNewPath()); //$NON-NLS-1$ break; case COPY: - out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$ - ent.getOldPath(), ent.getNewPath()); + out.format("C%1$03d\t%2$s\t%3$s", //$NON-NLS-1$ + Integer.valueOf(ent.getScore()), ent.getOldPath(), + ent.getNewPath()); out.println(); break; case RENAME: - out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$ - ent.getOldPath(), ent.getNewPath()); + out.format("R%1$03d\t%2$s\t%3$s", //$NON-NLS-1$ + Integer.valueOf(ent.getScore()), ent.getOldPath(), + ent.getNewPath()); out.println(); break; } } } + + static void nameOnly(ThrowingPrintWriter out, List<DiffEntry> files) + throws IOException { + for (DiffEntry ent : files) { + switch (ent.getChangeType()) { + case ADD: + out.println(ent.getNewPath()); + break; + case DELETE: + out.println(ent.getOldPath()); + break; + case MODIFY: + out.println(ent.getNewPath()); + break; + case COPY: + out.println(ent.getNewPath()); + break; + case RENAME: + out.println(ent.getNewPath()); + break; + } + } + } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java index 9aaf3f5c5a..352ffde26c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java @@ -40,7 +40,6 @@ class DiffTree extends TextBuiltin { @Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class) private TreeFilter pathFilter = TreeFilter.ALL; - /** {@inheritDoc} */ @Override protected void run() { try (TreeWalk walk = new TreeWalk(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java index fbce4a5343..7a007e3b58 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Fetch.java @@ -14,6 +14,8 @@ package org.eclipse.jgit.pgm; import java.io.IOException; import java.text.MessageFormat; +import java.time.Instant; +import java.util.ArrayList; import java.util.List; import org.eclipse.jgit.api.FetchCommand; @@ -62,6 +64,15 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback { @Option(name = "--tags", usage="usage_tags", aliases = { "-t" }) private Boolean tags; + @Option(name = "--depth", metaVar = "metaVar_depth", usage = "usage_depth") + private Integer depth = null; + + @Option(name = "--shallow-since", metaVar = "metaVar_shallowSince", usage = "usage_shallowSince") + private Instant shallowSince = null; + + @Option(name = "--shallow-exclude", metaVar = "metaVar_shallowExclude", usage = "usage_shallowExclude") + private List<String> shallowExcludes = new ArrayList<>(); + @Option(name = "--no-tags", usage = "usage_notags", aliases = { "-n" }) void notags(@SuppressWarnings("unused") final boolean ignored) { @@ -102,7 +113,6 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback { @Argument(index = 1, metaVar = "metaVar_refspec") private List<RefSpec> toget; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { @@ -120,6 +130,15 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback { fetch.setTagOpt(tags.booleanValue() ? TagOpt.FETCH_TAGS : TagOpt.NO_TAGS); } + if (depth != null) { + fetch.setDepth(depth.intValue()); + } + if (shallowSince != null) { + fetch.setShallowSince(shallowSince); + } + for (String shallowExclude : shallowExcludes) { + fetch.addShallowExclude(shallowExclude); + } if (0 <= timeout) { fetch.setTimeout(timeout); } @@ -147,7 +166,6 @@ class Fetch extends AbstractFetchCommand implements FetchCommand.Callback { } } - /** {@inheritDoc} */ @Override public void fetchingSubmodule(String name) { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java index 177be7066d..35ac7a162a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java @@ -10,6 +10,7 @@ package org.eclipse.jgit.pgm; +import org.eclipse.jgit.api.GarbageCollectCommand; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.TextProgressMonitor; @@ -21,20 +22,31 @@ class Gc extends TextBuiltin { private boolean aggressive; @Option(name = "--preserve-oldpacks", usage = "usage_PreserveOldPacks") - private boolean preserveOldPacks; + private Boolean preserveOldPacks; @Option(name = "--prune-preserved", usage = "usage_PrunePreserved") - private boolean prunePreserved; + private Boolean prunePreserved; + + @Option(name = "--pack-kept-objects", usage = "usage_PackKeptObjects") + private Boolean packKeptObjects; /** {@inheritDoc} */ @Override protected void run() { Git git = Git.wrap(db); try { - git.gc().setAggressive(aggressive) - .setPreserveOldPacks(preserveOldPacks) - .setPrunePreserved(prunePreserved) - .setProgressMonitor(new TextProgressMonitor(errw)).call(); + GarbageCollectCommand command = git.gc().setAggressive(aggressive) + .setProgressMonitor(new TextProgressMonitor(errw)); + if (preserveOldPacks != null) { + command.setPreserveOldPacks(preserveOldPacks.booleanValue()); + } + if (prunePreserved != null) { + command.setPrunePreserved(prunePreserved.booleanValue()); + } + if (packKeptObjects != null) { + command.setPackKeptObjects(packKeptObjects.booleanValue()); + } + command.call(); } catch (GitAPIException e) { throw die(e.getMessage(), e); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java index 5318018928..ce687c4639 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java @@ -65,7 +65,6 @@ class Glog extends RevWalkTextBuiltin { frame.getContentPane().add(world); } - /** {@inheritDoc} */ @Override protected int walkLoop() throws Exception { graphPane.getCommitList().source(walk); @@ -77,13 +76,11 @@ class Glog extends RevWalkTextBuiltin { return graphPane.getCommitList().size(); } - /** {@inheritDoc} */ @Override protected void show(RevCommit c) throws Exception { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override protected RevWalk createWalk() { if (objects) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java index 9732335130..b3808d6fda 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java @@ -28,7 +28,6 @@ class IndexPack extends TextBuiltin { @Option(name = "--index-version", usage = "usage_indexFileFormatToCreate") private int indexVersion = -1; - /** {@inheritDoc} */ @Override protected void run() { BufferedInputStream in = new BufferedInputStream(ins); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java index 7a0d96d419..9c4af813a4 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java @@ -40,13 +40,11 @@ class Init extends TextBuiltin { @Argument(index = 0, metaVar = "metaVar_directory") private String directory; - /** {@inheritDoc} */ @Override protected final boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() { InitCommand command = Git.init(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 353b64b9be..852a4b377b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -60,6 +60,10 @@ class Log extends RevWalkTextBuiltin { private Map<String, NoteMap> noteMaps; + private boolean showNameOnly = false; + + private boolean showNameAndStatusOnly = false; + @Option(name="--decorate", usage="usage_showRefNamesMatchingCommits") private boolean decorate; @@ -99,7 +103,22 @@ class Log extends RevWalkTextBuiltin { private Integer renameLimit; @Option(name = "--name-status", usage = "usage_nameStatus") - private boolean showNameAndStatusOnly; + void nameAndStatusOnly(boolean on) { + if (showNameOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameAndStatusOnly = on; + } + + @Option(name = "--name-only", usage = "usage_nameOnly") + void nameOnly(boolean on) { + if (showNameAndStatusOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameOnly = on; + } @Option(name = "--ignore-space-at-eol") void ignoreSpaceAtEol(@SuppressWarnings("unused") boolean on) { @@ -163,14 +182,12 @@ class Log extends RevWalkTextBuiltin { dateFormatter = new GitDateFormatter(Format.DEFAULT); } - /** {@inheritDoc} */ @Override protected void init(Repository repository, String gitDir) { super.init(repository, gitDir); diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); } - /** {@inheritDoc} */ @Override protected void run() { config = new GpgConfig(db.getConfig()); @@ -225,7 +242,6 @@ class Log extends RevWalkTextBuiltin { NoteMap.read(argWalk.getObjectReader(), notesCommit)); } - /** {@inheritDoc} */ @Override protected void show(RevCommit c) throws Exception { outw.print(CLIText.get().commitLabel); @@ -266,8 +282,10 @@ class Log extends RevWalkTextBuiltin { if (showNotes(c)) outw.println(); - if (c.getParentCount() <= 1 && (showNameAndStatusOnly || showPatch)) + if (c.getParentCount() <= 1 && (showNameAndStatusOnly || showPatch + || showNameOnly)) { showDiff(c); + } outw.flush(); } @@ -293,10 +311,14 @@ class Log extends RevWalkTextBuiltin { } /** + * Show notes for given commit + * * @param c + * given commit * @return <code>true</code> if at least one note was printed, * <code>false</code> otherwise * @throws IOException + * if an IO error occurred */ private boolean showNotes(RevCommit c) throws IOException { if (noteMaps == null) @@ -323,12 +345,17 @@ class Log extends RevWalkTextBuiltin { /** * @param c + * given commit * @param map + * note map * @param label + * label * @param emptyLine + * whether to start with an empty line * @return <code>true</code> if note was printed, <code>false</code> * otherwise * @throws IOException + * if an IO error occurred */ private boolean showNotes(RevCommit c, NoteMap map, String label, boolean emptyLine) @@ -364,9 +391,11 @@ class Log extends RevWalkTextBuiltin { : null; final RevTree b = c.getTree(); - if (showNameAndStatusOnly) + if (showNameAndStatusOnly) { Diff.nameStatus(outw, diffFmt.scan(a, b)); - else { + } else if (showNameOnly) { + Diff.nameOnly(outw, diffFmt.scan(a, b)); + } else { outw.flush(); diffFmt.format(a, b); diffFmt.flush(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java index 83446ccd53..89ceed256d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java @@ -40,7 +40,6 @@ class LsRemote extends TextBuiltin { @Argument(index = 0, metaVar = "metaVar_uriish", required = true) private String remote; - /** {@inheritDoc} */ @Override protected void run() { LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote) @@ -63,7 +62,6 @@ class LsRemote extends TextBuiltin { } } - /** {@inheritDoc} */ @Override protected boolean requiresRepository() { return false; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java index bb140018bd..34b48c1b1a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java @@ -38,7 +38,6 @@ class LsTree extends TextBuiltin { @Option(name = "--", metaVar = "metaVar_paths", handler = StopOptionHandler.class) private List<String> paths = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() { try (TreeWalk walk = new TreeWalk(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 613fc5ff32..8df9bad740 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -97,6 +97,7 @@ public class Main { * @param argv * arguments. * @throws java.lang.Exception + * if an error occurred */ public static void main(String[] argv) throws Exception { // make sure built-in filters are registered @@ -121,6 +122,7 @@ public class Main { * @param argv * arguments. * @throws java.lang.Exception + * if an error occurred */ protected void run(String[] argv) throws Exception { writer = createErrorWriter(); @@ -263,9 +265,11 @@ public class Main { /** * @param status + * exit status code, nonzero value indicates an error * @param t * can be {@code null} * @throws Exception + * if an IO error occurred */ void exit(int status, Exception t) throws Exception { writer.flush(); @@ -351,8 +355,7 @@ public class Main { continue; } - final URL u = new URL( - (!s.contains("://")) ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$ + URL u = new URL(!s.contains("://") ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$ if (!u.getProtocol().startsWith("http")) //$NON-NLS-1$ throw new MalformedURLException(MessageFormat.format( CLIText.get().invalidHttpProxyOnlyHttpSupported, s)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java index 27a3d90fad..b78998dd74 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java @@ -86,7 +86,6 @@ class Merge extends TextBuiltin { } } - /** {@inheritDoc} */ @Override protected void run() { if (squash && ff == FastForwardMode.NO_FF) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java index 68eeff748d..aacde2f430 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java @@ -33,7 +33,6 @@ class MergeBase extends TextBuiltin { @Argument(index = 1, metaVar = "metaVar_commitish", required = true) private List<RevCommit> commits = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java index a382fab757..9d0b65c479 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java @@ -41,7 +41,6 @@ import org.eclipse.jgit.errors.NoWorkTreeException; import org.eclipse.jgit.errors.RevisionSyntaxException; import org.eclipse.jgit.internal.diffmergetool.ExternalMergeTool; import org.eclipse.jgit.internal.diffmergetool.FileElement; -import org.eclipse.jgit.internal.diffmergetool.FileElement.Type; import org.eclipse.jgit.internal.diffmergetool.MergeTools; import org.eclipse.jgit.internal.diffmergetool.ToolException; import org.eclipse.jgit.lib.Constants; @@ -218,8 +217,8 @@ class MergeTool extends TextBuiltin { FileElement base = null; FileElement local = null; FileElement remote = null; - FileElement merged = new FileElement(mergedFilePath, Type.MERGED, - db.getWorkTree()); + FileElement merged = new FileElement(mergedFilePath, + FileElement.Type.MERGED, db.getWorkTree()); DirCache cache = db.readDirCache(); try (RevWalk revWalk = new RevWalk(db); TreeWalk treeWalk = new TreeWalk(db, @@ -249,7 +248,8 @@ class MergeTool extends TextBuiltin { ObjectId id = entry.getObjectId(); switch (entry.getStage()) { case DirCacheEntry.STAGE_1: - base = new FileElement(mergedFilePath, Type.BASE); + base = new FileElement(mergedFilePath, + FileElement.Type.BASE); DirCacheCheckout.getContent(db, mergedFilePath, checkoutMetadata, baseSource.open(mergedFilePath, id), opt, @@ -257,7 +257,8 @@ class MergeTool extends TextBuiltin { base.createTempFile(tempFilesParent))); break; case DirCacheEntry.STAGE_2: - local = new FileElement(mergedFilePath, Type.LOCAL); + local = new FileElement(mergedFilePath, + FileElement.Type.LOCAL); DirCacheCheckout.getContent(db, mergedFilePath, checkoutMetadata, localSource.open(mergedFilePath, id), opt, @@ -265,7 +266,8 @@ class MergeTool extends TextBuiltin { local.createTempFile(tempFilesParent))); break; case DirCacheEntry.STAGE_3: - remote = new FileElement(mergedFilePath, Type.REMOTE); + remote = new FileElement(mergedFilePath, + FileElement.Type.REMOTE); DirCacheCheckout.getContent(db, mergedFilePath, checkoutMetadata, remoteSource.open(mergedFilePath, id), opt, diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java index f2e3a16008..b1a5daaa65 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java @@ -11,8 +11,6 @@ package org.eclipse.jgit.pgm; -import static java.lang.Character.valueOf; - import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; @@ -81,7 +79,6 @@ class Push extends TextBuiltin { private boolean shownURI; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { @@ -234,7 +231,7 @@ class Push extends TextBuiltin { private void printUpdateLine(final char flag, final String summary, final String srcRef, final String destRef, final String message) throws IOException { - outw.format(" %c %-17s", valueOf(flag), summary); //$NON-NLS-1$ + outw.format(" %c %-17s", Character.valueOf(flag), summary); //$NON-NLS-1$ if (srcRef != null) outw.format(" %s ->", abbreviateRef(srcRef, true)); //$NON-NLS-1$ diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java index f570f7f99b..f89a4d12be 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java @@ -26,13 +26,11 @@ class ReceivePack extends TextBuiltin { @Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReceiveInto") File dstGitdir; - /** {@inheritDoc} */ @Override protected final boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() { final org.eclipse.jgit.transport.ReceivePack rp; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java index c63532df60..46485cc5ef 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reflog.java @@ -28,7 +28,6 @@ class Reflog extends TextBuiltin { @Argument(metaVar = "metaVar_ref") private String ref; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java index 6d6feed7b8..a3100ac8ed 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java @@ -52,7 +52,6 @@ class Remote extends TextBuiltin { @Argument(index = 2, metaVar = "metaVar_uriish") private String uri; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { @@ -114,7 +113,6 @@ class Remote extends TextBuiltin { } } - /** {@inheritDoc} */ @Override public void printUsage(String message, CmdLineParser clp) throws IOException { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java index 0588a7cdbe..da622e1130 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Repo.java @@ -26,7 +26,6 @@ class Repo extends TextBuiltin { @Argument(required = true, metaVar = "metaVar_path", usage = "usage_pathToXml") private String path; - /** {@inheritDoc} */ @Override protected void run() { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java index 3454cf2515..f33cb6be71 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java @@ -41,7 +41,6 @@ class Reset extends TextBuiltin { @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) private List<String> paths = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevList.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevList.java index e86ad01823..59fc5f296c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevList.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevList.java @@ -18,7 +18,6 @@ import org.eclipse.jgit.revwalk.RevTree; @Command(usage = "usage_RevList") class RevList extends RevWalkTextBuiltin { - /** {@inheritDoc} */ @Override protected void show(RevCommit c) throws Exception { if (c.has(RevFlag.UNINTERESTING)) @@ -32,7 +31,6 @@ class RevList extends RevWalkTextBuiltin { outw.println(); } - /** {@inheritDoc} */ @Override protected void show(ObjectWalk ow, RevObject obj) throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java index 9e4d1c9dd5..b1fb07b5b8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java @@ -35,7 +35,6 @@ class RevParse extends TextBuiltin { @Argument(index = 0, metaVar = "metaVar_commitish") private List<ObjectId> commits = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java index 696a924ecf..51e597c57a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java @@ -114,7 +114,6 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { @Option(name = "--max-count", aliases = "-n", metaVar = "metaVar_n") private int maxCount = -1; - /** {@inheritDoc} */ @Override protected void run() throws Exception { walk = createWalk(); @@ -228,7 +227,8 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { * * @param c * The current {@link org.eclipse.jgit.revwalk.RevCommit} - * @throws java.lang.Exception + * @throws Exception + * if an error occurred */ protected abstract void show(RevCommit c) throws Exception; @@ -243,7 +243,8 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { * {@link #walkLoop()} * @param currentObject * The current {@link org.eclipse.jgit.revwalk.RevObject} - * @throws java.lang.Exception + * @throws Exception + * if an error occurred */ protected void show(final ObjectWalk objectWalk, final RevObject currentObject) throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java index 4a337983eb..234da1a1c5 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java @@ -27,7 +27,6 @@ class Rm extends TextBuiltin { @Option(name = "--", handler = StopOptionHandler.class) private List<String> paths = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index 3beab60a8b..4feb090032 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -58,6 +58,10 @@ class Show extends TextBuiltin { private DiffFormatter diffFmt; + private boolean showNameOnly = false; + + private boolean showNameAndStatusOnly = false; + @Argument(index = 0, metaVar = "metaVar_object") private String objectName; @@ -83,7 +87,22 @@ class Show extends TextBuiltin { private Integer renameLimit; @Option(name = "--name-status", usage = "usage_nameStatus") - private boolean showNameAndStatusOnly; + void nameAndStatusOnly(boolean on) { + if (showNameOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameAndStatusOnly = on; + } + + @Option(name = "--name-only", usage = "usage_nameOnly") + void nameOnly(boolean on) { + if (showNameAndStatusOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameOnly = on; + } @Option(name = "--ignore-space-at-eol") void ignoreSpaceAtEol(@SuppressWarnings("unused") boolean on) { @@ -142,14 +161,12 @@ class Show extends TextBuiltin { fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ", Locale.US); //$NON-NLS-1$ } - /** {@inheritDoc} */ @Override protected void init(Repository repository, String gitDir) { super.init(repository, gitDir); diffFmt = new DiffFormatter(new BufferedOutputStream(outs)); } - /** {@inheritDoc} */ @SuppressWarnings("boxing") @Override protected void run() { @@ -302,9 +319,11 @@ class Show extends TextBuiltin { final RevTree a = c.getParent(0).getTree(); final RevTree b = c.getTree(); - if (showNameAndStatusOnly) + if (showNameAndStatusOnly) { Diff.nameStatus(outw, diffFmt.scan(a, b)); - else { + } else if (showNameOnly) { + Diff.nameOnly(outw, diffFmt.scan(a, b)); + } else { outw.flush(); diffFmt.format(a, b); diffFmt.flush(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java index a58785fef3..64b182e17d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java @@ -21,7 +21,6 @@ import org.eclipse.jgit.lib.RefComparator; @Command(usage = "usage_ShowRef") class ShowRef extends TextBuiltin { - /** {@inheritDoc} */ @Override protected void run() { try { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java index 141de0cd5d..c96e475613 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java @@ -55,7 +55,6 @@ class Status extends TextBuiltin { @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) protected List<String> filterPaths; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { @@ -227,7 +226,7 @@ class Status extends TextBuiltin { firstHeader = false; } int nbUntracked = untracked.size(); - if (nbUntracked > 0 && ("all".equals(untrackedFilesMode))) { //$NON-NLS-1$ + if (nbUntracked > 0 && "all".equals(untrackedFilesMode)) { //$NON-NLS-1$ if (!firstHeader) printSectionHeader(""); //$NON-NLS-1$ printSectionHeader(CLIText.get().untrackedFiles); @@ -239,10 +238,11 @@ class Status extends TextBuiltin { * Print section header * * @param pattern - * a {@link java.lang.String} object. + * a {@link String} object. * @param arguments - * a {@link java.lang.Object} object. - * @throws java.io.IOException + * a {@link Object} object. + * @throws IOException + * if an IO error occurred */ protected void printSectionHeader(String pattern, Object... arguments) throws IOException { @@ -259,9 +259,10 @@ class Status extends TextBuiltin { * Print String list * * @param list - * a {@link java.util.Collection} object. - * @return a int. - * @throws java.io.IOException + * a {@link Collection} object. + * @return size of the list + * @throws IOException + * if an IO error occurred */ protected int printList(Collection<String> list) throws IOException { if (!list.isEmpty()) { @@ -281,21 +282,22 @@ class Status extends TextBuiltin { * Print String list * * @param status1 - * a {@link java.lang.String} object. + * a {@link String} object. * @param status2 - * a {@link java.lang.String} object. + * a {@link String} object. * @param status3 - * a {@link java.lang.String} object. + * a {@link String} object. * @param list - * a {@link java.util.Collection} object. + * a {@link Collection} object. * @param set1 - * a {@link java.util.Collection} object. + * a {@link Collection} object. * @param set2 - * a {@link java.util.Collection} object. + * a {@link Collection} object. * @param set3 - * a {@link java.util.Collection} object. + * a {@link Collection} object. * @return a int. - * @throws java.io.IOException + * @throws IOException + * if an IO error occurred */ protected int printList(String status1, String status2, String status3, Collection<String> list, Collection<String> set1, diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java index e2cd31d198..4ea67ab92c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java @@ -33,6 +33,7 @@ import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.pgm.internal.CLIText; import org.eclipse.jgit.pgm.internal.VerificationUtils; +import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevTag; import org.eclipse.jgit.revwalk.RevWalk; import org.kohsuke.args4j.Argument; @@ -76,13 +77,17 @@ class Tag extends TextBuiltin { "--local-user" }, usage = "usage_tagVerify") private boolean verify; + @Option(name = "--contains", forbids = { "--delete", "--force", + "--annotate", "-m", "--sign", "--no-sign", + "--local-user" }, metaVar = "metaVar_commitish", usage = "usage_tagContains") + private RevCommit contains; + @Argument(index = 0, metaVar = "metaVar_name") private String tagName; @Argument(index = 1, metaVar = "metaVar_object") private ObjectId object; - /** {@inheritDoc} */ @Override protected void run() { try (Git git = new Git(db)) { @@ -142,6 +147,9 @@ class Tag extends TextBuiltin { } } else { ListTagCommand command = git.tagList(); + if (contains != null) { + command.setContains(contains); + } List<Ref> list = command.call(); for (Ref ref : list) { outw.println(Repository.shortenRefName(ref.getName())); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index 6cfe93d850..c572e3bc7d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -249,6 +249,7 @@ public abstract class TextBuiltin { * @param args * the arguments supplied on the command line, if any. * @throws java.io.IOException + * if an IO error occurred */ protected void parseArguments(String[] args) throws IOException { final CmdLineParser clp = new CmdLineParser(this); @@ -277,6 +278,7 @@ public abstract class TextBuiltin { * @param clp * a {@link org.eclipse.jgit.pgm.opt.CmdLineParser} object. * @throws java.io.IOException + * if an IO error occurred */ public void printUsageAndExit(CmdLineParser clp) throws IOException { printUsageAndExit("", clp); //$NON-NLS-1$ @@ -290,6 +292,7 @@ public abstract class TextBuiltin { * @param clp * a {@link org.eclipse.jgit.pgm.opt.CmdLineParser} object. * @throws java.io.IOException + * if an IO error occurred */ public void printUsageAndExit(String message, CmdLineParser clp) throws IOException { printUsage(message, clp); @@ -304,6 +307,7 @@ public abstract class TextBuiltin { * @param clp * parser used to print options * @throws java.io.IOException + * if an IO error occurred * @since 4.2 */ protected void printUsage(String message, CmdLineParser clp) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java index 36103f2e6f..db2c393b9a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java @@ -30,24 +30,23 @@ class UploadPack extends TextBuiltin { @Argument(index = 0, required = true, metaVar = "metaVar_directory", usage = "usage_RepositoryToReadFrom") File srcGitdir; - /** {@inheritDoc} */ @Override protected final boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() { try { FileKey key = FileKey.lenient(srcGitdir, FS.DETECTED); db = key.open(true /* must exist */); - org.eclipse.jgit.transport.UploadPack up = new org.eclipse.jgit.transport.UploadPack( - db); - if (0 <= timeout) { - up.setTimeout(timeout); + try (org.eclipse.jgit.transport.UploadPack up = new org.eclipse.jgit.transport.UploadPack( + db)) { + if (0 <= timeout) { + up.setTimeout(timeout); + } + up.upload(ins, outs, errs); } - up.upload(ins, outs, errs); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, srcGitdir.getPath()), notFound); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java index d06f1e2fbf..8546094ac2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Version.java @@ -22,7 +22,6 @@ import org.eclipse.jgit.pgm.internal.CLIText; @Command(common = true, usage = "usage_DisplayTheVersionOfJgit") class Version extends TextBuiltin { - /** {@inheritDoc} */ @Override protected void run() { // read the Implementation-Version from Manifest @@ -48,7 +47,6 @@ class Version extends TextBuiltin { } } - /** {@inheritDoc} */ @Override protected final boolean requiresRepository() { return false; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java index f23f4cf0ea..f156b8cf4c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/BenchmarkReftable.java @@ -70,7 +70,6 @@ class BenchmarkReftable extends TextBuiltin { @Argument(index = 1) private String reftablePath; - /** {@inheritDoc} */ @Override protected void run() throws Exception { switch (test) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java index a63387c24c..2bdca24336 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java @@ -10,9 +10,6 @@ package org.eclipse.jgit.pgm.debug; -import static java.lang.Integer.valueOf; -import static java.lang.Long.valueOf; - import java.io.File; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; @@ -96,13 +93,11 @@ class DiffAlgorithms extends TextBuiltin { private ThreadMXBean mxBean; - /** {@inheritDoc} */ @Override protected boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() throws Exception { mxBean = ManagementFactory.getThreadMXBean(); @@ -218,10 +213,10 @@ class DiffAlgorithms extends TextBuiltin { outw.println(name + ": start at " + startId.name()); //$NON-NLS-1$ } - outw.format(" %12d files, %8d commits\n", valueOf(files), //$NON-NLS-1$ - valueOf(commits)); - outw.format(" N=%10d min lines, %8d max lines\n", valueOf(minN), //$NON-NLS-1$ - valueOf(maxN)); + outw.format(" %12d files, %8d commits\n", Long.valueOf(files), //$NON-NLS-1$ + Integer.valueOf(commits)); + outw.format(" N=%10d min lines, %8d max lines\n", //$NON-NLS-1$ + Integer.valueOf(minN), Integer.valueOf(maxN)); outw.format("%-25s %12s ( %12s %12s )\n", //$NON-NLS-1$ "Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ @@ -233,9 +228,9 @@ class DiffAlgorithms extends TextBuiltin { for (Test test : all) { outw.format("%-25s %12d ( %12d %12d )", // //$NON-NLS-1$ test.algorithm.name, // - valueOf(test.runningTimeNanos), // - valueOf(test.minN.runningTimeNanos), // - valueOf(test.maxN.runningTimeNanos)); + Long.valueOf(test.runningTimeNanos), // + Long.valueOf(test.minN.runningTimeNanos), // + Long.valueOf(test.maxN.runningTimeNanos)); outw.println(); } outw.println(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java index 9c0ced5c1e..653530d11a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java @@ -181,13 +181,11 @@ class LfsStore extends TextBuiltin { String secretKey; - /** {@inheritDoc} */ @Override protected boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() throws Exception { AppServer server = new AppServer(port); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java index 63897a3891..eec10c774f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java @@ -11,8 +11,6 @@ package org.eclipse.jgit.pgm.debug; -import static java.lang.Integer.valueOf; - import java.io.IOException; import java.text.MessageFormat; @@ -24,7 +22,6 @@ import org.eclipse.jgit.pgm.internal.CLIText; @Command(usage = "usage_MakeCacheTree") class MakeCacheTree extends TextBuiltin { - /** {@inheritDoc} */ @Override protected void run() throws Exception { final DirCache cache = db.readDirCache(); @@ -34,8 +31,8 @@ class MakeCacheTree extends TextBuiltin { private void show(DirCacheTree tree) throws IOException { outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo, - tree.getPathString(), valueOf(tree.getEntrySpan()), - valueOf(tree.getChildCount()))); + tree.getPathString(), Integer.valueOf(tree.getEntrySpan()), + Integer.valueOf(tree.getChildCount()))); for (int i = 0; i < tree.getChildCount(); i++) show(tree.getChild(i)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadChangedPathFilter.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadChangedPathFilter.java new file mode 100644 index 0000000000..1414165e54 --- /dev/null +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadChangedPathFilter.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2023, Google LLC + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0 which is available at + * https://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +package org.eclipse.jgit.pgm.debug; + +import java.io.FileInputStream; +import java.util.HashSet; + +import org.eclipse.jgit.pgm.Command; +import org.eclipse.jgit.pgm.TextBuiltin; +import org.eclipse.jgit.util.NB; +import org.kohsuke.args4j.Argument; + +/** + * Prints the contents of the BDAT chunk from commit-graph file. + * <p> + * This is a debugging tool for changed path filter development. + */ +@Command +class ReadChangedPathFilter extends TextBuiltin { + + static final int CHUNK_ID_OID_FANOUT = 0x4f494446; /* "OIDF" */ + + static final int CHUNK_ID_BLOOM_FILTER_INDEX = 0x42494458; /* "BIDX" */ + + static final int CHUNK_ID_BLOOM_FILTER_DATA = 0x42444154; /* "BDAT" */ + + @Argument(index = 0) + private String input; + + static HashSet<String> changedPathStrings(byte[] data) { + int oidf_offset = -1; + int bidx_offset = -1; + int bdat_offset = -1; + for (int i = 8; i < data.length - 4; i += 12) { + switch (NB.decodeInt32(data, i)) { + case CHUNK_ID_OID_FANOUT: + oidf_offset = (int) NB.decodeInt64(data, i + 4); + break; + case CHUNK_ID_BLOOM_FILTER_INDEX: + bidx_offset = (int) NB.decodeInt64(data, i + 4); + break; + case CHUNK_ID_BLOOM_FILTER_DATA: + bdat_offset = (int) NB.decodeInt64(data, i + 4); + break; + } + } + bdat_offset += 12; // skip version, hash count, bits per entry + int commit_count = NB.decodeInt32(data, oidf_offset + 255 * 4); + int[] changed_path_length_cumuls = new int[commit_count]; + for (int i = 0; i < commit_count; i++) { + changed_path_length_cumuls[i] = NB.decodeInt32(data, + bidx_offset + i * 4); + } + HashSet<String> changed_paths = new HashSet<>(); + for (int i = 0; i < commit_count; i++) { + int prior_cumul = i == 0 ? 0 : changed_path_length_cumuls[i - 1]; + String changed_path = ""; //$NON-NLS-1$ + for (int j = prior_cumul; j < changed_path_length_cumuls[i]; j++) { + changed_path += data[bdat_offset + j] + ","; //$NON-NLS-1$ + } + changed_paths.add(changed_path); + } + return changed_paths; + } + + /** {@inheritDoc} */ + @Override + protected void run() throws Exception { + try (FileInputStream in = new FileInputStream(input) + ) { + byte[] data = in.readAllBytes(); + outw.println(changedPathStrings(data).toString()); + } + } +} diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java index 33d1059911..3d20e01d3c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java @@ -11,8 +11,6 @@ package org.eclipse.jgit.pgm.debug; -import static java.lang.Long.valueOf; - import java.text.MessageFormat; import org.eclipse.jgit.pgm.Command; @@ -21,7 +19,6 @@ import org.eclipse.jgit.pgm.internal.CLIText; @Command(usage = "usage_ReadDirCache") class ReadDirCache extends TextBuiltin { - /** {@inheritDoc} */ @Override protected void run() throws Exception { final int cnt = 100; @@ -31,6 +28,6 @@ class ReadDirCache extends TextBuiltin { final long end = System.currentTimeMillis(); outw.print(" "); //$NON-NLS-1$ outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, - valueOf((end - start) / cnt))); + Long.valueOf((end - start) / cnt))); } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadReftable.java index 6dace841ea..a2443d315f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadReftable.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadReftable.java @@ -30,7 +30,6 @@ class ReadReftable extends TextBuiltin { @Argument(index = 1, required = false) private String ref; - /** {@inheritDoc} */ @Override protected void run() throws Exception { try (FileInputStream in = new FileInputStream(input); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index 8d884c12db..2f96ef7d57 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -81,7 +81,6 @@ class RebuildCommitGraph extends TextBuiltin { private Map<ObjectId, ObjectId> rewrites = new HashMap<>(); - /** {@inheritDoc} */ @Override protected void run() throws Exception { if (!really && db.getRefDatabase().hasRefs()) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java index 28a8d8634a..da16b33701 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java @@ -11,8 +11,6 @@ package org.eclipse.jgit.pgm.debug; -import static java.lang.Integer.valueOf; - import java.io.IOException; import java.text.MessageFormat; @@ -24,7 +22,6 @@ import org.eclipse.jgit.pgm.internal.CLIText; @Command(usage = "usage_ShowCacheTree") class ShowCacheTree extends TextBuiltin { - /** {@inheritDoc} */ @Override protected void run() throws Exception { final DirCache cache = db.readDirCache(); @@ -36,8 +33,8 @@ class ShowCacheTree extends TextBuiltin { private void show(DirCacheTree tree) throws IOException { outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo, - tree.getPathString(), valueOf(tree.getEntrySpan()), - valueOf(tree.getChildCount()))); + tree.getPathString(), Integer.valueOf(tree.getEntrySpan()), + Integer.valueOf(tree.getChildCount()))); for (int i = 0; i < tree.getChildCount(); i++) show(tree.getChild(i)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java index 9e61357da8..e46d703592 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java @@ -26,7 +26,6 @@ class ShowCommands extends TextBuiltin { @Option(name = "--pretty", metaVar = "metaVar_commandDetail", usage = "usage_alterTheDetailShown") private Format pretty = Format.USAGE; - /** {@inheritDoc} */ @Override protected void run() throws Exception { final CommandRef[] list = CommandCatalog.all(); @@ -51,7 +50,7 @@ class ShowCommands extends TextBuiltin { } enum Format { - /** */ + /** Get usage */ USAGE { @Override void print(ThrowingPrintWriter err, CommandRef c) throws IOException { @@ -61,7 +60,7 @@ class ShowCommands extends TextBuiltin { } }, - /** */ + /** Get implementation class name */ CLASSES { @Override void print(ThrowingPrintWriter err, CommandRef c) throws IOException { @@ -69,7 +68,7 @@ class ShowCommands extends TextBuiltin { } }, - /** */ + /** Get URL of implementation class */ URLS { @Override void print(ThrowingPrintWriter err, CommandRef c) throws IOException { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java index 1f4733f792..96add0f188 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java @@ -13,8 +13,6 @@ package org.eclipse.jgit.pgm.debug; -import static java.lang.Integer.valueOf; - import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; @@ -33,7 +31,6 @@ class ShowDirCache extends TextBuiltin { @Option(name = "--millis", aliases = { "-m" }, usage = "usage_showTimeInMilliseconds") private boolean millis = false; - /** {@inheritDoc} */ @Override protected void run() throws Exception { final DateTimeFormatter fmt = DateTimeFormatter @@ -50,7 +47,7 @@ class ShowDirCache extends TextBuiltin { final int stage = ent.getStage(); outw.print(mode); - outw.format(" %6d", valueOf(len)); //$NON-NLS-1$ + outw.format(" %6d", Integer.valueOf(len)); //$NON-NLS-1$ outw.print(' '); if (millis) { outw.print(mtime.toEpochMilli()); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java index 49f7ada457..c95f1384e8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java @@ -39,7 +39,6 @@ class ShowPackDelta extends TextBuiltin { @Argument(index = 0) private ObjectId objectId; - /** {@inheritDoc} */ @Override protected void run() throws Exception { ObjectReader reader = db.newObjectReader(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java index 1ca3034f4f..2ce1711404 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java @@ -10,9 +10,6 @@ package org.eclipse.jgit.pgm.debug; -import static java.lang.Integer.valueOf; -import static java.lang.Long.valueOf; - import java.io.File; import java.lang.reflect.Field; import java.security.MessageDigest; @@ -228,13 +225,11 @@ class TextHashFunctions extends TextBuiltin { @Option(name = "--repository", aliases = { "-r" }, metaVar = "GIT_DIR", usage = "Repository to scan") List<File> gitDirs = new ArrayList<>(); - /** {@inheritDoc} */ @Override protected boolean requiresRepository() { return false; } - /** {@inheritDoc} */ @Override protected void run() throws Exception { if (gitDirs.isEmpty()) { @@ -315,8 +310,8 @@ class TextHashFunctions extends TextBuiltin { outw.println(name + ":"); //$NON-NLS-1$ } outw.format(" %6d files; %5d avg. unique lines/file\n", //$NON-NLS-1$ - valueOf(fileCnt), // - valueOf(lineCnt / fileCnt)); + Long.valueOf(fileCnt), // + Long.valueOf(lineCnt / fileCnt)); outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ outw.println("-----------------------------------------------"); //$NON-NLS-1$ String lastHashName = null; @@ -327,7 +322,7 @@ class TextHashFunctions extends TextBuiltin { outw.format("%-20s %-15s %9d\n", // //$NON-NLS-1$ hashName, // fun.fold.name, // - valueOf(fun.maxChainLength)); + Integer.valueOf(fun.maxChainLength)); lastHashName = fun.hash.name; } outw.println(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java index 16a4c9f333..aa1b81f2b6 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/VerifyReftable.java @@ -42,7 +42,6 @@ class VerifyReftable extends TextBuiltin { @Argument(index = 1) private String reftablePath; - /** {@inheritDoc} */ @Override protected void run() throws Exception { List<Ref> refs = WriteReftable.readRefs(lsRemotePath); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java index 44836ec0dc..d367f02497 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java @@ -18,7 +18,6 @@ import org.eclipse.jgit.pgm.internal.CLIText; @Command(usage = "usage_WriteDirCache") class WriteDirCache extends TextBuiltin { - /** {@inheritDoc} */ @Override protected void run() throws Exception { final DirCache cache = db.readDirCache(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java index 80d2f763f1..faa2bceb74 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java @@ -71,7 +71,6 @@ class WriteReftable extends TextBuiltin { @Argument(index = 1) private String out; - /** {@inheritDoc} */ @SuppressWarnings({ "nls", "boxing" }) @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java index e06f150e51..b5bf6d2bc3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java @@ -21,6 +21,7 @@ import org.kohsuke.args4j.Localizable; /** * Translation bundle for JGit command line interface */ +@SuppressWarnings("MissingSummary") public class CLIText extends TranslationBundle { /** * Formats text strings using {@code Localizable}. @@ -119,6 +120,7 @@ public class CLIText extends TranslationBundle { /***/ public String cannotResolve; /***/ public String cannotSetupConsole; /***/ public String cannotUseObjectsWithGlog; + /***/ public String cannotUseNameStatusOnlyAndNameOnly; /***/ public String cantFindGitDirectory; /***/ public String cantWrite; /***/ public String changesNotStagedForCommit; @@ -213,6 +215,7 @@ public class CLIText extends TranslationBundle { /***/ public String metaVar_filepattern; /***/ public String metaVar_gitDir; /***/ public String metaVar_hostName; + /***/ public String metaVar_instant; /***/ public String metaVar_lfsStorage; /***/ public String metaVar_linesOfContext; /***/ public String metaVar_message; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java index d8604726ab..cea2309f7f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java @@ -63,7 +63,6 @@ public class AbstractTreeIteratorHandler extends clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { final String name = params.getParameter(0); @@ -115,7 +114,6 @@ public class AbstractTreeIteratorHandler extends return 1; } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_treeish; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java index 5d32e6561c..463213dc4f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java @@ -13,6 +13,7 @@ package org.eclipse.jgit.pgm.opt; import java.io.IOException; import java.io.Writer; import java.lang.reflect.Field; +import java.time.Instant; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -55,6 +56,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { registry.registerHandler(RevCommit.class, RevCommitHandler.class); registry.registerHandler(RevTree.class, RevTreeHandler.class); registry.registerHandler(List.class, OptionWithValuesListHandler.class); + registry.registerHandler(Instant.class, InstantHandler.class); } private final Repository db; @@ -108,7 +110,6 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { this.db = repo; } - /** {@inheritDoc} */ @Override public void parseArgument(String... args) throws CmdLineException { final ArrayList<String> tmp = new ArrayList<>(args.length); @@ -263,7 +264,6 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { } } - /** {@inheritDoc} */ @Override protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { if (o instanceof NamedOptionDef) { @@ -273,7 +273,6 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { } - /** {@inheritDoc} */ @Override public void printSingleLineUsage(Writer w, ResourceBundle rb) { List<OptionHandler> options = getOptions(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/GpgSignHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/GpgSignHandler.java index af90b83d17..56423ada41 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/GpgSignHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/GpgSignHandler.java @@ -53,7 +53,6 @@ public class GpgSignHandler extends StringOptionHandler { super(parser, option, setter); } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { String alias = params.getParameter(-1); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/InstantHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/InstantHandler.java new file mode 100644 index 0000000000..9c54169888 --- /dev/null +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/InstantHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2022, Harald Weiner and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0 which is available at + * https://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +package org.eclipse.jgit.pgm.opt; + +import java.time.Instant; + +import org.eclipse.jgit.pgm.internal.CLIText; +import org.kohsuke.args4j.CmdLineException; +import org.kohsuke.args4j.CmdLineParser; +import org.kohsuke.args4j.OptionDef; +import org.kohsuke.args4j.spi.OptionHandler; +import org.kohsuke.args4j.spi.Parameters; +import org.kohsuke.args4j.spi.Setter; + +/** + * Custom argument handler {@link java.time.Instant} from string values. + * <p> + * Assumes the parser has been initialized with a Repository. + * + * @since 6.5 + */ +public class InstantHandler extends OptionHandler<Instant> { + /** + * Create a new handler for the command name. + * <p> + * This constructor is used only by args4j. + * + * @param parser + * a {@link org.kohsuke.args4j.CmdLineParser} object. + * @param option + * a {@link org.kohsuke.args4j.OptionDef} object. + * @param setter + * a {@link org.kohsuke.args4j.spi.Setter} object. + */ + public InstantHandler(CmdLineParser parser, OptionDef option, + Setter<? super Instant> setter) { + super(parser, option, setter); + } + + @Override + public int parseArguments(Parameters params) throws CmdLineException { + Instant instant = Instant.parse(params.getParameter(0)); + setter.addValue(instant); + return 1; + } + + @Override + public String getDefaultMetaVariable() { + return CLIText.get().metaVar_instant; + } +} diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java index 6cd36c3d98..b50df90788 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java @@ -49,7 +49,6 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> { clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { final String name = params.getParameter(0); @@ -68,7 +67,6 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> { CLIText.format(CLIText.get().notAnObject), name); } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_object; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/OptionWithValuesListHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/OptionWithValuesListHandler.java index 7d7c806507..7bb2766fe0 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/OptionWithValuesListHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/OptionWithValuesListHandler.java @@ -33,7 +33,6 @@ public class OptionWithValuesListHandler extends OptionHandler<List<?>> { super(parser, option, setter); } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { final List<String> list = new ArrayList<>(); @@ -50,7 +49,6 @@ public class OptionWithValuesListHandler extends OptionHandler<List<?>> { return list.size(); } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_values; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java index 653511947f..f215040499 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java @@ -49,7 +49,6 @@ public class PathTreeFilterHandler extends OptionHandler<TreeFilter> { super(parser, option, setter); } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { final List<PathFilter> filters = new ArrayList<>(); @@ -73,7 +72,6 @@ public class PathTreeFilterHandler extends OptionHandler<TreeFilter> { return filters.size(); } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_paths; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java index effa22a697..0491445879 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RefSpecHandler.java @@ -43,14 +43,12 @@ public class RefSpecHandler extends OptionHandler<RefSpec> { super(parser, option, setter); } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { setter.addValue(new RefSpec(params.getParameter(0))); return 1; } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_refspec; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java index 8b2bed36a7..a095a28af8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java @@ -53,7 +53,6 @@ public class RevCommitHandler extends OptionHandler<RevCommit> { clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { String name = params.getParameter(0); @@ -116,7 +115,6 @@ public class RevCommitHandler extends OptionHandler<RevCommit> { setter.addValue(c); } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_commitish; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java index 357886d0fa..08f1d28392 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java @@ -52,7 +52,6 @@ public class RevTreeHandler extends OptionHandler<RevTree> { clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { final String name = params.getParameter(0); @@ -83,7 +82,6 @@ public class RevTreeHandler extends OptionHandler<RevTree> { return 1; } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_treeish; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java index e0962031e8..e71ba90e4b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java @@ -49,7 +49,6 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> { clp = (org.eclipse.jgit.pgm.opt.CmdLineParser) parser; } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { final String name = params.getParameter(0); @@ -67,7 +66,6 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> { return 1; } - /** {@inheritDoc} */ @Override public String getDefaultMetaVariable() { return CLIText.get().metaVar_command; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/UntrackedFilesHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/UntrackedFilesHandler.java index 3562754a00..2f99cff768 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/UntrackedFilesHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/UntrackedFilesHandler.java @@ -52,7 +52,6 @@ public class UntrackedFilesHandler extends StringOptionHandler { super(parser, option, setter); } - /** {@inheritDoc} */ @Override public int parseArguments(Parameters params) throws CmdLineException { String alias = params.getParameter(-1); |