Commit Graph

2949 Commits

Author SHA1 Message Date
Robin Rosenberg b434241e73 Recognize symlinks in the FileTreeIterator
We did this for the Eclipse Platform in the ContainerTreeIterator.

Change-Id: I80d8157cc0dd99d57e2ed5d7cd8b13525a0c62b1
2014-02-12 11:09:24 +01:00
Robin Rosenberg 0b3a5ab817 Add special case to WorkingTreeIterator for matching unnormalized symlinks
If there is an unnormalized symbolic link in the index, lie that it
matches a normalized link in the working tree. This does not make the
case completely invisible everywhere though, but it helps to some
degree.

Change-Id: I599fb71648c41fa2310049d0e0040b3c9f09386b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-12 11:01:32 +01:00
Robin Rosenberg 8dc2f54fa4 FileUtils.delete does not recurse via symlinks
Change-Id: I134cfbda47f4d252fec1a16034e2e78b73cd5081
2014-02-12 01:35:27 +01:00
Robin Rosenberg 14cd43e6df Use fileAttributes to get more attributes in one go
On Windows the length reported by FileAttributes is the size
of the target file (a bug, I guess) rather than the link,
so we read the linke and look at the length of the link instead.

Bug: 353771
Change-Id: I834b06d0447f84379612b8c9190fa77093617595
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-12 01:35:25 +01:00
Robin Stocker 2852b6a07d Fix RevWalkUtils.findBranchesReachableFrom not finding some branches
The "cut off" optimization causes it to not include branches that
contain the specified commit but happen to share commits with a branch
that does not contain the commit.

An example:

      -B foo
        \
    -A---C master

findBranchesReachableFrom for commit A with both branches as input may
not return master (depending on the order of the input). The reason is
that A is not contained in foo, and therefore the old code would put B
in the cutOff set. When then walking the master commits and B is
checked, it is found in the cutOff set and the walk is aborted, causing
master not to be returned even though it should.

Bug: 425674
Change-Id: I2c0c406ce5fcc9a03538b483473af930d4895d30
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-11 22:43:35 +01:00
Robin Rosenberg 1b5bb265dc Length of symbolic link is the number of bytes, not characters
Change-Id: I6b615f0d5da4339f1f23a29bcaeb80f0346f5764
2014-02-10 23:29:25 +01:00
Robin Rosenberg 7c19c45544 Add delete support to FS
Change-Id: Ib6f6fd5ef4a0c9b2062445ac4a0c9d1131e401bf
2014-02-10 23:29:24 +01:00
Robin Rosenberg 50a19fcdef Dynamically detect if Windows supports symbolic links
To get symlink support you typically need to run as administrator.

Change-Id: I394ea75bc2f250c62f860e537a0af9e6380b3b38
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-10 23:07:28 +01:00
Robin Rosenberg 078a9f6066 Add symlink support to JGit
The change includes comparing symbolic links between disk and index,
adding symbolic links to the index, creating/modifying links on
checkout. The behavior is controlled by the core.symlinks setting, just
as C Git does. When a new repository is created core.symlinks will be
set depending on the capabilities of the operating system and Java
runtime.

If core.symlinks is set to true, the assumption is that symlinks are
supported, which may result in runtime errors if this turns out not to
be the case.

Measuring the cost of jgit status on a repository with ~70000 files,
of which ~30000 are tracked reveals a penalty of about 10% for using
the Java7 (really NIO2) support module.

Bug: 354367
Change-Id: I12f0fdd9d26212324a586896ef7eb1f6ff89c39c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-10 22:53:33 +01:00
Robin Rosenberg 5ef6d69532 Use the new FS.exists method in commonly occuring places
Allegedly this should improve performance, but I could not see it.

Change-Id: Id2057cb2cfcb46e94ff954483ce23f9c4a7edc5e
2014-02-10 11:26:57 +01:00
Robin Rosenberg 239f237be2 Fix deprecated WTI#isModified
We should really pass the forceContentCheck parameter to
the real method.

Change-Id: I9ea439cf6340a18d0e931edde3b9e3486cafde93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-10 11:26:53 +01:00
Robin Rosenberg ff83f54d29 Failing to delete a directory with untracked content is actually ok
We had a test, but it was wrong.

Bug: 424630 
Change-Id: I926e0954c8623a323a50fe8be3ebe5e0ac6944c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-10 11:25:02 +01:00
Robin Rosenberg e03f18941f Ban dangerous ref names in Windows
Bug: 423551 
Change-Id: I3e71ef1b4a8181f46d2902c9169859f150cd6ad0
Also-By: Robin Stocker <robin@nibor.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-05 10:47:12 +01:00
Matthias Sohn 08fd639c0d Merge "Reset internal state canonical length in WorkingTreeIterator when moving" 2014-02-04 03:03:27 -05:00
Shawn Pearce 8ae6295007 Merge "Fix MissingObjectException race in ObjectDirectory" 2014-02-03 18:05:39 -05:00
Shawn Pearce d1aacc415a Fix MissingObjectException race in ObjectDirectory
Johannes Carlsson identified a race condition[1] that can lead to
spurious MissingObjectExceptions at read time. If two threads are
active inside of ObjectDirectory looking for a packed object and the
packList is currently the empty NO_PACKS list, thread A will find
no object and eventually consider tryAgain1(). If thread A is put
to sleep and this point and thread B also does not find the object,
loads the packs, when thread A wakes up its tryAgain1 would return
false and the thread never considers the packs.

Rework the internal API of ObjectDirectory to keep a handle on the
exact PackList that was iterated by thread A, allowing it to always
retry walking through the packs if the new PackList is different.

This had some ripple effect into the CachedObjectDirectory and
the shared FileObjectDatabase interface. The new code should be
slightly easier to follow, especially from the perspective of the
CachedObjectDirectory trying to minimize the number of open system
calls it makes to files matching "$GIT_DIR/objects/??/?x{38}".

[1] http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02401.html

Change-Id: I9a1c9d6ad6cb38404b7b9178167b714077561353
2014-02-03 14:19:32 -08:00
Robin Rosenberg 871ee53b52 Reset internal state canonical length in WorkingTreeIterator when moving
Bug: 426514
Change-Id: Ifb75a4fa12291aeeece3dda129a65f0c1fd5e0eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-02-03 14:51:11 +01:00
Robin Rosenberg 5404e70dc6 Fix for core.autocrlf=input resulting in modified file
This version does not attempt to unsmudge, unlike the first attempt
in Idafad150553df14827eccfde2e3b95760e16a8b6.

Bug: 372834
Change-Id: I9300e735cb16d6208e1df963abb1ff69f688155d
Also-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-02-02 13:16:19 +01:00
Christian Halstrick 8352d1729c Add a missing since tag
Otherwise you get errors if you want to edit JGit in Eclipse

Change-Id: I840d4388f159e2db27845a17030b511fc5708f43
2014-01-30 15:23:56 +01:00
Shawn Pearce abadbabdc5 Merge "Fix serving fetch of existing shallow client" 2014-01-29 14:56:20 -05:00
Shawn Pearce b0174a089c Fix serving fetch of existing shallow client
In certain cases a JGit server updating an existing shallow client
selected a common ancestor that was behind the shallow edge of
the client. This allowed the server to assume the client had some
objects it did not have and allowed creation of pack deltas the
client could never inflate.

Any commit the client has advertised as shallow must be treated
by UploadPack server as though it has no parents. With no parents
the walker cannot visit graph history the client does not have,
and PackWriter cannot consider delta base candidates the client
is lacking.

Change-Id: I4922b9354df9f490966a586fb693762e897345a2
2014-01-28 17:29:00 -08:00
Matthias Sohn 85499f3888 Update Kepler target platform to use Kepler SR2 orbit R-build
Change-Id: I3c215b8bbb6497b59d20c9fe7684a0c3522636e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-24 22:30:28 +01:00
Matthias Sohn b9a06212e1 Add missing @since tags
Change-Id: I16d82499d7d000096de6bd4bd08e406073557162
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-20 09:29:10 +01:00
Matthias Sohn ba15d82b91 Update API version to check changes against to 3.2.0.201312181205-r
Change-Id: Ifb0a87a2b268a8bf3dc11310bfd6af18e242693c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-20 09:29:09 +01:00
Matthias Sohn 5ff3251d02 Update Luna target platform to use Luna M5 orbit repository
See http://dev.eclipse.org/mhonarc/lists/orbit-dev/msg03647.html

Change-Id: Id10cd2e0b1aaba181b68f6ac30e0fc64fb714481
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-20 09:11:53 +01:00
Matthias Sohn 75b31767c4 Do not report ignored directories as untracked
Change-Id: I7e3f6b9fb1ac4b99d2cc9a78c63aad86f4fa5744
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-19 00:20:42 +01:00
SATO taichi 2f425cf30c Add git checkout --orphan implementation
Change-Id: I7bb583674641efed210d3cd5b86af27d7bb48e97
Signed-off-by: SATO taichi <ryushi@gmail.com>
2014-01-17 15:37:39 +09:00
Stefan Lay 3db6e05e52 Fix fast forward rebase with rebase.autostash=true
The folder .git/rebase-merge was not removed in this case. The
repository was then still in rebase state, but neither abort nor
continue worked.

Bug: 425742
Change-Id: I43cea6c9e5f3cef9d6b15643722fddecb40632d9
2014-01-15 13:23:49 +01:00
Matthias Sohn 50a830f7d4 Update target platforms to use latest orbit build
- use latest I-build for Luna
- use latest M-build for Kepler

Change-Id: I5b85306058877b19eae4cf5a820fe50cdd200c1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-15 00:22:43 +01:00
Matthias Sohn c6194c7bc9 Update com.jcraft.jsch to 0.1.50 in Kepler target platform
Bug: 425660
Change-Id: I758b34d0486a88036da8327da6ef43385c62fd46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-14 18:16:59 +01:00
Jonathan Nieder 36a85783f3 Update commons-compress to 1.6
Includes various fixes, including
  o Writing TAR PAX headers failed if the generated entry name ended
    with a "/".
    Issue: COMPRESS-203.
which has been happening in the wild (java.io.IOException: request to
write '120' bytes exceeds size in header of '0' bytes for entry
'./PaxHeaders.X/hostsidetests/appsecurity/test-apps/AppAccessData/[...]/').

TODO: update orbit repository URL when new Orbit R-build is available,
see bug 425660

Change-Id: I92a87543a6ace9a06a70a29534399608cee6adb1
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-14 18:16:58 +01:00
Tomasz Zarna 0a38e08c1c fix link to EWAHCompressedBitmap in javadoc of SimpleDataInput/Output
Change-Id: Iaa07bb23f163b75e222bc6a5ce3acc91ffef435e
Signed-off-by: Tomasz Zarna <tomasz.zarna@tasktop.com>
2014-01-14 10:19:50 +01:00
Colby Ranger ce5fd525be Upgrade javaewah to version 0.7.9
Package was renamed, so I had to update the imports. Also, I verified
bitmap serialization was still compatible.

Change-Id: I161ad3875b963b56001beab477ef8d072accee4f
2014-01-13 11:47:58 -08:00
Robin Rosenberg 4ceb25b602 Tag som non-localizable strings with NON-NLS
Change-Id: I6882c98c2785f38241a81ba5b93892aab79690a5
2014-01-10 14:06:50 +01:00
Matthias Sohn 25fe20b2db Add missing package import for org.eclipse.jgit.archive
The archive bundle needs access to the nls package since 2ecc27db.

Change-Id: I76882e1f270296c5ce8e220e1946c4a8ddb6fdf5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-07 09:22:12 +01:00
Matthias Sohn 74e3fde959 Remove unused import from ArchiveTest
This unnecessary import was introduced by 2ecc27d.

Change-Id: I5cb415de7e33428d9f95dfbe1e214ef24be9dad9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-01-07 09:22:11 +01:00
Robin Rosenberg ed7e1eff07 Suppport the GIT_CONFIG_NOSYSTEM environment variable
Change-Id: If3cc05931683d396b5ae2ea8952adceeb9a82ab9
2014-01-06 18:49:37 +01:00
Dave Borowitz b0d9c57f35 Merge "archive: Use an empty directory for submodules" 2013-12-27 12:30:07 -05:00
Dave Borowitz ab6ab5167d Merge "archive: Include entries for directories" 2013-12-27 12:29:37 -05:00
Jonathan Nieder 8a4cf2e0f8 archive: Use an empty directory for submodules
When encountering a submodule entry, "jgit archive" tries to write its
content verbatim as an entry to the archive, which fails with a
JGitInternalException wrapping a MissingObjectException because the
submodule repository commits are typically not part of the
superproject.

When a subproject is available (for example because it has been
checked out as a subdirectory of a superproject worktree), it would be
nice to recurse into it and make one archive recording the state of
the entire project.  Unfortunately sometimes the subproject is not
available or it can be hard to find (e.g., it can be on another
server).  Even when some subprojects are available, "jgit archive"
should not produce different output for the same tree depending on
which subprojects it has easy access to, so there is no obvious good
default behavior that recurses without relying on access to all
subprojects.

Instead, replace each submodule entry with a placeholder empty
directory.  "git archive" does the same.

Change-Id: I1295086037b77fc948b3f93c21d47341e25483e5
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-12-27 09:02:53 -08:00
Jonathan Nieder 2ecc27db92 archive: Include entries for directories
Entries for directories are optional and mostly wasted space in most
archive formats (except as a place to hang ownership and filesystem
permissions), but "git archive" includes them.  Follow suit.

This will make it easier in a later change to include empty
directories as placeholders for missing submodules.

Change-Id: I1810c686bcc9eb4d73498e4d3e763e18787b088a
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-12-27 08:55:39 -08:00
Matthias Sohn 2a50e7065c [CLI] Add option --millis / -m to debug-show-dir-cache command
This is useful when comparing mtime displayed by 
    $ jgit debug-show-dir-cache -m
with mtime displayed by 
    $ git ls-files --debug 
or 
    $ stat "%m"

Change-Id: Id133ebe6f6093a56a6a6645e1c5bb18752fb2fd0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-27 12:22:47 +01:00
Matthias Sohn 80be72d2c1 Merge branch 'stable-3.2'
* stable-3.2:
  Prepare post 3.2.0 builds
  JGit v3.2.0.201312181205-r
  Revert "Fix for core.autocrlf=input resulting in modified file..."
  Fix for core.autocrlf=input resulting in modified file and unsmudge

Change-Id: I6650642c3511f5a41d673e561fec8204208d428d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-19 15:46:23 +01:00
Matthias Sohn f839d383e6 Prepare post 3.2.0 builds
Change-Id: Ie2bfdee0c492e3d61d92acb04c5bef641f5f132f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-18 21:16:37 +01:00
Matthias Sohn 699900c308 JGit v3.2.0.201312181205-r
Change-Id: Id00a8baf7d3ffefb210f03cd99f69d55411166fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-18 18:05:20 +01:00
Matthias Sohn 0ff691cdb5 Revert "Fix for core.autocrlf=input resulting in modified file..."
This reverts commit 1def0a1257.

We found this fix uncovers problems with unsmudged DirCacheEntry's. This
surfaced because egit's ui test CreatePatchActionTest failed since jgit
computes a wrong status. JGit doesn't detect modified content in now
unsmudged entries. Hence revert this change until these problems are
fixed.

Change-Id: Ia04277ce316d35fc5b0d82c93d2078b856af24bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2013-12-18 15:36:02 +01:00
Robin Rosenberg 1def0a1257 Fix for core.autocrlf=input resulting in modified file and unsmudge
Bug: 372834
Change-Id: Idafad150553df14827eccfde2e3b95760e16a8b6
Also-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-18 00:27:47 +01:00
Jonathan Nieder f2abbd0ea9 archive: Prepend a specified prefix to all entry filenames
Common practice when distributing tarballs is to prefix all entries
with a single directory name so when the tarball is extracted it all
falls neatly into a single directory.  Add a setPrefix() method to
ArchiveCommand to support this.

Change-Id: I16b2832ef98c30977f6b77b646728b83d93c196f
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-12-17 11:22:46 -08:00
Matthias Sohn aad7dee3ef Merge branch 'stable-3.2'
* stable-3.2:
  Canonicalize worktree path in BaseRepositoryBuilder if set via config
  Add missing @since tags for new public methods in Config
  Don't use API exception in RebaseTodoLine
  Fix aborting rebase with detached head
  Add recursive variant of Config.getNames() methods
  Prepare post 3.2.0-m3 builds
  JGit v3.2.0.201311130903-m3

Change-Id: Iad6e284e0fe2c7950f156372b334e47ebd82f3f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-13 12:55:59 +01:00
Robin Stocker 0ce61caefb Canonicalize worktree path in BaseRepositoryBuilder if set via config
This is the case for submodules in .git/modules, which typically have a
worktree config of "../../../dir". This can confuse callers, which e.g.
try to call Repository.stripWorkDir with it.

Bug: 423644
Change-Id: I0c00953f73f9316a66d0fc10eab52d8779c88f00
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-12 02:21:41 +01:00