Commit Graph

3502 Commits

Author SHA1 Message Date
Shawn Pearce a606dc363d Cleanup double stat update of symlinks in DirCacheCheckout
When writing a symlink the stat data should only be written once
into the DirCacheEntry, based on the symlink itself and not the
possibly resolved destination observed by java.io.File.

Refactor the code to handle symlinks and early return.  This
removes the risk the blob stat info update is used against a
newly checked out symlink.

Hoist the file length stat update immediately after writing
the file, before a rename. This eliminates any race caused by another
process updating the file length after the rename and having it to
fall into the racily clean path.

Change-Id: I978ad9719c018ce1cf26947efbabaa8b9dff2217
2014-11-27 13:38:50 -08:00
Shawn Pearce 75b4a23748 Deprecate checkoutEntry variant that accepts File
Entries should only be written to the working tree managed by the
Repository. Simplify callers by passing only the entry and computing
the work tree location inside of the checkoutEntry method.

Change-Id: I574e41280d0407f1853fda12f4bd0d30f75d74e7
2014-11-27 13:37:12 -08:00
Shawn Pearce 6814728a82 DirCacheCheckout: create only one ObjectReader
This deprecated method accidentally creates two ObjectReader
instances. Use the instance created one line above that is
correctly released in the finally block.

Change-Id: Ic57d041674611802a9384d8fa1d292e821055019
2014-11-27 13:32:20 -08:00
Christian Halstrick c1b9b50b5e Merge changes Icf0970dd,Ice5ec10a into stable-3.4
* changes:
  Fix two nits about DirCacheEntry constructors
  Detect buffering failures while writing rebase todo file
2014-11-26 07:54:07 -05:00
Matthias Sohn f9088d6dda Apache HttpClientConnection: replace calls to deprecated LocalFile()
Change-Id: I79f422e004f386b3f2875de6997e5a0949fff566
2014-11-26 01:35:59 +01:00
Shawn Pearce 98c75a7ca2 Fix two nits about DirCacheEntry constructors
Explicitly pass STAGE_0 when creating a DirCacheEntry from String.
This matches the immediate next constructor that accepts the int
stage argument better, making the code easier to read.

Fix a weird line break where the comma was orphaned by itself.

Change-Id: Icf0970dd02a63877f9e41b51b982b0265e8b8887
2014-11-25 11:35:54 -08:00
Shawn Pearce b34ea11720 Detect buffering failures while writing rebase todo file
By routing writes through SafeBufferedOutputStream the caller can be
alerted to any flush at close failures while writing or appending to
the rebase todo script.

Switch the character encoding to be done at the line granularity, as
this is sufficiently long enough that encoding overheads will not be a
bottleneck, but short enough that the amount of temporary data will
not cause memory problems for the JVM.

Change-Id: Ice5ec10a7cbadc58486d481b92940056f9ffc43a
2014-11-25 11:21:27 -08:00
Shawn Pearce 61b632ee5a Deprecate TemporaryBuffer.LocalFile without parent directory
Encourage callers to explicitly name a directory to hold any
overflow data. Call sites have more information about what is
going into the buffer and how it should be protected at the
filesystem level than just throwing content to the system wide
temporary directory.

Callers that still really don't care (or need to care) can pass
null for the File argument to have the system directory used.

Change-Id: I89009bbee49d3850d42cd82c2c462e51043acda0
2014-11-25 10:21:48 -08:00
Shawn Pearce 4206ea43b8 Switch FileHeader.extractFileLines to TemporaryBuffer.Heap
File contents are processed into a single byte[] for character
conversion. The data must fit entirely in memory, so avoid any
file IO.

Change-Id: I3fe8be2e5f37d5ae953596dda1ed3fe6d4f6aebc
2014-11-25 10:21:48 -08:00
Shawn Pearce 67b8bcc1c4 AmazonS3: Buffer pushed pack content under $GIT_DIR
This applies the same filesystem permissions as the source objects.
Users may override in properties files using the tmpdir value.

Change-Id: I3ec332cf41f12eae246cfaee9fd792c52cb2908b
2014-11-25 10:21:48 -08:00
Shawn Pearce f31323745f DirCache: Buffer TREE extension to $GIT_DIR
Increase the in-memory buffer for the TREE extension to 5 MiB, and
overflow to $GIT_DIR instead of /tmp.  Using a larger buffer reduces
the chances a repository will overflow and need to spool the extension
to disk.  Using $GIT_DIR allows the TREE extension contents to have
the same file system protections as the final $GIT_DIR/index.

Wrap the entire thing in a try/finally to ensure the temp file is
deleted from disk after the block has finished using it. To avoid
dangling NFS files, LocalFile.destroy() does close the local file
before deleting it.

Change-Id: I8f871181a4689e3ebf0cdd4fd1769333cf7546c3
2014-11-25 10:21:48 -08:00
Shawn Pearce b2f0fd03d8 Support DfsRepository from GarbageCollectCommand
Bug: 406379
Change-Id: I7f4f23cd50d46ffcde69d6abfe3ca0cc6fa86604
2014-11-25 02:48:41 -05:00
Shawn Pearce 485b751b2f Allow configurable ObjectCheckers in fetch
RecievePack already honors fsck settings for safeForWindows and
safeForMacOS.  Allow those same checks to be performed during fetch
through a caller-configurable ObjectChecker.

Default the fetch fsck options to match the current platform, as
it can be reasonably assumed the repository will be accessed here.

Change-Id: I3c0f411fad209c6bd8fb9c4acf5c55a6799a6a2a
2014-11-24 14:56:13 -08:00
Matthias Sohn 6c3999477c Merge changes If5b8bb91,Ib57fba6c
* changes:
  Cleanup TreeWalk creation/release inside StashApplyCommand
  Deprecate checkoutEntry without ObjectReader
2014-11-24 16:16:39 -05:00
Shawn Pearce b88f3a2a2c Cleanup TreeWalk creation/release inside StashApplyCommand
The TreeWalk constructor doesn't throw in a meaninful way that
requires cleanup of the not-yet-created TreeWalk.

Hoist the constructor outside of the try/finally and remove the
now unnecessary != null check during the finally.

Change-Id: If5b8bb91562715df0699726648123a47426b9850
2014-11-24 12:59:45 -08:00
Shawn Pearce 3bc5188900 Deprecate checkoutEntry without ObjectReader
Callers should manage the ObjectReader, as this allows the JGit library to cache
context relevant information across files checked out at the same time. If the
caller only has one file to checkout, it should still explicitly manage the life
span of the ObjectReader.

Change-Id: Ib57fba6cb4b774ccff8c416ef4d32e2b390f16a9
2014-11-24 12:59:45 -08:00
Matthias Sohn bc2f5aeca1 Delete .eclipse_iplog
We don't use this file anymore since a long time since IP log
generation has been automated at the Eclipse foundation.

Change-Id: I36dd5291d53d06af6a3378c0229c1908e153caae
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-24 14:49:25 +01:00
Andrey Loskutov d81529029a Set permission bits for "executable" attribute according to the umask
Bug: 424395
Change-Id: I3f5c55dd4c084529af2319029305ba2e174e0636
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-22 23:55:47 +01:00
Yuxuan 'fishy' Wang 749dfeffc8 upload-pack: send symbolic refs as capabilities
cgit has this feature for some time. This will teach JGit to send symbolic refs,
too.

Change-Id: I7cb2ab4e6d31a838a0af92eac64535fdb66ed74a
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-11-21 09:47:41 -08:00
Matthias Sohn babc24b46e Define version of javadoc plugin used to generate site
This silences the Maven warning "'reporting.plugins.plugin.version' for
org.apache.maven.plugins:maven-javadoc-plugin is missing"

Change-Id: I036210fefb6bd81ca04fcd91aaba0f9d0c1e8862
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-18 05:30:56 -05:00
Matthias Sohn 85c89534d2 Include the java7 feature in org.eclipse.jgit.feature
This way we no longer need to advertise it in the release train and can
uncategorize the jgit features without making it harder for users to
find and install the java7 feature.

Bug: 451276
Change-Id: I4c7dd0e1609fc1939d8ea83c01251dec59c228a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-18 11:10:13 +01:00
Andrey Loskutov 2c940fa18a Don't use java.util.regex for two simple wildcard cases
To improve ignore parser performance we can avoid using java.util.regex
code on simple wildcard patterns with leading or trailing asterisk. As
those patterns represent a majority of ignore rules, the index diff
performance can be drastically increased on huge repository with lot of
ignore rules.

Bug: 450466
Change-Id: I80428441cc8d5de5468813f841d89322413eed8b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-18 10:58:26 +01:00
Shawn Pearce a31db826d4 Merge "Fix variable name and error message for sideband testing" 2014-11-13 16:50:59 -05:00
Christian Halstrick 140df39198 Let RepositoryBuilder find bare repos
BaseRepositoryBuilder.findGitDir() was not searching correctly for bare
repositories. E.g. when running org.eclipse.jgit.pgm.Log and the current
directory was that of a bare git repository an error "fatal: error:
can't find git directory" was raised. With this fix RepositoryBuilder
will also check whether the given directory is the root of a bare
repository.

Bug: 450193
Change-Id: I4d4ad42e24ca397745adb0f3385caee3bcf3a186
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 23:24:30 +01:00
Matthias Sohn 5672535360 Prepare post 3.6.0-m1 builds
Change-Id: Ie9927de64fa6b7d517f96b8cd12e57541f284ff2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 18:51:54 +01:00
Matthias Sohn 1555eeaa9c JGit v3.6.0.201411121045-m1
Change-Id: I9d789113d88cbbbdbabb8919f80c805aa4ba86fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 16:41:54 +01:00
Matthias Sohn 0bb212019a Merge branch 'stable-3.5'
* stable-3.5:
  Prepare 3.5.3-SNAPSHOT builds
  JGit v3.5.2.201411120430-r
  Don't use SSL anymore to avoid POODLE attack

Change-Id: Icc8404a94512aae36da83baafb8b10422b7bbf7b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 15:07:18 +01:00
Matthias Sohn 3521712032 Prepare 3.5.3-SNAPSHOT builds
Change-Id: Ia37eb66a0deaf6e86a726b1b12eaea25416d4a36
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 08:32:54 -05:00
Matthias Sohn b5e5abcf4d JGit v3.5.2.201411120430-r
Change-Id: I217d25ee712cbde52bc9319ef1dd15d2f571d37a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 10:38:44 +01:00
Christian Halstrick 0fc8b05a71 Introduce config parameter core.trustfolderstat
JGit's ObjectDirectory implements the optimization that it remembers the
pack folders (.git/objects/pack) lastModified timestamp and doesn't
check for new packfiles in this folder if the lastModified attribute has
not changed.
In environments using NFS this can cause trouble. If multiple JGit
instances from multiple machines work on the same repository and one
instance creates a new ref and a new packfile (e.g. by doing a fetch)
then the other machines may detect the new ref but can't resolve the
referenced object because it doesn't detect that pack folder has a new
packfile. That's because NFS may cache file/folder metadata for quite a
long time and the pack folders modification time is not updated although
a new packfile is there and could be read.

The new config parameter core.trustfolderstat controls this behaviour.
The default is true and jgits behaviours is unchanged. But if this
parameter is set to false then jgit doesn't trust the pack directories
lastmodified anymore. Instead it will always iterate through the content
of that folder to detect new packfiles.

Change-Id: Ie3b4e92933286aa9916070a22422e629b3147f54
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 00:41:35 +01:00
Matthias Sohn da178eedd2 Fix javadoc formatting in ConfigConstants
Change-Id: I6ae39b874a3c1fa9e1cda235ff137c9eb8dd359f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-12 00:38:45 +01:00
Stefan Beller 423ad8b0ad Fix variable name and error message for sideband testing
Actually the test only allows a range from [1,255], so let's name the
variable so.

Change-Id: Iecdb8149b83389c67e3cd2f64f4a654c175475be
Signed-off-by: Stefan Beller <sbeller@google.com>
2014-11-10 18:18:34 -08:00
Shawn Pearce 0cf902e473 Expand wildcard imports to specfic classes
JGit style is to import exactly the classes required, and never
to use "import foo.*" as the foo package could add new classes
in the future which are conflicting/confusing with the imports
already used by a source file.

Change-Id: I5693408c777e5843ec65fff1163d5d717849fa34
2014-11-10 15:35:20 -08:00
Christian Halstrick 9597c41ea9 Fix possible NPE in IndexDiff when not all submodules are cloned
The latest changes to IndexDiff just assumed that all configured
submodules are allways cloned. If a configured submodule did not exist
an exception was thrown. This is fixed by this commit.

Bug: 450567
Change-Id: Iabe3b196d998c19483082e5720038ebddaeb1890
2014-11-09 22:44:07 +01:00
Christian Halstrick 714f677ca5 Add missing @since tags
Change-Id: Ia657e46b9abc8c8640f63f6ff579b2f8f2b01de4
2014-11-09 22:21:31 +01:00
Matthias Sohn 440f95363d 4.4 target platform should use Luna repository
Change-Id: I54cdfb5699f87bf86b0434aff0b9618e57a80757
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-09 21:57:29 +01:00
Matthias Sohn 9678e7db8a Merge "Add target platform for Mars using Orbit S-build" 2014-11-09 15:54:03 -05:00
Shawn Pearce cba3060969 Merge "Implement atomic refs update, if possible by database" 2014-11-07 22:04:34 -05:00
Stefan Beller 88c1b82e7a Implement atomic refs update, if possible by database
Inspired by the series[1], this implements the possibility to
have atomic ref transactions.
If the database supports atomic ref update capabilities, we'll
advertise these. If the client wishes to use this feature, either
all refs will be updated or none at all.

[1] http://thread.gmane.org/gmane.comp.version-control.git/259019/focus=259024

Change-Id: I7b5d19c21f3b5557e41b9bcb5d359a65ff1a493d
Signed-off-by: Stefan Beller <sbeller@google.com>
2014-11-07 18:51:18 -08:00
Matthias Sohn 5c2882ec67 Add target platform for Mars using Orbit S-build
updates:
- jsch to 0.1.51 (CQ 8889)
- ant to 1.9.4 (CQ 8890)

CQ: 8889
CQ: 8890
Change-Id: I31f331ce797994d164661b421bfbab33c289deaf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-07 16:34:24 +01:00
Dani Megert 3e131a35e3 Don't use SSL anymore to avoid POODLE attack
For details about poodle see:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566

Bug 450170
Change-Id: Ib169e88d9d51f4d0e6caa3a498f48edc81e0991d
Signed-off-by: Dani Megert <Daniel_Megert@ch.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-07 00:20:25 +01:00
Christian Halstrick 8456927b1b Make sure checkout doesn't report conflicts on ignored paths
In a situation where a certain path was ignored but a working tree file
with this path existed jgit didn't allow to checkout a branch which
didn't ignore this path but contained different content. JGit considered
this to be a checkout conflict to prevent overwriting the file in the
working tree and raised an error. This commit fixes this by ensuring
that ignored dirty working tree files don't lead to a checkout conflict.

Bug: 450169
Change-Id: I90288d314ffac73c24a9c70a5181f8243bd4679a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-06 15:27:46 -05:00
Matthias Sohn abb57e6b56 Do not swallow exception if IndexDiff hits invalid ignore param
Change-Id: I8a595e1f01a0731118d3c537be420222f7fec744
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-06 09:48:01 +01:00
Matthias Sohn d8fcc964a8 Fix non-externalized string warnings in IndexDiff
Change-Id: Ia803182114f0e8b418428e03601f9afc6542ed28
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-06 09:46:45 +01:00
Axel Richard 5328c8c916 Add new method IndexDiff#getPathsWithIndexMode
Get the list of paths that have the given file mode.

This helps EGit to efficiently determine which modified files are
symlinks and should be shown with a symlink icon in the staging view.

Bug: 429302
Change-Id: Id15f0c6f265667f5b8b57cc2d9f97de568371919
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-06 09:40:29 +01:00
Christian Halstrick 2532c28cb9 add missing @since tag in StatusCommand
Change-Id: Ie8d9c3878116488b973dfc80c7c97f174e769d3f
2014-11-04 09:43:58 +01:00
Matthias Sohn 8a398a9147 Add missing @since tags in SubmoduleWalk
Change-Id: Ica34e6709a34977422fd528cbd4df0044403e45d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-03 23:49:36 +01:00
Matthias Sohn c017ac4c85 Add missing @since tags
Change-Id: I27207bafe0ce31caab25ab9c0be1f22adf151783
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-03 17:08:39 +01:00
Christian Halstrick 696de653f3 Enhance SubmoduleWalk with a fast check whether a repo contains
submodules

Change-Id: Id37efb4f4dd77f3b8eb5607d15d32adeda3992d4
2014-11-03 04:33:10 -05:00
Christian Halstrick 6f0b92ff22 RebaseCommand should ignore submodule modifications
Before a rebase happens the RebaseCommand checks that the working tree
is clean. We don't want to start a rebase on a dirty working tree. If
the working tree is dirty a rebase should not be allowed. But
RebaseCommand should ignore modifications done to submodules. E.g. if a
submodules HEAD points to <x> but the root repository has in index that
the submodule should point to <y> then this should not prohibit a
rebase. Also native git allows a rebase in this case. Since jgit's
StatusCommand has learned to ignore submodule changes this is now used
by the RebaseCommand to determine the repository state correctly.

Bug: 446922
Change-Id: I487bf7484dca3f5501e6e514584e2871524eea19
2014-11-03 04:32:54 -05:00