Commit Graph

3175 Commits

Author SHA1 Message Date
Matthias Sohn 792d27ece1 Fix version.sh to update Eclipse-SourceBundle version
The version attribute of Eclipse-SourceBundle must match
the bundle version.

Change-Id: Ic629ccae1d89c9070e4ec80420a0e2ed7d403922
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-04-18 01:40:47 +02:00
Shawn Pearce 6de12836d7 blame: Reduce running time ~4.5% by skipping common subtrees
With this commit running blame on render_view_impl.cc[1] saves
about 644 ms over prior versions, reducing the time about 4.5%.

Large projects often contain strands of commits where no changes
are made to a particular subtree. Blame used to dive recursively
into these subtrees to look for the blob and check if its SHA-1
was changed. In chromium/src[1] only 20% of the commits modify
the content/renderer subtree relevant for the file.

The recursivePath is necessary to check for '/' and remember
if common subtree elimination should be attempted. When a file
lives within a subtree the extra cost to check for unmodified
subtrees saves time. However for files in the root tree the
extra work incurred by TreeWalk is not worthwhile and would
significantly increase overall running time.

Now typical running times from an otherwise idle desktop:

  real	0m13.387s  0m13.341s  0m13.443s
  user	0m15.410s  0m15.220s  0m15.350s

previously:

  real	0m14.085s  0m14.049s  0m13.968s
  user	0m15.730s  0m15.820s  0m15.770s

[1] 34d6e5c5b4/content/renderer/render_view_impl.cc

Change-Id: Ib16d684df7ffa034ee28def3fb22c797998d5b7b
2014-04-17 15:51:50 -07:00
Shawn Pearce 52500d3264 blame: Micro optimize blob lookup in tree
Avoid converting the raw mode to FileMode. This is an expensive
if-else-if sort of test to just check if the thing is a blob.
Instead test the bit mask directly, which is at least a few
instructions shorter.

The TreeWalk is already recursive and will auto-dive into any
subtrees found. isSubtree check is unnecessary, as is the loop,
as only one result will ever be returned by next().

Change-Id: I9fb25229ebed857469427bfbdf74aedebfddfac8
2014-04-17 15:51:50 -07:00
Shawn Pearce 5a4e34009b blame: Automatically increase commit abbreviation length
Ensure commit object names are unique by extending the default
abbreviation as long as necessary. This allows `jgit blame` to
more closely match the formatted output of `git blame` on large
histories like Gerrit Code Review's ReceiveCommits.java file.

Change-Id: I5f7c4855769ee9dcba973389df9e109005dcdb5b
2014-04-17 15:51:50 -07:00
Konrad Kügler 551f3a0fa5 Blame correctly in the presence of conflicting merges
Problem:
The BlameGenerator used the RevFlag SEEN to mark commits it had
already looked at (but not necessarily processed), to prevent
processing a commit multiple times. If a commit is a conflicting
merge that contains lines of the merge base, that have been deleted
in its first parent, either these lines or the lines untouched
since the merge base would not be blamed properly.

This happens for example if a file is modified on a main branch in an
earlier commit M and on a side branch in a later commit S. For this
example, M deletes some lines relative to the common base commit B,
and S modifies a subset of these lines, leaving some other of these
lines untouched.

Then side is merged into main, creating a conflict for these
lines. The merge resolution shall carry over some unmodified lines
from B that would otherwise be deleted by M. The route to blame
these lines is via S to B. They can't be blamed via M, as they
don't exist there anymore.

    Q
    |\
    | \
    | S
    | |
    M |
    | /
    |/
    B

Blaming the merged file first blames via S, because that is the
most recent commit. Doing so, it also looks at B to blame the
unmodified lines of B carried over by S into the merge result. In the
course of this, B is submitted for later processing and marked SEEN.

Later M is blamed. It notices that its parent commit B has been
SEEN and aborts processing for M. B is blamed after that, but only
for the lines that survived via S.

As a result, only the lines contributed by S or by B via S are
blamed. All the other lines that were unchanges by both M and S,
which should have been blamed to B via M, are not blamed.

Solution:
Don't abort processing when encountering a SEEN commit. Rather add the
new region list of lines to be blamed to those of the already SEEN and
enqueued commit's region list. This way when the B commit of the
above example is processed, it will blame both the lines of M and S,
yielding a complete blame result.

Bug: 374382
Change-Id: I369059597608022948009ea7708cc8190f05a8d3
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Shawn Pearce <spearce@spearce.org>
2014-04-17 14:05:51 -07:00
Jonathan Nieder d5110c32f9 Allow ArchiveCommand.registerFormat to be called twice
This should make it possible for the gitiles plugin to register its
archive formats after gerrit has already registered them.

Signed-off-by: Jonathan Nieder <jrn@google.com>
Change-Id: Icb80a446e583961a7278b707d572d6fe456c372c
2014-04-16 11:52:02 -07:00
Dave Borowitz 257546a08e Merge "Make ArchiveFormats final and implement equals()" 2014-04-14 16:41:44 -04:00
Matthias Sohn 7388955319 Merge branch 'stable-3.3'
* stable-3.3:
  Ensure that stored credentials aren't reset too early

Change-Id: Idcd57e12f5fe905952be49edb4f82db6b7ed469f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-04-14 01:20:18 +02:00
Matthias Sohn 1f83fe8545 Update Software User Agreement
Bug: 431255
Change-Id: I8a44028d8c48ddd1b9d2f9ef4af4d417c5454881
2014-04-14 01:12:40 +02:00
Matthias Sohn a53a18e988 Ensure that stored credentials aren't reset too early
Some commands are started without showing a dialog allowing to enter
credentials if needed. Hence we need to tolerate one failing HTTP
authentication to trigger loading credentials from the secure store.
Hence we should not immediately reset the stored credentials if the
first attempt to authenticate fails.

Bug: 431209
Change-Id: I1b9fa34c3d70be226bb1c59c9ebe995998d29bc8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-04-14 00:42:05 +02:00
Jonathan Nieder 0a14909bcf Make ArchiveFormats final and implement equals()
This should make it easier to modify ArchiveCommand to allow an
archive format to be registered twice while still noticing if
different callers try to register different implementations for
the same format.

Change-Id: I32261bc8dc1877a853b49e0da0a6e78921791812
Signed-off-by: Jonathan Nieder <jrn@google.com>
2014-04-11 14:01:56 -07:00
Robin Rosenberg 6654baddae Merge changes Id9a641dd,If2ee1f42
* changes:
  Added TestCase for 7d5e1f Fixed RevWalk.isMergedInto()
  Fixed RevWalk.isMergedInto() returning wrong results
2014-04-09 16:14:28 -04:00
Sven Selberg 0f8a18cfca Added TestCase for 7d5e1f Fixed RevWalk.isMergedInto()
Change-Id: Id9a641dd67c4182bb3a0dc83a6864fee43e7653f
Signed-off-by: Gustaf Lundh <gustaf.lundh@sonymobile.com>
Signed-off-by: Sven Selberg <sven.selberg@sonymobile.com>
2014-04-09 14:51:14 +02:00
Robin Rosenberg 4a11b7137f Fix ValidRefNameTest on Windows
There are certain ref names which native git can be create only on
non-windows systems (e.g. "refs/tags/>"). On Windows systems we can't
persist this refs because the ref names are not valid file names. Our
tests in ValidRefNameTest assumed that these are valid refs on all
systems. This broke the tests on Windows.

Change-Id: Ic53c396c88b84cbdf579a636953f7519952270c0
2014-04-06 12:16:41 -04:00
Robin Rosenberg ecade47a89 Fix FileTreeIteratorTest#testIsModifiedFileSmudged() on Windows
This would be a problem for any OS where Java lets the subscond
part through to the File API. The fix is to force the timetamp
of the index rather than trusting it to just happen to be right.

Bug: 430765
Change-Id: Id6b3ba003f58427a3ffaacd224649e2d6c93566b
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-04-06 12:16:20 -04:00
Robin Rosenberg fe397ad90f Don't use package private classes when overriding a public interface
Change-Id: If8522d4e02254766e3310a70e42badafa5ab9768
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-04-05 08:39:19 -04:00
Shawn Pearce ffb0f05d02 Mark getParent deprecated in CanonicalTreeParser
@deprecated in Javadoc must be accompanied by @Deprecated annotation
on the class member.

Change-Id: Ifdf787f496ff3ffd6ffe8f3321d56320cb08454f
2014-04-03 12:08:07 -07:00
Shawn Pearce 94330d9cb5 Fix ObjectChecker when normalization is enabled
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
2014-04-03 11:15:25 -07:00
Shawn Pearce 39904d6ad4 Abbreviate SHA-1s when reporting invalid objects
The full 40 digit name is rather long. In most cases an abbreviated
name should be sufficient.

Change-Id: Id16a37c6c745ede1fa0d97c5bc390491799500bc
2014-04-03 11:12:01 -07:00
Shawn Pearce 8924d4e0a0 Throw CorruptObjectException when a bad object is found
This makes it easier to identify higher in the call stack.

Change-Id: I829431c38c71fa1899e33916252b75f09db8ecbd
2014-04-03 11:12:01 -07:00
Matthias Sohn 90d743f834 Merge "Add missing space to invalid object error messages" 2014-04-03 13:54:15 -04:00
Shawn Pearce 8254c76025 Add missing space to invalid object error messages
"Invalid tree aa6f10291050a00de83b4630783030b9e3b969ec:duplicate entry names"

is hard to read. A space after the object name and before the message
makes the message more readable.

Change-Id: I96406100dbef8e4bc8fe2047d102681194dc8847
2014-04-03 10:13:30 -07:00
Guillaume Nodet 977596b209 Avoid calls to System.exit() and throw an exception instead
The exception is caught in Main and System.exit() is called.

Bug: 413522
Change-Id: Ibe68f7104d4fd55b832000a7840c07a169e7dd58
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-04-02 00:15:15 +02:00
Guillaume Nodet c0574fe680 Add an input stream and an error stream to TextBuiltin base class
Leverage these streams to remove calls to System.in and System.err

Bug: 413522
Change-Id: I8396f3e273c93e23861e8bcfb2ab8182fb09220d
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-30 23:25:09 +02:00
Robin Rosenberg c8d2040722 Add launchers for running tests with Java 8
Change-Id: I91a7225cff350f11cc224129439622c7dfd9f4f3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-29 20:07:10 +01:00
Robin Rosenberg bb9a4850b5 Make sure we include the Java 7 module in tests when using JDK 8
Change-Id: Idfb3b16725d8f2ad25338dd0910fb1334c00cde4
2014-03-29 20:03:51 +01:00
Robin Rosenberg 32ff57a2b2 Cleanup javadocs so they pass the java8 doclint checks
Bug: 431552
Change-Id: I469316f5645205016e1fa6b0fbd2ff3b509b14bc
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-03-29 18:34:41 +01:00
Alexander Kurtakov 20fc105021 Allow full compiles on Java 8.
Make jgit.java6 and jgit.java7 activation based on ranges so modules in
jgit.java6 are enabled for Java 1.6+ and modules in jgit.java7 are
enabled for Java 1.7+. This enables full compiles on Java 8 and also
removes the need to list org.eclipse.jgit.console in both profiles.

Change-Id: Iabfcff18737ff435ba8d5e8efc7a581abc9a46ce
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2014-03-28 15:43:10 +02:00
Stefan Lay e56d50a94b Interactive rebase: Fix order of commit messages on squash
Bug: 431214
Change-Id: I295bfdc5751545b046d7fe7efc3f8b39ab4f5415
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Robin Rosennberg <robin.rosenberg@dewire.com>
2014-03-27 16:11:15 -04:00
Stefan Lay 6995069464 Fix missing NON-NLS tag in RebaseCommand
Change-Id: Ied3e7ec0d825416226cacb2f14d5bca003af36da
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2014-03-27 14:38:29 +01:00
Christian Halstrick 16436ef6d9 Fix GarbageCollection not to pack HEAD
When working on a non-bare repository with a detached HEAD jgit's GC was
packing the ref named "HEAD" into the packed-refs file and deleted the
loose ref (the file .git/HEAD!). This made the repo unusable for native
git. This is fixed by telling jgit to only pack refs starting from
"refs/"

Change-Id: I50018aa006f18b244d2cae2ff78b5ffe1b821d63
2014-03-26 15:27:48 +01:00
Dave Borowitz 27473d8e66 Fix NameRevCommand when repo has no annotated tags
Previously, calling addAnnotatedTags() did not modify any state when
there were no annotated tags in the repository. This caused the code
to assume no addFoo() methods had been called, and fell back to the
default of adding refs/*. Instead, use null to indicate neither
addRefs() nor addAnnotatedTags() was called.

Add a test for this behavior.

Change-Id: I9926e5ac17e1a983cd399798993031c72bd79c2c
2014-03-25 18:39:48 -07:00
Matthias Sohn 5c1736a8d8 Merge branch 'stable-3.3'
* stable-3.3:
  Prepare 3.3.2-SNAPSHOT builds
  JGit v3.3.1.201403241930-r
  Retry to call credentials provider if http authentication failed
  Ensure that ssh authentication is retried only in JGit
  [findBugs] Ensure streams are closed in a finally block
  Update com.jcraft.jsch to 0.1.50 also in pom dependencies

Change-Id: I45b48a3f2dc8c7708e9518645d72bc5645002836
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-25 11:04:29 +01:00
Matthias Sohn 5073000c3f Prepare 3.3.2-SNAPSHOT builds
Change-Id: I48271980a258acd0ada7c418b24c61c1bf0a0cd2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-25 09:19:36 +01:00
Matthias Sohn f3f2060b5c JGit v3.3.1.201403241930-r
Change-Id: Ib317903898095d205f0b6ed4cead62ff6eabd894
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-25 00:36:03 +01:00
Gustaf Lundh 7d5e1f8497 Fixed RevWalk.isMergedInto() returning wrong results
Under certain circumstances isMergedInto() returned
false even though base is reachable from the tip.
This will hinder pushes and receives by falsely
detecting "non fast forward" merges.

      o---o---o---o---o
      /                 \
     /   o---o---A---o---M
    /   /
---2---1-

if M (tip) was compared to 1 (base), the method
isMergedInto() could still return false, since
two mergeBases will be detected and the return
statement will only look at one of them:

  return next() == base;

In most cases this would pass, but if "A" is
a commit with an old timestamp, the Generator
would walk down to "2" before completing the
walk pass "A" and first finding the other
merge base "1". In this case, the first call to
next() returns 2, which compared to base evaluates
as false.

This is fixed by iterating merge bases and
returning true if base is found among them.

Change-Id: If2ee1f4270f5ea4bee73ecb0e9c933f8234818da
Signed-off-by: Gustaf Lundh <gustaf.lundh@sonymobile.com>
Signed-off-by: Sven Selberg <sven.selberg@sonymobile.com>
2014-03-24 18:41:48 +01:00
Matthias Sohn 8598fe3d2b Retry to call credentials provider if http authentication failed
If the user provided wrong credentials or credentials changed we
shouldn't give up immediately but retry to get valid credentials from
the credentials provider. Reset the credentials provider if
authentication failed to avoid it reuses wrong credentials in
case it stored them in a persistent store.

Bug: 338048
Bug: 342592
Bug: 427735
Change-Id: Ibd62ef3da17be6454991c43f524c8bbc7ca3c37e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-20 00:56:21 +01:00
Matthias Sohn b45094f722 Update build to use Tycho 0.20.0
Change-Id: I96d279d45ca9e31a1031b25cb4e5650e1d5525ea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-18 00:07:38 +01:00
Christian Halstrick fc9b1fbf6b Ensure that ssh authentication is retried only in JGit
JGit wants to control retries during ssh authentication. But JSch by
default already retries 6 times. Hence disable retries in JSch. Without
this the credentials provider isn't reset if e.g. wrong credentials are
specified.

Bug: 430210
Change-Id: I6fa726a14a84b06411e7010608c7a1e2bfb8bfe8
2014-03-15 04:27:53 -04:00
Matthias Sohn f43b7d6075 Merge "Fix text alignment in history plot renderer" 2014-03-13 18:56:40 -04:00
Rüdiger Herrmann 24921e12d0 Fix text alignment in history plot renderer
When more than one lane is drawn, some commits are vertically misaligned
(off by two pixels). This change fixes the alignment.

Bug: 426047
Change-Id: Icbe7ce9f5a6b281b2aaab66e4d76dfc1010b2fb5
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-03-13 23:39:36 +01:00
Shawn Pearce f716ad6d54 Fix StackOverflowError in RevCommit.carryFlags on deep side graphs
Copying flags through a graph with deep side branches can cause
StackOverflowError. The recursive step to visit the 2nd parent of
a merge commit can overflow the stack if these are themselves very
deep histories with many branches.

Rewrite the loop to iterate up to 500 recursive steps deep before
unwinding the stack and running the remaining parts of the graph
using a dynamically allocated FIFORevQueue.

This approach still allows simple graphs that mostly merge short
lived topic branches into master to copy flags with no dynamic
memory allocation, relying only on temporary stack extensions.
Larger more complex graphs only pay the allocation penalities
if copying has to extend outwards "very far" in the graph, which
is unlikely for many coloring based algorithms.

Change-Id: I1882e6832c916e27dd5f6b7602d9caf66fb39c84
2014-03-13 12:59:46 -07:00
Shawn Pearce 4c3e7931ed Display progress while checking connectivity on push
Verifying 100 new objects are fully connected to the existing DAG
is usually very cheap. Checking the entire Linux kernel history is
fully connected when pushing it to a new repository can take 30-60
seconds. Display a progress counter during this time so the client
knows the server is still working.

Change-Id: Iababe3ee1d35cb82f2bef2f12da7a2ecd03282b0
2014-03-12 23:19:12 -04:00
Shawn Pearce 088e80315b Merge changes I1a225c1b,Ie4d5f082,I41f24363,I9440dd25,I170b6f64,I02e964d1,Iec6ce9e6,Ic700ea8f,Ic3042444,I90a1eaf2,I66eaee5c,Ib921dfd7
* changes:
  Allow configuration of receive pack's ObjectChecker through fsck.*
  Correct fetch to use fetch.fsckObjects and transfer.fsckObjects
  Default receive.fsckObjects to transfer.fsckObjects
  Allow ReceivePack callers to configure their own ObjectChecker
  Check for duplicate names after folding case in ObjectChecker
  Change DirCacheCheckout to verify path using ObjectChecker
  Reject mixed case .git on Mac OS in ObjectChecker
  Reject special Windows device names in ObjectChecker
  Allow an ObjectChecker to reject special characters for Windows
  Reject '.git' as a tree name in ObjectChecker
  Extract path segment check function in ObjectChecker
  Permit ObjectChecker to optionally accept leading '0' in trees
2014-03-12 23:18:32 -04:00
Shawn Pearce 3d412827e5 Allow configuration of receive pack's ObjectChecker through fsck.*
fsck.allowLeadingZeroFileMode may be set true to permit pushing
broken trees with leading '0' in the file mode.

fsck.safeForWindows may be set true to require new trees to have
only file names that are safe on the Windows platform.

fsck.safeForMacOS may be set true to require new trees to have
only file names that do not cause collisions or confusion on the
Mac OS platform.

Change-Id: I1a225c1b3cd13c0d1a0d43fffe79355c501f49b7
2014-03-12 17:15:42 -07:00
Shawn Pearce ced58a7cff Correct fetch to use fetch.fsckObjects and transfer.fsckObjects
git-core configures fsck during fetch using these two variables.
JGit use of fsck in fetch predates the usage in git-core and had
reused receive.fsckobjects, which does not match behavior.

Change-Id: Ie4d5f082258c4b2928c7ecc3780c6363fa587f34
2014-03-12 17:15:41 -07:00
Shawn Pearce a1a5218032 Default receive.fsckObjects to transfer.fsckObjects
ReceivePack should configure itself with receive.fsckObjects,
and if not defined, transfer.fsckObjects. This is the order
used by git-core.

Change-Id: I41f243633dacb606dbcc3132972f63bbaba174d1
2014-03-12 17:15:35 -07:00
Shawn Pearce d300609495 Allow ReceivePack callers to configure their own ObjectChecker
PackParser permits supplying a specific ObjectChecker instance.
Allow this to be passed through ReceivePack, giving the caller
more flexibility to configure the implementation.

Change-Id: I9440dd25588008626222f33bfd697f57c05b439e
2014-03-12 16:36:07 -07:00
Shawn Pearce 0aa682fc68 Check for duplicate names after folding case in ObjectChecker
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
2014-03-12 16:06:10 -07:00
Shawn Pearce e2f6378847 Change DirCacheCheckout to verify path using ObjectChecker
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
2014-03-12 16:06:10 -07:00