Kevin Sawicki [Wed, 8 Feb 2012 22:10:28 +0000 (23:10 +0100)]
Support gitdir references in working tree .git file
A '.git' file in a repository's working tree root is now parsed
as a ref to a folder located elsewhere. This supports submodules
having their repository location outside of the parent repository's
working directory such as in the parent repository's '.git/modules'
directory.
This adds support to BaseRepositoryBuilder for repositories created
with the '--separate-git-dir' option specified to 'git init'.
Change-Id: I73c538f6d845bdbc0c4e2bce5a77f900cf36e1a9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Tomasz Zarna [Fri, 20 Jan 2012 23:15:03 +0000 (00:15 +0100)]
Workaround incompatible refactoring in Jetty 7.6.0
In Jetty 7.6 package org.eclipse.jetty.http.security was renamed to
org.eclipse.jetty.util.security [1] breaking compatibility.
Compare docs for the package in 7.5.4 [2] and missing part in 7.6.0 [3].
To fix until we switch to Jetty 8, restrict the maximum version to 7.6.0
exclusive.
Kevin Sawicki [Tue, 17 Jan 2012 17:35:29 +0000 (09:35 -0800)]
Support relative submodule URLs on init/add/sync
Interpret submodule URLs that start with './' or '../' as
relative to either the configured remote for the HEAD branch,
or 'origin', or the parent repository working directory if no
remote URL is configured
Robin Stocker [Mon, 16 Jan 2012 21:33:03 +0000 (22:33 +0100)]
Add BranchTrackingStatus for getting remote tracking status
This is used by EGit change I1e1caca561d1b0a0c194bfc42e64b698f42c6e6a to
show branch status in decoration.
It can also be used for providing the same output as C Git in "git
status".
Change-Id: I8d2b108c89905c3f0496f3d517879596740787c0 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Robin Stocker [Mon, 16 Jan 2012 21:18:54 +0000 (22:18 +0100)]
Add BranchConfig helper for access to branch config section
Getting the name of the remote-tracking branch given a branch is not so
easy to get right. This class provides a way to do that and could be
used for more branch config related things (e.g. in PullCommand).
Change-Id: I896a2384217936c8b672df8b81c9599f5c350458 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Robin Stocker [Mon, 16 Jan 2012 21:05:20 +0000 (22:05 +0100)]
Add RevWalkUtils with count(start, end) method
It returns the number of commits that are in start and not in end.
Useful for calculating how much a branch is ahead of another one.
Change-Id: I09f7d9b049beea417da7ff32c9f8bf0d4ed46a7f Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Robin Rosenberg [Mon, 31 Oct 2011 22:30:11 +0000 (23:30 +0100)]
Support more of AutoCRLF
This patch introduces CRLF handling to the DirCacheCheckout and
WorkingTreeIterator supporting the AutoCRLF for add, checkout
reset and status and hopefully some other places that depende
on the underlying logic of the affected API's.
The patch includes test cases for the Status command provided by
Tomasz Zarna for bug 353867.
The core.eol and core.safecrlf options are not yet supported.
Kevin Sawicki [Mon, 9 Jan 2012 16:46:13 +0000 (08:46 -0800)]
Provide helper for unlocking a file
This will allow recovery from a LockFailedException where
the file associated with an exception is passed to FileUtils.unlock
to attempt an unlock on the file so the operation can be retried
Matthias Sohn [Sun, 8 Jan 2012 21:08:08 +0000 (13:08 -0800)]
Narrow exceptions declared by LsRemoteCommand
API commands either throw GitAPIException or JGitInternalException.
Also add missing javadoc and reduce nesting of catch blocks.
Change-Id: I9a3b302e1b3f373ee11a977a0e3d6213bfbd3cdf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Kevin Sawicki <kevin@github.com>
Kevin Sawicki [Tue, 3 Jan 2012 23:07:02 +0000 (15:07 -0800)]
Retain executable mode of existing files on Windows
Currently files in a repository marked as executable will have
that mode unset when modified and committed on systems that
do not support detection of this mode since the working tree
iterator will never report this mode for any entries.
This change updates WorkingTreeIterator to be able
to determine the target file mode to be used for the index
through consideration of the configured WorkingTreeOptions.
The places where ResolveMerger was doing content merges have been
refactored. The goal was to have one single method where content merge
was done and to factor out other topics (updating the index, updating
the working tree) into own methods. This was done to allow adding
pluggable content mergers in change
I7817e2123d254f3eeb315b47a61d2c55bd202c12
Change-Id: I8529697b197372a284bcd5ab2c9ba1adb925a520 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Kevin Sawicki [Tue, 13 Dec 2011 01:49:09 +0000 (17:49 -0800)]
Add exception class for when locking a file fails
This will allows calling classes to handle lock failures
without checking against the message and will also provide
access to the file that could not be locked.
Kevin Sawicki [Sat, 17 Dec 2011 01:05:42 +0000 (17:05 -0800)]
Support resolving integer-based reflog revisions
Revision strings such as 'master@{0}' can now be resolved
by Repository.resolve by reading the reflog for the ref and
returning the commit for the entry number specified.
This still throws an exception for cases not supported
such as 'master@{yesterday}'.
Matthias Sohn [Fri, 16 Dec 2011 07:49:59 +0000 (08:49 +0100)]
Merge branch 'stable-1.2'
* stable-1.2:
Add API checking using clirr
Fix MergeCommandTest to pass if File.executable is not supported
Fix ResolveMerger not to add paths with FileMode 0
Change-Id: I86e7194a40acd6dfa3d433f1d17c01bdf5bb0d9c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Robin Rosenberg [Fri, 16 Dec 2011 00:01:36 +0000 (01:01 +0100)]
Enforce the use of Java5 API:s only (with a few exceptions)
This only works with Eclipse 3.6 and newer and requires installation
of new package. Documentation is not very good, but there is a blog
about it here:
http://eclipseandjazz.blogspot.com/2011/10/of-invalid-references-to-system.html
API checking is especially useful on OS X where Java5 is not readily
available.
Change-Id: I3c0ad460874a21c073f5ac047146cbf5d31992b4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Fix ResolveMerger not to add paths with FileMode 0
When ResolveMerger finds a path where it has to do a content merge it
will try the content merge and if that succeeds it'll add the newly
produced content to the index. For the FileMode of this new index entry
it blindly copies the FileMode it finds for that path in the common base
tree. If by chance the common base tree does not contain this path it'll
try to add FileMode 0 (MISSING) to the index.
One could argue that this can't happen: how can the ResolveMerger
successfully (with no conflicts) merge two contents if there is no
common base? This was due to another bug in ResolveMerger. It failed to
find out that for two files which differ only in the FileMode (e.g. 644
vs. 755) it should not try a content merge.
Change-Id: I7a00fe1a6c610679be475cab8a3f8aa4c08811a1 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Matthias Sohn [Sat, 10 Dec 2011 00:06:47 +0000 (01:06 +0100)]
Merge branch 'stable-1.2'
* stable-1.2:
Fix version.sh
Throw API exception when MergeCommand hits checkout conflicts
Add methods for configuring platform emulation
Fix history rendering not to occupy too many lanes
Fix History rendering
Change-Id: If71cc760423ae2b76c7435ca4830edc1745556de Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Thu, 8 Dec 2011 22:33:53 +0000 (23:33 +0100)]
Throw API exception when MergeCommand hits checkout conflicts
When MergeCommand hit checkout conflicts it did throw an internal JGit
exception org.eclipse.jgit.errors.CheckoutConflictException instead of
org.eclipse.jgit.api.errors.CheckoutConflictException which it
declares to throw. Hence translate the internal exception to the
exception declared in the API.
Bug: 327573
Change-Id: I1efcd93a43ecbf4a40583e0fc9d8d53cffc98cae Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Kevin Sawicki [Tue, 6 Dec 2011 18:00:28 +0000 (10:00 -0800)]
Throw invalid ref exception instead of invalid remote exception
ReflogCommand command was throwing an incorrect exception type
when an IOException was wrapped and rethrown from the underlying
ReflogReader. The IOException cause is now provided to the thrown
exception as well.
Robin Rosenberg [Tue, 6 Dec 2011 23:42:35 +0000 (00:42 +0100)]
Force jgit.sh to use UTF-8 encoding on Mac
For some obscure reason the platform encodng in Java on Macs
is MacRoman. OS X used UTF-8 as the default encoding so set
the encoding property in jgit.sh.
Fix history rendering not to occupy too many lanes
There was a bug in history rendering which caused jgit to use too
many lanes in case lanes get repositioned. Looking at commit 90c11cbaeb83ee9b02238cbd2c0e5bcf68068772 in JGit was one example. Vadim
Dmitriev found the problem and the solution.
There was the possibility that during history rendering we draw a lane
"trough" a passed commit. Vadim Dmitriev found that out in bug 335818.
I added the needed check to that block of code where it was missing.
Bug: 335818
Change-Id: Ic944193b2aca55ff3eb0235d46afa60b7896aa0f Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>