Commit Graph

3175 Commits

Author SHA1 Message Date
Shawn Pearce ed3879e389 Reject mixed case .git on Mac OS in ObjectChecker
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
2014-03-12 16:06:08 -07:00
Shawn Pearce ba0f89b421 Reject special Windows device names in ObjectChecker
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
2014-03-12 15:53:30 -07:00
Matthias Sohn 351aa430e2 Merge "Rename test class so it is also executed during maven test phase" 2014-03-12 18:48:29 -04:00
Shawn Pearce 5019471ccb Allow an ObjectChecker to reject special characters for Windows
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
2014-03-12 15:43:38 -07:00
Shawn Pearce 09f513cb37 Reject '.git' as a tree name in ObjectChecker
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
2014-03-12 15:43:38 -07:00
Shawn Pearce 77cd1c8cdc Extract path segment check function in ObjectChecker
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
2014-03-12 15:43:38 -07:00
Shawn Pearce 2f1bd3618d Permit ObjectChecker to optionally accept leading '0' in trees
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
2014-03-12 15:43:20 -07:00
Christian Halstrick f1d8ce1dce Rename test class so it is also executed during maven test phase
One specific test was executed when running tests from inside eclipse
(e.g. by using one of our checked in launch configurations). But when
running tests from maven this test was not executed. Maven (the surefire
plugin) looks for Tests only in java files which are named like
"Test*.java", "*Test.java" or "*TestCase.java". Tests in files named
"*Tests.java" are not found.

Change-Id: I62a80fd6e6fda8bd76fdf3f3f2b8cbc56460fb2c
2014-03-12 16:03:20 +01:00
Shawn Pearce 62b538d891 Cleanup catch Exception when making Java7FSFactory
Catching Exception and rethrowing as Error when the Java7 factory was
not available threw an unexpected error to the caller, but then
confused things by still setting the factory to the default Java
5 version.  A second call to FS.detect(Boolean) would succeed.

Do not throw to the caller. Instead always default to the Java5
factory if the Java7 one is not loading.

Change-Id: I6e9edb257b404d213ff08c44560fdb1672a5c80b
2014-03-11 14:57:27 -07:00
Matthias Sohn 1bdfd3b3aa [findBugs] Ensure streams are closed in a finally block
Change-Id: I3137eba00d6eba96ca9051b6687fcf62e0871bcc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-11 17:34:17 -04:00
Matthias Sohn 2dc1431f90 Update com.jcraft.jsch to 0.1.50 also in pom dependencies
We updated the target platforms in 3.3 following the version shipped
by the release train but missed to update it in pom dependencies.
This wasn't harmful as there were no API changes between 0.1.46 and
0.1.50.

Change-Id: Ie8ac2ea447fa93d6643b9817f58767ab7f0b1aa4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-11 21:00:27 +01:00
Konrad Kügler efd91ef8a7 Take core.autocrlf into account for blame annotations
Blaming with core.autocrlf set to 'true' - even for freshly checked out
files - showed all lines as being locally modified. For autocrlf = true
the line breaks of the local file will be converted to LF for blaming.
This results in useful diffs and therefor in the desired blame
annotations.

For autocrlf = input no conversion takes place to cope with CRLF line
breaks in the repository, in addition to the usual LF. For autocrlf =
true CRLF line breaks in the repo can't be supported without additional
effort. In that case the whole local file will be blamed as being
locally modified.

Change-Id: If020dcca54d16b2fb79210a070b8480aec82e58e
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-03-10 12:22:57 +01:00
Robin Rosenberg 7e258e6468 Catch UnsupportedOperationException for older Windowses
Bug: 429947
Change-Id: I78d38b345726f62841db34f7091812a91bf21b4b
2014-03-09 12:09:42 +01:00
Robin Rosenberg 7aa3358c40 Add missing break
It does not really matter functionally, but it looked bad,

Change-Id: Icb5b73b38fcaa19f7d1c5a0235c3e8dd125b888b
2014-03-09 10:39:28 +01:00
Robin Rosenberg f3cf8fae76 Remove a redundant semi-colon
Change-Id: Id9a1d0036e3fb33aad8b5cb342197457f33febca
2014-03-08 16:20:31 -05:00
Robin Rosenberg 27191e7e22 Add @since tag to new DirCache#findEntry
Change-Id: Ia58efd178a4571c013bf1104d1da956a86fd7029
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-08 22:19:08 +01:00
Robin Stocker 31fec678d8 Implement "git branch --contains" in pgm
Bug: 425678
Change-Id: Ib59e05a0bde58562cc61e6e3000df761660b468e
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-03-07 18:24:42 -05:00
Christian Halstrick f6f3fe46fc Fix default profile for target platform used in maven build
Change-Id: I10aef3a3b5c3b3ab9f6ef857a9fcc67ce0b1cec3
2014-03-07 23:05:41 +01:00
Matthias Sohn 0401d3eb47 Fix some wrong @since 3.3 tags which should be @since 3.4
Change-Id: Idafe6e041cc40a00ac52eb4ba88753c49db86988
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-07 21:30:58 +01:00
Laurent Goubet ab0983377e Make the resolve merger slightly more sub-classable.
Change-Id: I7d2a90288696ee66887cc01d8a3ec2f6f28a0339
Signed-off-by: Laurent Goubet <laurent.goubet@obeo.fr>
2014-03-06 09:55:29 +01:00
Matthias Sohn effc2f34b8 [findBugs] Declare some private methods of WorkingTreeIterator static
Change-Id: I09cd39c367f408b5a963ff004f235f558990f338
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 19:01:38 -05:00
Matthias Sohn a482fc7273 Update com.jcraft.jsch to 0.1.50 also in pom dependencies
We updated the target platforms in 3.3 following the version shipped
by the release train but missed to update it in pom dependencies.
This wasn't harmful as there were no API changes between 0.1.46 and
0.1.50.

Change-Id: Ie8ac2ea447fa93d6643b9817f58767ab7f0b1aa4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 08:46:11 +01:00
Matthias Sohn 47207e98d4 Prepare 3.4.0-SNAPSHOT builds
Change-Id: I907c6f1834c06b8ab4d3e0f76dde475faea7b4a5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 02:20:38 +01:00
Matthias Sohn 71b90400bb Merge branch 'stable-3.3'
* stable-3.3:
  Update scripts to deploy jgit on Maven central
  Prepare 3.3.1-SNAPSHOT builds
  JGit v3.3.0.201403021825-r
  Fix merge/cherry-picking in CRLF mode
  Expose the received pack size in ReceivePack
  Revert "Add getPackFile to ReceivePack to make PostReceiveHook more usable"
  Avoid an NPE after 7b01a53692
  Add a launcher for Java 7 tests
  Remove obsolete getRepositoryMethod from WorkingTreeIterator
  Fix NPE when WorkingTreeIterator does not have a repository set
  Add getPackFile to ReceivePack to make PostReceiveHook more usable
  Possibility to limit the max pack size on receive-pack
  Package httpclient and httpcore in o.e.j.http.apache.feature

Change-Id: I814a150980854bbaabd767f97b062d247af6cb50
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 02:02:16 +01:00
Matthias Sohn f59b680c4c Update scripts to deploy jgit on Maven central
Change-Id: I760ad82f2455cfc2cdc76c9331a03b09aebb2349
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 00:43:21 +01:00
Matthias Sohn c1fee1d16b Prepare 3.3.1-SNAPSHOT builds
Change-Id: If15560f2731e54dbf9db88d8a308b4c25ce27e8e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-05 00:34:15 +01:00
Robin Rosenberg b640e3ab31 Merge "Add setContains to ListBranchCommand (branch --contains)" 2014-03-03 18:10:44 -05:00
Robin Rosenberg 1328bfdfeb Merge "DirCache.findEntry(byte[], in) made public" 2014-03-03 17:56:10 -05:00
Robin Rosenberg 96c049b876 Merge "Windows: Test that we can create a symlink before the target is created" 2014-03-03 17:54:05 -05:00
Shawn Pearce fc8ff50e1a Add missing @Deprecated to deprecated fields and methods
Java spec requires the @Deprecated annotation on any deprecated
field or method. Add the missing annotation to fields and methods
already declared deprecated in the javadoc.

Change-Id: Ic0ef24b43cfd99ac947e771ef5a28e493c304274
2014-03-03 10:37:06 -08:00
Matthias Sohn 3d855dbfc6 JGit v3.3.0.201403021825-r
Change-Id: Iaf3da455f7d6f691617299e881154ff8185a9d46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-03 00:26:54 +01:00
Robin Rosenberg fd62a45649 Fix merge/cherry-picking in CRLF mode
This fixes a case where we have CRLF in the repo but
LF in the worktree and are in autocrlf mode.

Change-Id: I0388270c1cf0fd22dfd513bcaa404eb97268d39d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-02 20:30:42 +01:00
Robin Rosenberg 31aeaa0931 Merge "Expose the received pack size in ReceivePack" into stable-3.3 2014-03-02 08:17:18 -05:00
Robin Rosenberg 8c82872354 Merge "Revert "Add getPackFile to ReceivePack to make PostReceiveHook more usable"" into stable-3.3 2014-03-02 08:14:14 -05:00
Saša Živkov 835ab30743 Expose the received pack size in ReceivePack
PostReceiveHooks can make use of this information to, for example,
update a cached size of the Git repository.

Change-Id: I2bf1200959a50531e2155a7609c96035ba45b10d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-02 01:52:06 +01:00
Saša Živkov ef3d864b1e Revert "Add getPackFile to ReceivePack to make PostReceiveHook more
usable"

This reverts commit 2670fd427c.

By returning an instance of File from the ReceivePack.getPackFile the
abstraction of the persistence implementation was broken.

Change-Id: I28e3ebf3a659a7cbc94be51bba9e1ad338f2b786
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-02 01:52:04 +01:00
Robin Rosenberg abff667d40 Avoid an NPE after 7b01a53692
While fixing an NPE, I introduced another one in a deprecated isModified
method. It cannot avoid NPE's entirely, which is the reason the method
is deprecated

Change-Id: I5147c1c94621586dd84bd11e6090a954523b6c1c
2014-03-01 13:02:06 +01:00
Robin Rosenberg 5de70c6fab Add a launcher for Java 7 tests
Just like we have launcher for other packages

Change-Id: I140b88b8fdcab08d6515cd1f0ba9a53a9701f60d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-28 10:56:52 +01:00
Robin Rosenberg 9508df3979 Remove obsolete getRepositoryMethod from WorkingTreeIterator
The method was added for symlink support, but isn't needed anymore.
Since it was added for this release it's like it never existed.

Change-Id: I422cd1dcdfa40b25ba3d6e08b112159dae9a4353
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-28 10:56:52 +01:00
Robin Rosenberg 7b01a53692 Fix NPE when WorkingTreeIterator does not have a repository set
It's strange that we have that member since it is not so clear
when it it set or not.

Change-Id: I53903a264f46866d249901a3cd9f9295028aa6bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-28 10:44:54 +01:00
Christian Halstrick 83c743e6e2 Merge "Don't raise checkout conflict for file missing in working tree" 2014-02-27 16:17:56 -05:00
Kaloyan Raev 44812c02e8 CLI clone command should support --no-checkout
doCheckout() is called only if --no-checkout option is not set.

Bug: 428917
Change-Id: I350bef446dd7a37613b9506aae99679569bd36e1
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-26 15:52:25 +01:00
Christian Halstrick 73c8e70797 Don't raise checkout conflict for file missing in working tree
During a checkout we want to prevent to overwrite unsaved local file
content. Jgit was therefore checking whether the file to overwrite is
dirty or missing and would raise a conflict if this was the case. That
was wrong. It should only check if the file is dirty. It's ok to
"overwrite" a missing/non-existing file.

Change-Id: I63c3a94f663c87f09170fdf8b1b1bf4ed5246fc5
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2014-02-26 15:35:05 +01:00
Matthias Sohn df4aca2166 Merge "Add a missing @since tag" 2014-02-26 08:50:42 -05:00
Matthias Sohn a6828b9b73 Merge "Files should be deleted with "retry" option" 2014-02-26 08:49:17 -05:00
Christian Halstrick 8c8bbda3fb Add a missing @since tag
Change-Id: Ie34a4a9c4c47c2f27579094d74a7849fc26a323b
2014-02-26 14:31:29 +01:00
Marc Strapetz 59a2dc801c Files should be deleted with "retry" option
Some of our Windows users have reported sporadic file system access
problems related to ObjectDirectory(Inserter) file deletion code in
combination with antiviral/firewall tools. For one of these users the
problem was fairly reproducible and changing deletion to RETRY solved
his problem.

Change-Id: I1e4001d5557fca693b7bac401268599467cb0c9e
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
2014-02-26 05:53:56 -05:00
Marc Strapetz c5dfc2317c DirCacheEntry: access to raw path
Change-Id: I5d1f6c4b5b3d7a971367cdd0cc9fa4022dff5b85
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
2014-02-26 05:21:35 -05:00
Saša Živkov 2670fd427c Add getPackFile to ReceivePack to make PostReceiveHook more usable
Having access to the pack file that was created by the ReceivePack
may be useful for post receive hooks. For example, a hook may want
to check the size of the received pack and the created index.

Change-Id: I4d51758e4565d32c9f8892242947eb72644b847d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-25 18:14:39 +01:00
Saša Živkov 0d05e5d26c Possibility to limit the max pack size on receive-pack
The maxPackSizeLimit, when set, will reject a pack if it exceeds
that limit.

This feature is intended to provide a mechanism to control disk space
quota on Git repositories.

Change-Id: I83d8db670875c395f8171461b402083323e623a5
CQ: 7896
2014-02-25 14:20:31 +01:00