aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
Commit message (Collapse)AuthorAgeFilesLines
* [errorprone] Add missing javadoc summaryMatthias Sohn2023-09-251-37/+94
| | | | | | see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link <url>} to <a> ==================== @link does not support being given an external URL. Replaces them with HTML `<a>`. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p> instead - replace <tt>code</tt> by {@code code} - <table> tags don't allow summary attribute, specify caption as <caption>caption</caption> to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn <matthias.sohn@sap.com>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-041-38/+5
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing @since tags for ObjectChecker.ErrorTypeMatthias Sohn2018-10-101-7/+7
| | | | Change-Id: I4d0cd25d6cfaf8b81e58f35e58890ac580eaf9c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* DfsFsck: Check that .gitmodules in the repository have valid contentsIvan Frade2018-10-091-1/+17
| | | | | | | | | | | | | | | | Previous commits block the addition to the repo of dangerous .gitmodules files, but some could have been committed before those safeguards where in place. Add a check in DfsFsck to validate the .gitmodules files in the repo. Use the same validation than the ReceivePack, translating the results to FsckErrors. Note that *all* .gitmodules files in the storage will be checked, not only the latest version. Change-Id: I040cf1f31a779419aad0292ba5e6e76eb7f32b66 Signed-off-by: Ivan Frade <ifrade@google.com>
* SubmoduleValidator: Always throw SubmoduleValidationExceptionIvan Frade2018-10-091-0/+7
| | | | | | | | | | | The fsck test needs more detail about the error than an IOException with an explanatory message. Add an error identifier to the SubmoduleValidatorException and make it the only throwable exception when parsing a file. Change-Id: Ic3f0955b497e1681b25e681e1282e876cdf3d2c5 Signed-off-by: Ivan Frade <ifrade@google.com>
* Merge branch 'stable-4.11' into stable-5.0Jonathan Nieder2018-10-071-2/+2
|\ | | | | | | | | | | | | | | * stable-4.11: ObjectChecker#getGitsubmodules: Fix malformed javadoc Change-Id: If82e40c5a39b84c6a63e8cc10d168696c4eb3e91 Signed-off-by: Jonathan Nieder <jrn@google.com>
| * Merge branch 'stable-4.9' into stable-4.10Jonathan Nieder2018-10-071-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | * stable-4.9: ObjectChecker#getGitsubmodules: Fix malformed javadoc Change-Id: I847bdb9ef2b9e733c79489577b8b6e852ce6abf3 Signed-off-by: Jonathan Nieder <jrn@google.com>
| | * Merge branch 'stable-4.8' into stable-4.9Jonathan Nieder2018-10-071-2/+2
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: ObjectChecker#getGitsubmodules: Fix malformed javadoc Change-Id: Ic73df5571e1ae86e5e026d0bf9d8e9e330cbfa97 Signed-off-by: Jonathan Nieder <jrn@google.com>
| | | * ObjectChecker#getGitsubmodules: Fix malformed javadocDavid Pursehouse2018-10-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The text "<tree, blob>" with angle brackets should not be used in javadoc since it is interpreted as an HTML tag and then rejected since it's not a valid HTML tag. Wrap the text in a @literal tag. Also add a missing space. Change-Id: Ide045e8c04a39a916f5b2e964e58c151e4555830 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Merge branch 'stable-4.11' into stable-5.0Matthias Sohn2018-10-061-5/+143
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Prepare 4.11.5-SNAPSHOT builds JGit v4.11.4.201810060650-r Fix configuration of maven-javadoc-plugin Prepare 4.9.7-SNAPSHOT builds JGit v4.9.6.201810051924-r Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options * Fix configuration of maven-javadoc-plugin for site generation Change-Id: Ic6ff8d324867ee41f15a5b890c7eee5092e8453e Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2018-10-061-5/+143
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Prepare 4.9.7-SNAPSHOT builds JGit v4.9.6.201810051924-r Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options Change-Id: Ie59e34eb591a827d1ce8e483eec6d390a3c81702 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | Merge branch 'stable-4.8' into stable-4.9Matthias Sohn2018-10-061-5/+143
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: Prepare 4.7.6-SNAPSHOT builds JGit v4.7.5.201810051826-r BaseReceivePack: Validate incoming .gitmodules files ObjectChecker: Report .gitmodules files found in the pack SubmoduleAddCommand: Reject submodule URIs that look like cli options Change-Id: Ia7a826399d8d5b8a0eb7169b40e98a6f5c207a4c Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * ObjectChecker: Report .gitmodules files found in the packIvan Frade2018-10-051-5/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to validate .gitmodules files, we first need to find them in the incoming pack. Do it in the ObjectChecker stage. Check in the tree objects if they point to a .gitmodules file and report the tree id and the .gitmodules blob id. This can be used later to check if the file is in the root of the project and if the contents are good. While we're here, make isMacHFSGit more accurate by detecting variants of filenames that vary in case. [jn: tweaked NTFS and HFS+ checking; added more tests] Change-Id: I70802e7d2c1374116149de4f89836b9498f39582 Signed-off-by: Ivan Frade <ifrade@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-1/+1
|/ / / | | | | | | | | | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* / / Fix javadoc in org.eclipse.jgit lib packageMatthias Sohn2017-12-191-28/+39
|/ / | | | | | | Change-Id: I1e85a951488177993521ce177fdea212615e6164 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* / Add BlobObjectCheckerMasaya Suzuki2017-08-281-1/+21
|/ | | | | | | | | | | | | | | | | Some repositories can have a policy that do not accept certain blobs. To check if the incoming pack file contains such blobs, ObjectChecker can be used. However, this ObjectChecker is not called by PackParser if the blob is stored as a whole. This is because the object can be so large that it doesn't fit in memory. This change introduces BlobObjectChecker. This interface takes chunks of a blob instead of the entire object. ObjectChecker can optionally return a BlobObjectChecker. This won't change existing ObjectChecker implementation; existing implementation continues to receive deltified blob objects only. Change-Id: Ic33a92c2de42bd7a89786a4da26b7a648b25218d Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-201-1/+1
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* [infer] Fix resource leak in ObjectCheckerMatthias Sohn2016-12-211-2/+3
| | | | | Bug: 509385 Change-Id: I6b6ff5b721d959eb0708003a40c8f97d6826ac46 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Paths.pathCompare: Utility to sort paths from byte[]Shawn Pearce2016-01-091-23/+8
| | | | | | | | | Consolidate copies of this function into one location. Add some unit tests to prevent bugs that were accidentally introduced while trying to make this refactoring. Change-Id: I82f64bbb8601ca2d8316ca57ae8119df32bb5c08
* ObjectChecker: honor some git-core fsck.* optionsShawn Pearce2015-12-301-158/+347
| | | | | | | | | | | | | | | | Accept some of the same section keys that fsck does in git-core, allowing repositories to skip over specific kinds of acceptable broken objects, e.g.: [fsck] duplicateEntries = ignore zeroPaddedFilemode = ignore The zeroPaddedFilemode = ignore is a synonym for the JGit specific allowLeadingZeroFileMode = true. Only accept the JGit key if git-core key was not specified. Change-Id: Idaed9310e2a5ce5511670ead1aaea2b30aac903c
* ObjectChecker: allow some objects to skip errorsShawn Pearce2015-12-301-50/+166
| | | | | | | | | | | | | | Some ancient objects may be broken, but in a relatively harmless way. Allow the ObjectChecker caller to whitelist specific objects that are going to fail checks, but that have been reviewed by a human and decided the objects are OK enough to permit continued use of. This avoids needing to rewrite history to scrub the broken objects out. Honor the git-core fsck.skipList configuration setting when receiving a push or fetching from a remote repository. Change-Id: I62bd7c0b0848981f73dd7c752860fd02794233a6
* ObjectChecker: use java.text.Normalizer directlyShawn Pearce2015-12-301-55/+2
| | | | | | | | Base Java version for JGit is now Java 7. The java.text.Normalizer class was available in Java 6. Reflection is no longer required to normalize strings for Mac OS X. Change-Id: I98e14b72629a7a729a2d40a3aa275932841274e8
* Fix endless loop in ObjectChecker for MacOSChristian Halstrick2015-09-171-1/+2
| | | | | Bug: 477090 Change-Id: I0ba416f1cc172a835dd2723ff7fa904597ffd097 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Externalize translatable texts in org.eclipse.jgitMatthias Sohn2015-05-261-43/+80
| | | | Change-Id: Ibf4c299f9d203c78cae79e61f88d4bea60ea2795 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add fsck.allowInvalidPersonIdent to accept invalid author/committersShawn Pearce2015-04-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A larger than expected number of real-world repositories found on the Internet contain invalid author, committer and tagger lines in their history. Many of these seem to be caused by users misusing the user.name and user.email fields, e.g.: [user] name = Au Thor <author@example.com> email = author@example.com that some version of Git (or a reimplementation thereof) copied directly into the object header. These headers are not valid and are rejected by a strict fsck, making it impossible to transfer the repository with JGit/EGit. Another form is an invalid committer line with double negative for the time zone, e.g. committer Au Thor <a@b> 1288373970 --700 The real world is messy. :( Allow callers and users to weaken the fsck settings to accept these sorts of breakages if they really want to work on a repo that has broken history. Most routines will still function fine, however commit timestamp sorting in RevWalk may become confused by a corrupt committer line and sort commits out of order. This is mostly fine if the corrupted chain is shorter than the slop window. Change-Id: I6d529542c765c131de590f4f7ef8e7c1c8cb9db9
* Merge branch 'stable-3.5' into stable-3.6Matthias Sohn2014-12-191-7/+127
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-3.5: JGit v3.5.3.201412180710-r JGit v3.4.2.201412180340-r ObjectChecker: Disallow names potentially mapping to ".git" on HFS+ ObjectChecker: Disallow Windows shortname "GIT~1" ObjectChecker: Disallow ".git." and ".git<space>" Always ignore case when forbidding .git in ObjectChecker DirCache: Refuse to read files with invalid paths DirCache: Replace isValidPath with DirCacheCheckout.checkValidPath Replace "a." with "a-" in unit tests Apache HttpClientConnection: replace calls to deprecated LocalFile() Fix two nits about DirCacheEntry constructors Detect buffering failures while writing rebase todo file Deprecate TemporaryBuffer.LocalFile without parent directory Switch FileHeader.extractFileLines to TemporaryBuffer.Heap AmazonS3: Buffer pushed pack content under $GIT_DIR DirCache: Buffer TREE extension to $GIT_DIR Change-Id: Iee8acbaa9d4d9047b550641db1b8845d64530785 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * ObjectChecker: Disallow names potentially mapping to ".git" on HFS+Matthias Sohn2014-12-181-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mac's HFS+ folds concatentations of ".git" and ignorable Unicode characters [1] to ".git" [2]. Hence we need to disallow all names which could potentially be a shortname for ".git". Example: in an empty directory create a folder ".g\U+200Cit". Now you can't create another folder ".git". The following characters are ignorable Unicode which are ignored on HFS+: unicode hex name ------------------------------------------------- U+200C 0xe2808c ZERO WIDTH NON-JOINER U+200D 0xe2808d ZERO WIDTH JOINER U+200E 0xe2808e LEFT-TO-RIGHT MARK U+200F 0xe2808f RIGHT-TO-LEFT MARK U+202A 0xe280aa LEFT-TO-RIGHT EMBEDDING U+202B 0xe280ab RIGHT-TO-LEFT EMBEDDING U+202C 0xe280ac POP DIRECTIONAL FORMATTING U+202D 0xe280ad LEFT-TO-RIGHT OVERRIDE U+202E 0xe280ae RIGHT-TO-LEFT OVERRIDE U+206A 0xe281aa INHIBIT SYMMETRIC SWAPPING U+206B 0xe281ab ACTIVATE SYMMETRIC SWAPPING U+206C 0xe281ac INHIBIT ARABIC FORM SHAPING U+206D 0xe281ad ACTIVATE ARABIC FORM SHAPING U+206E 0xe281ae NATIONAL DIGIT SHAPES U+206F 0xe281af NOMINAL DIGIT SHAPES U+FEFF 0xefbbbf ZERO WIDTH NO-BREAK SPACE [1] http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf#G40025 http://www.unicode.org/reports/tr31/#Layout_and_Format_Control_Characters [2] http://dubeiko.com/development/FileSystems/HFSPLUS/tn1150.html#UnicodeSubtleties Change-Id: Ib6a1dd090b2649bdd8ec16387c994ed29de2860d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * ObjectChecker: Disallow Windows shortname "GIT~1"Christian Halstrick2014-12-181-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows creates shortnames for all non-8.3 files (see [1]). Hence we need to disallow all names which could potentially be a shortname for ".git". Example: in an empty directory create a folder "GIT~1". Now you can't create another folder ".git". The path "GIT~1" may map to ".git" on Windows. A potential victim to such an attack first has to initialize a git repository in order to receive any git commits. Hence the .git folder created by init will get the shortname "GIT~1". ".git" will only get a different shortname if the user has created a file "GIT~1" before initialization of the git repository. [1] http://en.wikipedia.org/wiki/8.3_filename Change-Id: I9978ab8f2d2951c46c1b9bbde57986d64d26b9b2 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * ObjectChecker: Disallow ".git." and ".git<space>"Shawn Pearce2014-12-181-2/+26
| | | | | | | | | | | | | | | | Windows treats "foo." and "foo " as "foo". The ".git" directory is special, as it contains metadata for a local Git repository. Disallow variations that Windows considers to be the same. Change-Id: I28eb48859a95a89111b4987c91de97557e3bb539
| * Always ignore case when forbidding .git in ObjectCheckerShawn Pearce2014-12-181-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | The component name ".GIT" inside a tree entry could confuse a case insensitive filesystem into looking at a submodule and not a directory entry. Disallow any case permutations of ".git" to prevent this confusion from entering a repository and showing up at a later date on a case insensitive system. Change-Id: Iaa3f768931d0d5764bf07ac5f6f3ff2b1fdda01b
* | Move checkPath from DirCacheCheckout to ObjectCheckerShawn Pearce2014-11-281-0/+39
|/ | | | | | | | | | | | | | | | The bulk of the "is this sane" logic is inside of ObjectChecker. The only caller for the version in DirCacheCheckout is an obtuse usage for the static isValidRefName() method in Repository. Deprecate the weird single use method in DirCacheCheckout and move all code for checking a sequence of path components into ObjectChecker, where it makes sense alongside the existing code that checks a single component at a time. Reuse a single ObjectChecker for the local platform, to avoid looking up the system properties on each path string considered. Change-Id: Iae6e769f2bfcad05c166e70ff255f9cf9fcdc87e
* Fix ObjectChecker when normalization is enabledShawn Pearce2014-04-031-1/+1
| | | | | | | | | | | | | When safeForMacOS is enabled the checker verifies a name does not match against another name in the same tree after normalization to NFC. The check was incorrect and failed when the first name was put in, rejecting simple trees containing only one file like "F". Add a test for this simple tree to verify it is accepted. Fix the test for NFC normalization to actually normalize and have a collision. Change-Id: I39e7d71150948872bff6cd2b06bf8dae52aa3c33
* Check for duplicate names after folding case in ObjectCheckerShawn Pearce2014-03-121-1/+69
| | | | | | | | | Mac OS X and Windows filesystems are generally case insensitive and will fold 'a' and 'A' to the same directory entry. If the checker is enforcing safe semantics for these platforms, track all names and look for duplicates after folding case and normalizing to NFC. Change-Id: I170b6f649a72d6ef322b7254943d4c604a8d25b9
* Change DirCacheCheckout to verify path using ObjectCheckerShawn Pearce2014-03-121-22/+45
| | | | | | | | Reuse the generic logic in ObjectChecker to examine paths. This required extracting the scanner loop to check for bad characters within the path name segment. Change-Id: I02e964d114fb544a0c1657790d5367c3a2b09dff
* Reject mixed case .git on Mac OS in ObjectCheckerShawn Pearce2014-03-121-1/+17
| | | | | | | | Most Mac OS X systems use a case insensitive HFS+ volume. Like Windows ".git" and ".GIT" are the same path and can confuse a Git program into expecting a repository where one does not exist. Change-Id: Iec6ce9e6c2872f8b0850cc6aec023fa0fcb05ae4
* Reject special Windows device names in ObjectCheckerShawn Pearce2014-03-121-4/+66
| | | | | | | | If Windows rejection is enabled reject special device names like NUL and PRN, including NUL.txt. This prevents a tree that might be used on a Windows client from referencing a confusing name. Change-Id: Ic700ea8fa68724509e0357d4b758a41178c4d70c
* Allow an ObjectChecker to reject special characters for WindowsShawn Pearce2014-03-121-2/+55
| | | | | | | | | | | | | Repositories that are frequently checked out on Windows platforms may need to ensure trees do not contain strange names that cause problems on those systems. Follow the MSDN guidelines and refuse to accept a tree containing a special character, or names that end with " " (space) or "." (dot). Since Windows filesystems are usually case insensitive, also reject mixed case versions of the reserved ".git" name. Change-Id: Ic3042444b1e162c6d01b88c7e6ea39b2a73c4eca
* Reject '.git' as a tree name in ObjectCheckerShawn Pearce2014-03-121-4/+17
| | | | | | | | Using .git as a name in a tree is invalid for most Git repositories. This can confuse clients into thinking there is a submodule or another repository deeper in the tree, which is incorrect. Change-Id: I90a1eaf25d45e91557f3f548b69cdcd8f7cddce1
* Extract path segment check function in ObjectCheckerShawn Pearce2014-03-121-9/+14
| | | | | | | | Start pulling out the path segment checking. This will be used later to support DirCacheCheckout verification of paths, after folding that logic into this location. Change-Id: I66eaee5c988eb7d425fb7a708ef6f5419ab77348
* Permit ObjectChecker to optionally accept leading '0' in treesShawn Pearce2014-03-121-1/+20
| | | | | | | | | | | | The leading '0' is a broken mode that although incorrect in the Git canonical tree format was created by a couple of libraries frequently used on a popular Git hosting site. Some projects have these modes stuck in their ancient history and cannot easily repair the damage without a full history rewrite. Optionally permit ObjectChecker to ignore them. Bug: 307291 Change-Id: Ib921dfd77ce757e89280d1c00328a88430daef35
* Mark non-externalizable strings as suchRobin Rosenberg2012-12-271-9/+9
| | | | | | | | | | A few classes such as Constanrs are marked with @SuppressWarnings, as are toString() methods with many liternal, but otherwise $NLS-n$ is used for string containing text that should not be translated. A few literals may fall into the gray zone, but mostly I've tried to only tag the obvious ones. Change-Id: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590
* Remove 86 boxing warningsKevin Sawicki2012-05-081-1/+2
| | | | | | | | Use Integer, Character, and Long valueOf methods when passing parameters to MessageFormat and other places that expect objects instead of primitives Change-Id: I5942fbdbca6a378136c00d951ce61167f2366ca4
* Move JGitText to an internal packageRobin Rosenberg2012-03-121-1/+1
| | | | Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
* Externalize strings from JGitSasa Zivkov2010-05-191-1/+5
| | | | | | | | | | | | | | | The strings are externalized into the root resource bundles. The resource bundles are stored under the new "resources" source folder to get proper maven build. Strings from tests are, in general, not externalized. Only in cases where it was necessary to make the test pass the strings were externalized. This was typically necessary in cases where e.getMessage() was used in assert and the exception message was slightly changed due to reuse of the externalized strings. Change-Id: Ic0f29c80b9a54fcec8320d8539a3e112852a1f7b Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Relax ObjectChecker to permit missing tagger linesShawn O. Pearce2010-01-231-5/+5
| | | | | | | | | | | | | | | | | | | | | | | Annotated tags created with C Git versions before the introduction of c818566 ([PATCH] Update tags to record who made them, 2005-07-14), do not have a "tagger" line present in the object header. This line did not appear in C Git until v0.99.1~9. Ancient projects such as the Linux kernel contain such tags, for example Linux 2.6.12 is older than when this feature first appeared in C Git. Linux v2.6.13-rc4 in late July 2005 is the first kernel version tag to actually contain a tagger line. It is therefore acceptable for the header to be missing, and for the RevTag.getTaggerIdent() method to return null. Since the Javadoc for getTaggerIdent() already explained that the identity may be null, we just need to test that this is true when the header is missing, and allow the ObjectChecker to pass anyway. Change-Id: I34ba82e0624a0d1a7edcf62ffba72260af6f7e5d See: http://code.google.com/p/gerrit/issues/detail?id=399 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Get rid of a duplicate constant for SHA-1 lengthRobin Rosenberg2009-12-281-1/+1
| | | | | | | | | | Since Constants.OBJECT_ID_LENGTH is a compile time constant we can be sure that it will always be inlined. The same goes for the associated constant STR_LEN which is now refactored to the Constant class and given a name better suited for wider use. Change-Id: I03f52131e64edcd0aa74bbbf36e7d42faaf4a698 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-291-0/+365
Per CQ 3448 this is the initial contribution of the JGit project to eclipse.org. It is derived from the historical JGit repository at commit 3a2dd9921c8a08740a9e02c421469e5b1a9e47cb. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>