Commit Graph

2809 Commits

Author SHA1 Message Date
Matthew Spurrier 1383bdd5bc Make s3 domain dynamic to support different s3 regions
Change-Id: If8f9e85368c56d88bb6ae9efe1b3a29cc18cc1d5
Signed-off-by: Matthew Spurrier <matthew@spurrier.com.au>
2015-03-10 16:11:48 -07:00
Dave Borowitz 1e694f3847 RevWalk: Do not close reader passed explicitly to constructor
The RevWalk(ObjectReader) constructor is explicitly to handle the case
where the caller is responsible for opening and closing the reader.
The reader should only be closed when it was created in the
RevWalk(Repository) constructor.

Change-Id: Ic0d595dc8d10de79e87549546c6c5ea2dc617e9b
2015-03-10 15:27:53 -07:00
Dave Borowitz a91f87d9e1 RevWalk: Stop using deprecated ObjectReader#release()
Change-Id: If4d34f18352bd17467aeded6fd3478f29244657b
2015-03-10 15:24:53 -07:00
Christian Halstrick af3faa764f Merge "Add "--long" option to JGit describe" 2015-03-10 15:17:58 -04:00
Shawn Pearce 7ab6ffdf50 Remove AutoCloseable from internal PackFile and friends
PackFile is held by the block cache and cannot be auto closed in a
try-with-resources statement.  Remove the interface as JGit does
explicit management of the instances.

ObjectDatabase and RefDatabase are internal details of Repository
and are managed with the Repository. Marking them AutoCloseable
provides no value to the library or an application using the API.

Change-Id: Ibee19eadd66233e6666b601583daa1834a7778f1
2015-03-09 20:59:09 -04:00
Shawn Pearce ce3997344e PushCertificateParser: Fix check for blank line after header
Reference equality (!= or ==) cannot be used to check for
String equality. String objects are not necessarily interned
to the same instance.

Use .isEmpty() since the function only cares about an empty
string and does not need to test a specific string value.

Change-Id: If530cb59666a8196d57d2348c893706a517ea541
2015-03-09 17:30:08 -07:00
Shawn Pearce 8cf14cfdad Cleanup some push certificate related javadoc
Change-Id: I319ee4e99462598bf6a934b1efc7939bc4b057a5
2015-03-09 17:28:16 -07:00
David Pletcher fe7c556f34 Fix an invalid format string
The %x format specifier is not valid for a byte array.
This patch fixes a bug that would cause an IllegalFormatConversionException.

Change-Id: I025975eca7b2f10bbafa39f5519f8668e6536541
Signed-off-by: David Pletcher <dpletcher@google.com>
2015-03-09 15:47:01 -07:00
Christian Halstrick 0e3ddea1b0 Add "--long" option to JGit describe
Native git supports "git describe --long". This will enforce returning a
long description of a commit even if a tag is directly pointing to the
commit (in contrast to just returning the tag name as it is now). This
commit teaches JGits DescribeCommand and the describe command in the pgm
package to support "--long".

Bug: 460991
Change-Id: I65e179b79e89049c6deced3c71cb3ebb08ed0a8f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-09 13:48:04 -07:00
Matthias Sohn a8fb77853a Merge "Support for the commit-msg hook." 2015-03-02 18:17:57 -05:00
Shawn Pearce a75bd35fa4 Merge "Allow public access to PackIndex" 2015-03-02 16:28:35 -05:00
David Pletcher cc8c270c9b Allow public access to PackIndex
The index provides access to a list of objects in a pack.
This will be helpful for repository integrity checking.

Change-Id: I435eeeb3fe1b1f5632d40528936416e97491d412
Signed-off-by: David Pletcher <dpletcher@google.com>
2015-03-02 15:52:27 -05:00
Laurent Delaigue efeb02bf2b Support for the commit-msg hook.
This hook uses the file .git/COMMIT_EDITMSG to receive and potentially
modify the commit message.

Change-Id: Ibe2faadfb5d3932a5a3da2252d8156c4c04856c7
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-02 17:45:15 +01:00
Laurent Delaigue 26fd56f167 Refactored pre-commit hook to make it less invasive.
Hooks are now obtained via a convenient API like git commands, and
callers don't have to check for their existence.
The pre-commit hook has been updated accordingly.

Change-Id: I3383ffb10e2f3b588d7367b9139b606ec7f62758
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-03-02 15:33:30 +01:00
Dave Borowitz 12a55c3475 Add an in-process pack transport for use in tests
This allows for testing arbitrary sets of push/fetch hooks (e.g.
PreReceiveHook) without depending on either an external protocol (e.g.
HTTP) or the local filesystem.

Change-Id: I4ba2fff9c8a484f990dea05e14b0772deddb7411
2015-02-27 16:26:39 -08:00
Dave Borowitz 900d7da8ab Extract classes for transport within a JGit process
TransportLocal knows how to spin up a thread to allow two repositories
in the same process to communicate using the wire protocol. However,
it is still tied to local on-disk filesystems, and needs to be able to
fork processes if not using the default git-{upload,receive}-pack
implementation.

Extract out the connection classes so they can be used by other
transport implementations.

Change-Id: I5db59086740735508c2e70a597c2d1a89014b072
2015-02-27 15:22:15 -08:00
Matthias Sohn 360071d75d Add missing since tags for new API
Change-Id: I90d4d7566b2e220b8ea8ea1c644fe4b7fa81c0a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-27 02:33:05 +01:00
Matthias Sohn 1350f7ea1d Merge branch 'stable-3.7'
* stable-3.7:
  Prepare 3.7.1-SNAPSHOT builds
  JGit v3.7.0.201502260915-r
  Read user.name and email from environment first
  Provide more details in exceptions thrown when packfile is invalid

Change-Id: I427f861c6bc94da5e3e05dbbebbf0ad15719a323
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-27 01:54:12 +01:00
Matthias Sohn 9b486e3906 Prepare 3.7.1-SNAPSHOT builds
Change-Id: I2e97610ea9e552e5800e7ca895fd193c8bc507aa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-27 01:41:30 +01:00
Matthias Sohn a312131d79 JGit v3.7.0.201502260915-r
Change-Id: Iec17746cad81cfb1d775e782b30f9d8a13c938b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-26 15:13:01 +01:00
Christian Halstrick 1adac45550 Merge "Read user.name and email from environment first" into stable-3.7 2015-02-25 12:01:43 -05:00
Matthias Sohn 102c50e177 Add/fix since tags for new API for push certificates
This was missed in change I249869cadb2d55aef016371b9311b8583591b9cf

Change-Id: I19c9d4c04b6aa92b9e04c192dee70775d6985b58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-25 14:18:12 +01:00
Matthias Sohn d216ce4143 Merge branch 'stable-3.7'
* stable-3.7:
  Add log4j and slf4j-log4j bridge to jgit feature
  Use slf4j to log instead of printing to System.err
  Use Target Platform Definition DSL to generate target platforms

Change-Id: Ic8779868150c910fa55fd20348e35723e6add0f1
2015-02-24 23:45:19 +01:00
Matthias Sohn a8fd029a93 Read user.name and email from environment first
According to [1] user name and email are taken first from the
environment variables:
GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL

In case (some of) these environment variables are not set, the
information is taken from the git configuration.

JGit doesn not yet support the environment variables GIT_AUTHOR_DATE and
GIT_COMMITTER_DATE.

[1] https://www.kernel.org/pub/software/scm/git/docs/git-commit-tree.html#_commit_information

Bug: 460586
Change-Id: I3ba582b4ae13674cf319652b5b13ebcbb96dd8ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-24 16:39:19 +01:00
Stefan Beller b9725a54fd Port push certificates
Push certificates ("git push --signed") have been part of
git-core since version 2.2.0 (released Nov 26 2014). We also
want to support that feature.

This is not complete and is lacking the actual functionality
to validate the signature for now.

Change-Id: I249869cadb2d55aef016371b9311b8583591b9cf
Signed-off-by: Stefan Beller <sbeller@google.com>
2015-02-23 17:15:43 -08:00
David Ostrovsky c0c4c6f09a ArchiveCommand: Allow to pass options to underlying stream
Current ArchiveCommand design doesn't allow to pass in options to
underlying stream implementations. To overcome this, client has to
implement custom format implementation (it cannot be derived from
the existing one, because the classes are marked as final), and set
the options using ThreadLocal, before the method

  ArchiveOutputStream createArchiveOutputStream(OutputStream s)

is get called.

This change extends the ArchiveCommand.Format by allowing to pass
option map during creation of ArchiveOutputStream.

ArchiveCommand is extended correspondingly. That way client can
easily pass options to the underlying streams:

  Map<String, Object> level = ImmutableMap.<String, Object> of(
      "level", new Integer(9));
  new ArchiveCommand(repo)
      .setFormat("zip")
      .setFormatOptions(level)
      .setTree(tree)
      .setPaths(paths)
      .setPrefix(prefix)
      .setOutputStream(sidebandOut)
      .call();

Change-Id: I1d92a1e5249117487da39d19c7593e4b812ad97a
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2015-02-20 01:40:06 +01:00
Matthias Sohn 57644f23a1 Provide more details in exceptions thrown when packfile is invalid
Mention packfile path in exceptions thrown when we detect that a
packfile is invalid and make excplicit that corrupt packs are removed
from the pack list.

Change-Id: I454ada5f8e69307d3f34d1c1b8f3cb87607ddf35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-17 14:13:22 +01:00
Matthias Sohn c18694e0d1 Use slf4j to log instead of printing to System.err
CQ: 9206
Bug: 458445
Change-Id: Ic68fb7dbe0fb46bf30f157db45bf18d8f3a704c0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-17 01:06:17 +01:00
Matthias Sohn 77030a5e94 Implement AutoClosable interface on classes that used release()
Implement AutoClosable and deprecate the old release() method to give
JGit consumers some time to adapt.

Bug: 428039
Change-Id: Id664a91dc5a8cf2ac401e7d87ce2e3b89e221458
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-09 14:11:50 +01:00
Matthias Sohn 27ae8bc655 Implement AutoClosable interface to support try-with-resources block
Bug: 428039
Change-Id: I41880862db5303b5bea4b2184ba7844d69c997b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-09 14:11:50 +01:00
Matthias Sohn c26bc63ef1 Set minimum required Java version to Java 7
Bug: 458475
Change-Id: Iea8f2236d4e6a94a8d14bb8cc685006ea3fd1bb7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-09 14:11:50 +01:00
Matthias Sohn 21f667edba Merge branch 'stable-3.7'
* stable-3.7:
  Add option --orphan for checkout
  Prepare post 3.7.0.201502031740-rc1 builds
  JGit v3.7.0.201502031740-rc1
  Support for the pre-commit hook
  Fix FileUtils.testRelativize_mixedCase which failed on Mac OS X
  Add a hook test
  Introduce hook support into the FS implementations
  If a pack isn't found on disk remove it from pack list

Conflicts:
	org.eclipse.jgit.java7.test/META-INF/MANIFEST.MF

Change-Id: I936acd24d47b911fa30ab29856094e1b2c6ac3db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-04 14:21:52 +01:00
Matthias Sohn 3c2b4086b6 Prepare post 3.7.0.201502031740-rc1 builds
Change-Id: Id3728e771a4441757de016cc9d68055f668126b0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-04 02:04:47 +01:00
Matthias Sohn 8fe6e51be2 JGit v3.7.0.201502031740-rc1
Change-Id: Ia2ea65945b7e1d4120da3d6e6c9f6d5fdb642ae6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-03 23:36:31 +01:00
Laurent Goubet 494e893c54 Support for the pre-commit hook
Introduce support for the pre-commit hook into JGit, along with the
--no-verify commit command option to bypass it when rebasing /
cherry-picking.

Change-Id: If86df98577fa56c5c03d783579c895a38bee9d18
Signed-off-by: Laurent Goubet <laurent.goubet@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-02 21:23:32 +01:00
Laurent Goubet 6aed51e3ce Introduce hook support into the FS implementations
This introduces the background plumbing necessary to run git hooks from
JGit. This implementation will be OS-dependent as it aims to be
compatible with existing hooks, mostly written in Shell. It is
compatible with unix systems and windows as long as an Unix emulator
such as Cygwin is in its PATH.

Change-Id: I1f82a5205138fd8032614dd5b52aef14e02238ed
Signed-off-by: Laurent Goubet <laurent.goubet@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-02-02 10:22:53 +01:00
Matthias Sohn f5936405a3 If a pack isn't found on disk remove it from pack list
If accessing a pack throws FileNotFoundException the pack was deleted
and we need to remove it from the pack list. This can be caused e.g. by
git gc.

Change-Id: I5d10f87f364dadbbdbfb61b6b2cbdee9c7457f3d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-27 18:37:39 -05:00
Dave Borowitz 23ad3a3763 Add BatchRefUpdate#toString()
Change-Id: I58c342a91911763055c1073d2f426340fbf94fa4
2015-01-27 10:04:29 -08:00
Matthias Sohn 94ebdbfada Prepare 4.0.0-SNAPSHOT builds
Change-Id: I414ba8ccc82866d3107ba7083a567ea70c879bdf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-27 08:48:26 +01:00
Shawn Pearce 66cbf9255c Merge "Fix integer overflow in DiffFormatter when context is set to large int" 2015-01-27 00:53:04 -05:00
Shawn Pearce 9a2c506845 Merge "Handle invalid tree extensions" 2015-01-27 00:49:02 -05:00
Dave Borowitz d612468c5c InMemoryRepository: Ensure new ref targets exist in the repo
ObjectInserter recently learned to read back inserted objects before
they have been flushed. It is in general unsafe to create refs to such
objects, but it is now much more possible to do so, by passing "new
RevWalk(inserter.newReader())" into RefUpdate#execute(RevWalk).

We can't change the RefUpdate interface to remove execute(RevWalk);
nor would we necessarily want to, for performance reasons. And in any
case, RefUpdate#safeParse explicitly ignores MissingObjectExceptions.
But we can enforce object existence in InMemoryRepository, which will
allow callers using this class in their tests to ensure they are using
the RefDatabase correctly.

Change-Id: I5c696ba23bcd2a536a0512fa7f5b6130961905c5
2015-01-26 09:43:12 -08:00
Christian Halstrick 3d17be85ba Handle invalid tree extensions
In case the index contains wrong tree extensions don't throw a
ArrayIndexOutOfBounds exception but revalidate the tree extension.

It happened that the git index written by Git for Windows contained valid
(means entryCount>0) tree extensions for pathes which are not existing
in the index. Native git handles this inconsistency silently but JGit
was crashing with a ArrayIndexOutOfBounds exception. Teach JGit to
better recognize such cases and revalidate such extensions.

It's hard to write a test because JGit doesn't write such extensions. It
only reads, validates and makes use of them. But the bug tells how to
create such situations.

Bug: 457152
Change-Id: Id3ffd7dc7ae1c55674d88bf1b43953234fe0b68d
2015-01-26 11:16:53 +01:00
Christian Halstrick e314e42d41 Merge "Ensure GitCommand's "callable" guard is thread-safe" 2015-01-23 02:55:06 -05:00
Christian Halstrick 8f8724c857 Merge changes I05be0a5b,Ieee334f4
* changes:
  Document that repo returned by SubmoduleAddCommand needs to be closed
  Document that Git instance returned by CloneCommand needs to be closed
2015-01-23 02:54:33 -05:00
Matthias Sohn 83d7ea1988 Document that repo returned by SubmoduleAddCommand needs to be closed
Bug: 448570
Change-Id: I05be0a5b07f8e22f55637b9a3080362978368bcb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-22 17:25:06 +01:00
Matthias Sohn 9ffe6deced Silence non-externalized string warnings in RepoCommand
Change-Id: Ia25543c0d80817f8eb35c667ba5dcce046131a7c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-22 00:42:22 +01:00
Matthias Sohn 3623aa0c54 Document that Git instance returned by CloneCommand needs to be closed
Bug: 448570
Change-Id: Ieee334f4d82cd71ba98b26abb8667e8f64cac665
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-22 00:23:13 +01:00
Matthias Sohn 1a729bec9c Ensure GitCommand's "callable" guard is thread-safe
This way we can ensure that the same command instance can't be used
concurrently in multiple threads.

Bug: 458023
Change-Id: I4884a1ef2f609f9fb24dda4bd5819dffb9f174b6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-21 23:52:28 +01:00
Matthias Sohn e7f153bf3a Merge remote-tracking branch 'origin/stable-3.6'
* origin/stable-3.6:
  Prepare 3.6.3-SNAPSHOT builds
  JGit v3.6.2.201501210735-r
  Don't remove pack from pack list for problems which could be transient
  Log reason for ignoring pack when IOException occurred

Change-Id: I61141b52839511d58e5a5b193bfde31e9f444a6c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-21 22:27:46 +01:00
Matthias Sohn 58f3ecea9b Prepare 3.6.3-SNAPSHOT builds
Change-Id: Ie753dc77a23558d1993e959f48b7eb06557ea686
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-21 16:48:51 +01:00
Matthias Sohn debb1e25d1 JGit v3.6.2.201501210735-r
Change-Id: I483fc7bbff1561721cf621dc67ce4a193624fa64
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-21 13:43:30 +01:00
Matthias Sohn 27ee334213 Don't remove pack from pack list for problems which could be transient
If we hit a corrupt object or invalid pack remove the pack from the pack
list. Other IOException could be transient hence we should not remove
the pack from the list to avoid the problem reported on the Gerrit list
[1]. It looks like in the reported case the pack was removed from the
pack list causing MissingObjectExceptions which disappear when the
server is restarted.

[1] https://groups.google.com/forum/#!topic/repo-discuss/Qdmbl-YZ4NU

Change-Id: I331626110d54b190e46cddc2c40f29ddeb9613cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-21 02:14:34 +01:00
Frank Wagner e09e7c064e Fix RawText.getLineDelimiter() for empty first line
Bug: 456776
Change-Id: Iae50be89ea6d5aee33bd938a937ac5ca578aabca
Signed-off-by: Frank Wagner <frank.wagner@fr.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-17 23:28:20 +01:00
Matthias Sohn 9b86ebb4f6 Log reason for ignoring pack when IOException occurred
This should help to identify the root cause of the problem discussed on
the Gerrit list [1].

[1] https://groups.google.com/forum/#!topic/repo-discuss/Qdmbl-YZ4NU

Change-Id: I871f70e4bb1227952e1544b789013583b14e2b96
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-15 17:23:24 +01:00
Matthias Sohn 05078f5de1 Silence API warning raised since 7fafd372
This new git capability isn't yet in the wild in the git-core camp.
Hence we can silence this API warning.

Change-Id: I9e030959f658c58344b04ef2f9edd28060f0c964
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-13 16:44:15 +01:00
Stefan Beller 7fafd37298 Update atomic constant
The atomic feature is now cooking in -next in git-core. Very rarely
features are ejected from the the next branch in git-core, so I consider
it reasonable to come up with this patch now to make the 2 implementations
interoperable.

Change-Id: I806a8ae3c045ca5936f69cb903baf9b99ee39181
Signed-off-by: Stefan Beller <sbeller@google.com>
2015-01-12 16:49:21 -08:00
Arthur Daussy c185484dcf Add basic support for .gitattributes
Core classes to parse and process .gitattributes files including
support for reading attributes in WorkingTreeIterator and the
dirCacheIterator.

The implementation follows the git ignore implementation. It supports
lazy reading attributes while walking the working tree.

Bug: 342372
CQ: 9078
Change-Id: I05f3ce1861fbf9896b1bcb7816ba78af35f3ad3d
Also-by: Marc Strapetz <marc.strapetz@syntevo.com>
Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Also-by: Arthur Daussy <arthur.daussy@obeo.fr>
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2015-01-07 10:52:06 -08:00
Andrey Loskutov 428d31efd3 AIOOB in ChangeIdUtil.indexOfChangeId if amended message is a newline
Bug: 456792
Change-Id: Idf38a0db7dc72d672ff185dcac2f41f0012a6673
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2015-01-06 14:33:07 +01:00
Matthias Sohn 79dacba922 Merge branch 'stable-3.6'
* stable-3.6:
  Prepare 3.6.2-SNAPSHOT builds
  JGit v3.6.1.201501031845-r
  Trim author/committer name and email in commit header
  Rename detection should canonicalize line endings
  PathMatcher should respect "assumeDirectory" flag

Change-Id: Idd48c6d94cf1ab09abc07f70d50890b1b78e1833
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-04 02:18:27 +01:00
Matthias Sohn 741ebca8b7 Prepare 3.6.2-SNAPSHOT builds
Change-Id: I9699d84af2d4b5382d8ee88ed3517d6b91305421
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-04 01:19:35 +01:00
Matthias Sohn f1b2a5361f JGit v3.6.1.201501031845-r
Change-Id: I56e235a271f90ea2d8cdb7d99706f726d4a59c43
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-04 00:46:52 +01:00
Rüdiger Herrmann a4c2c8a3ee Trim author/committer name and email in commit header
C Git trims name and email before inserting them into the commit header
so that " A U Thor  " and "  author@example.com " becomes 
"A U Thor <author@example.com>" with a single separating space.

This changes PersonIdent#toExternalString() to trim name and email
before concatenating them.

Change-Id: Idd77b659d0db957626824f6632e2da38d7731625
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2015-01-03 00:28:15 +01:00
Marc Strapetz 1cb5668441 Rename detection should canonicalize line endings
Native Git canonicalizes line endings when detecting
renames, more specifically it replaces CRLF by LF.
See: hash_chars in diffcore-delta.c

Bug: 449545
Change-Id: Iec2aab12ae9e67074cccb7fbd4d9defe176a0130
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-01-02 23:23:22 +01:00
Andrey Loskutov c053900c5b PathMatcher should respect "assumeDirectory" flag
The path matcher should not fail if the rule ends with trailing slash,
target pattern does not ends with the slash and the "assumeDirectory"
flag is set.

E.g. */bin/ should also match a/bin if this pattern is threated as
directory by WorkingTreeIterator (FileMode.TREE).

The old code/tests have never tested directory rules with patterns
*without* trailing slashes but with the "assumeDirectory" flag set.
Unfortunately this is exactly what WorkingTreeIterator does... The tests
are changed to test *both* cases now (with trailing slash and without)
if the target pattern has trailing slash (represents directory).

Bug: 454672
Change-Id: I621c1644d9e94df3eb9f6f09c6de0fe51f0950a4
Also-by: Markus Duft <markus.duft@salomon.at>
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2014-12-28 02:03:08 +01:00
Matthias Sohn cdfd22da30 Prepare 3.7.0-SNAPSHOT builds
Change-Id: Ib3e7b5f46ee1e27b9cf25b3b2d01d681a5c4904c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-24 01:17:40 +01:00
Matthias Sohn 9882915810 Merge branch 'stable-3.6'
* stable-3.6:
  Prepare 3.6.1-SNAPSHOT builds
  JGit v3.6.0.201412230720-r
  [pgm] Add option --bare to clone command
  [pgm] Implement clone using CloneCommand
  Fix junit tests under windows when the platform is explicitly changed
  Fix unit tests for windows by explicitly closing test repos
  [pgm] Add option --tags for ls-remote
  [pgm] Add option --heads for ls-remote
  [pgm] Use LsRemoteCommand to implement ls-remote and add a test

Change-Id: I8f31e76cb7e9416919f37e02c7e51ab1d221df40
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-24 01:09:25 +01:00
Matthias Sohn 02b0660b8b Prepare 3.6.1-SNAPSHOT builds
Change-Id: Ie620c90ffafbffc6755b4e1ed55a61a15b118a2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-23 23:38:20 +01:00
Matthias Sohn b2ca2ffd7d JGit v3.6.0.201412230720-r
Change-Id: Ic28e2bbbdb1099e948c64a005c39f6b8d8ac69a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-23 13:56:43 +01:00
Christian Halstrick 3226e35db8 Fix junit tests under windows when the platform is explicitly changed
SystemReader used a chached ObjectChecker which was instantiated only
once. But in case of unit tests where we can change the platform
dynamically (e.g. MockSystemReader.setWindows()) this is wrong and
caused DirCacheCheckoutMaliciousPathTest.
testMaliciousAbsoluteCurDrivePathWindowsOnUnix() to fail. This change
allows 
user of SystemReader to force the creation of a new ObjectChecker. 
MockSystemReader.setWindows() and .setUnix() make use of this feature.

Change-Id: I87458d1dc63c1f5c18979f972b1c1f0d670a9ed8
2014-12-22 15:19:09 +01:00
Shawn Pearce 90cccb96d2 Merge branch 'stable-3.6'
* stable-3.6: (26 commits)
  JGit v3.5.3.201412180710-r
  JGit v3.4.2.201412180340-r
  ObjectChecker: Disallow names potentially mapping to ".git" on HFS+
  ObjectChecker: Disallow Windows shortname "GIT~1"
  ObjectChecker: Disallow ".git." and ".git<space>"
  Always ignore case when forbidding .git in ObjectChecker
  DirCache: Refuse to read files with invalid paths
  DirCache: Replace isValidPath with DirCacheCheckout.checkValidPath
  Replace "a." with "a-" in unit tests
  Support the new repository layout for submodules
  Allow explicit configuration of git directory in CloneCommand
  Allow explicit configuration of git directory in InitCommand
  Fix tests on windows by closing repos
  RepoCommand should close opened repos
  Fix LocalDiskRepositoryTestCase to create correct type of repos
  Prevent NPE if ref can't be resolved when executing ReflogCommand
  Fix DirCacheCheckout to set correct file length if core.autocrlf=true
  CheckoutCommand: Fix checking out ours/theirs when no base stage exists
  Make sure modifications to config-param trustFolderStat are detected
  Apache HttpClientConnection: replace calls to deprecated LocalFile()
  ...

Change-Id: Ife6f21d64a148dbb0d0d9055356b1568188806fe
2014-12-19 07:59:22 -08:00
Shawn Pearce 3f27b9135b Merge "Implement FileSnapshot.toString() to help debugging" 2014-12-19 10:55:24 -05:00
Matthias Sohn 75272ccdfc Merge branch 'stable-3.5' into stable-3.6
* stable-3.5:
  JGit v3.5.3.201412180710-r
  JGit v3.4.2.201412180340-r
  ObjectChecker: Disallow names potentially mapping to ".git" on HFS+
  ObjectChecker: Disallow Windows shortname "GIT~1"
  ObjectChecker: Disallow ".git." and ".git<space>"
  Always ignore case when forbidding .git in ObjectChecker
  DirCache: Refuse to read files with invalid paths
  DirCache: Replace isValidPath with DirCacheCheckout.checkValidPath
  Replace "a." with "a-" in unit tests
  Apache HttpClientConnection: replace calls to deprecated LocalFile()
  Fix two nits about DirCacheEntry constructors
  Detect buffering failures while writing rebase todo file
  Deprecate TemporaryBuffer.LocalFile without parent directory
  Switch FileHeader.extractFileLines to TemporaryBuffer.Heap
  AmazonS3: Buffer pushed pack content under $GIT_DIR
  DirCache: Buffer TREE extension to $GIT_DIR

Change-Id: Iee8acbaa9d4d9047b550641db1b8845d64530785
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-19 00:17:54 +01:00
Matthias Sohn 8899006c09 JGit v3.5.3.201412180710-r
Change-Id: Iadbd460da494c04fba71f98c200d6b65ce1709c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-18 15:23:10 +01:00
Matthias Sohn 4d6f66400e Merge branch 'stable-3.4' into stable-3.5
* stable-3.4:
  JGit v3.4.2.201412180340-r
  ObjectChecker: Disallow names potentially mapping to ".git" on HFS+
  ObjectChecker: Disallow Windows shortname "GIT~1"
  ObjectChecker: Disallow ".git." and ".git<space>"
  Always ignore case when forbidding .git in ObjectChecker
  DirCache: Refuse to read files with invalid paths
  DirCache: Replace isValidPath with DirCacheCheckout.checkValidPath
  Replace "a." with "a-" in unit tests
  Apache HttpClientConnection: replace calls to deprecated LocalFile()
  Fix two nits about DirCacheEntry constructors
  Detect buffering failures while writing rebase todo file
  Deprecate TemporaryBuffer.LocalFile without parent directory
  Switch FileHeader.extractFileLines to TemporaryBuffer.Heap
  AmazonS3: Buffer pushed pack content under $GIT_DIR
  DirCache: Buffer TREE extension to $GIT_DIR

Change-Id: I398cf40b006a05a6537788fc6eb1f84df1ed8814
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-18 15:18:07 +01:00
Matthias Sohn dbe8b52c5c JGit v3.4.2.201412180340-r
Change-Id: Ie088cf129b04ec64738edbc8c3ce25aa43b557ca
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-18 14:49:20 +01:00
Matthias Sohn d476d2f729 ObjectChecker: Disallow names potentially mapping to ".git" on HFS+
Mac's HFS+ folds concatentations of ".git" and ignorable Unicode
characters [1] to ".git" [2]. Hence we need to disallow all names which
could potentially be a shortname for ".git". Example: in an empty
directory create a folder ".g\U+200Cit". Now you can't create another
folder ".git".

The following characters are ignorable Unicode which are ignored on
HFS+:

unicode   hex         name
-------------------------------------------------
U+200C    0xe2808c    ZERO WIDTH NON-JOINER
U+200D    0xe2808d    ZERO WIDTH JOINER
U+200E    0xe2808e    LEFT-TO-RIGHT MARK
U+200F    0xe2808f    RIGHT-TO-LEFT MARK
U+202A    0xe280aa    LEFT-TO-RIGHT EMBEDDING
U+202B    0xe280ab    RIGHT-TO-LEFT EMBEDDING
U+202C    0xe280ac    POP DIRECTIONAL FORMATTING
U+202D    0xe280ad    LEFT-TO-RIGHT OVERRIDE
U+202E    0xe280ae    RIGHT-TO-LEFT OVERRIDE
U+206A    0xe281aa    INHIBIT SYMMETRIC SWAPPING
U+206B    0xe281ab    ACTIVATE SYMMETRIC SWAPPING
U+206C    0xe281ac    INHIBIT ARABIC FORM SHAPING
U+206D    0xe281ad    ACTIVATE ARABIC FORM SHAPING
U+206E    0xe281ae    NATIONAL DIGIT SHAPES
U+206F    0xe281af    NOMINAL DIGIT SHAPES
U+FEFF    0xefbbbf    ZERO WIDTH NO-BREAK SPACE

[1] http://www.unicode.org/versions/Unicode7.0.0/ch05.pdf#G40025
    http://www.unicode.org/reports/tr31/#Layout_and_Format_Control_Characters
[2] http://dubeiko.com/development/FileSystems/HFSPLUS/tn1150.html#UnicodeSubtleties

Change-Id: Ib6a1dd090b2649bdd8ec16387c994ed29de2860d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-18 14:49:20 +01:00
Christian Halstrick a09b1b6c3d ObjectChecker: Disallow Windows shortname "GIT~1"
Windows creates shortnames for all non-8.3 files (see [1]). Hence we
need to disallow all names which could potentially be a shortname for
".git". Example: in an empty directory create a folder "GIT~1". Now you
can't create another folder ".git".

The path "GIT~1" may map to ".git" on Windows. A potential victim to
such an attack first has to initialize a git repository in order to
receive any git commits. Hence the .git folder created by init will get
the shortname "GIT~1". ".git" will only get a different shortname if the
user has created a file "GIT~1" before initialization of the git
repository.

[1] http://en.wikipedia.org/wiki/8.3_filename

Change-Id: I9978ab8f2d2951c46c1b9bbde57986d64d26b9b2
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-18 14:49:17 +01:00
Shawn Pearce 10310bf8ef ObjectChecker: Disallow ".git." and ".git<space>"
Windows treats "foo." and "foo " as "foo". The ".git" directory is
special, as it contains metadata for a local Git repository. Disallow
variations that Windows considers to be the same.

Change-Id: I28eb48859a95a89111b4987c91de97557e3bb539
2014-12-18 14:49:03 +01:00
Shawn Pearce 07612a610f Always ignore case when forbidding .git in ObjectChecker
The component name ".GIT" inside a tree entry could confuse a
case insensitive filesystem into looking at a submodule and
not a directory entry.

Disallow any case permutations of ".git" to prevent this
confusion from entering a repository and showing up at a
later date on a case insensitive system.

Change-Id: Iaa3f768931d0d5764bf07ac5f6f3ff2b1fdda01b
2014-12-18 14:48:52 +01:00
Shawn Pearce 8d36fa343c DirCache: Refuse to read files with invalid paths
If the DirCache contains a path that is known to be invalid, refuse to
read the DirCache into memory.  This avoids confusing errors later if
an invalid path read from the DirCache were to be passed into a new
DirCacheEntry constructor.

Change-Id: Ic033d81e23a5fbd554cc4dff80a232504562ffa8
2014-12-18 14:48:46 +01:00
Shawn Pearce d547d0c44b DirCache: Replace isValidPath with DirCacheCheckout.checkValidPath
isValidPath is an older simple form of the validation performed by
checkValidPath. Use the latter as it more consistently matches
git-core's validation rules.

By running the same validation as fsck, callers creating an entry
for the DirCache are more likely to learn early they are trying
to build trees that will fail fsck.

Change-Id: Ibf5ac116097156aa05c18e231bc65c0854932eb1
2014-12-18 14:48:39 +01:00
Christian Halstrick 53ff052998 Support the new repository layout for submodules
When updating a submodule (e.g. during recursive clone) the repository
for the submodule should be located at <gitdir>/modules/<submodule-path>
whereas the working tree of the submodule should be located at
<working-tree>/<submodule-path> (<gitdir> and <working-tree> are
associated to the containing repository). Since CloneCommand has learned
about specifying a separate gitdir this is easy to implement in
SubmoduleUpdateCommand.

Change-Id: I9b56a3dfa50f97f6975c2bb7c97b36296f331b64
2014-12-15 00:22:51 +01:00
Christian Halstrick 6e05d98cce Allow explicit configuration of git directory in CloneCommand
This feature is needed to support the new submodule layout where the
.git folder of the submodules is under .git/modules/<submodule>.

Change-Id: If5f13426cfd09b7677e23478e9700c8c25a6dae5
2014-12-15 00:22:51 +01:00
Christian Halstrick 03e860a7b7 Allow explicit configuration of git directory in InitCommand
Native git's "init" command allows to specify the location of the .git
folder with the option "--separate-git-dir". This allows for example to
setup repositories with a non-standard layout. E.g. .git folder under
/repos/a.git and the worktree under /home/git/a. Both directories
contain pointers to the other side: /repos/a.git/config contains
core.worktree=/home/git/a . And /home/git/a/.git is a file containing
"gitdir: /repos/a.git". This commit adds that option to InitCommand.
This feature is needed to support the new submodule layout where the
.git folder of the submodules is under .git/modules/<submodule>.

Change-Id: I0208f643808bf8f28e2c979d6e33662607775f1f
2014-12-15 00:22:50 +01:00
Matthias Sohn ca7c928eae Merge "Fix tests on windows by closing repos" into stable-3.6 2014-12-12 08:50:20 -05:00
Christian Halstrick da595f093e Fix tests on windows by closing repos
Without explicitly closing repos we can't delete the test repositories
on windows.

Change-Id: Id5fa17bd764cbf28703c2f21639d7e969289c2d6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-12 14:49:02 +01:00
Christian Halstrick c893534059 Merge "Prevent NPE if ref can't be resolved when executing ReflogCommand" into stable-3.6 2014-12-12 08:31:16 -05:00
Christian Halstrick 1a054f1229 RepoCommand should close opened repos
RepoCommand opend two repos without closing them or returning them to
the caller. This caused certain tests to fail on Windows.

Change-Id: Ia04924aaaad4d16f883b06404c2a85d3f801231f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-12 14:06:51 +01:00
Matthias Sohn a24a99a13d Prevent NPE if ref can't be resolved when executing ReflogCommand
If the specified ref can't be resolved we should throw a
RefNotFoundException instead of an NPE.

Bug: 455005
Change-Id: I6ec9bf1c0f330eea5eb8277268f62663bdf58f66
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-12 13:02:27 +01:00
Christian Halstrick 42b20d4127 Merge "Fix DirCacheCheckout to set correct file length if core.autocrlf=true" into stable-3.6 2014-12-12 04:57:30 -05:00
Christian Halstrick 80b1da1aae Merge "CheckoutCommand: Fix checking out ours/theirs when no base stage exists" into stable-3.6 2014-12-12 04:54:46 -05:00
Matthias Sohn 59c4ea042c Fix DirCacheCheckout to set correct file length if core.autocrlf=true
To update the file length stat we need to use the length of the
temporary file since it's not yet renamed to the target file name here.
The incorrect file length stat update was introduced in
a606dc363d.

Bug: 453962
Change-Id: I715c048227553efae6f8f6b6878c0f04f2609d9c
Also-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Also-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-11 16:30:57 +01:00
Robin Stocker 47927ac95e CheckoutCommand: Fix checking out ours/theirs when no base stage exists
In case of an add/add conflict, no base stage exists. The previous
implementation would skip over the entries because the condition
expected the base stage to always exist.

Change-Id: Ie2b3685d958c09b241991b74e6177401e8a1ebc9
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-12-10 12:56:10 +01:00
Alexander Kurtakov 5c788e2ce5 Do not use deprecated tasks in maven-antrun-plugin.
Maven-antrun-plugin deprecated tasks in favor of target, this patch
fixes JGit poms to do the same.

Change-Id: I420fd2ce88c61cf8e786ed45fbb8235dc30c124e
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
2014-12-09 14:48:42 +02:00
Matthias Sohn efb91ee2d1 Implement FileSnapshot.toString() to help debugging
Change-Id: Ic18d051327e491d5834929ff7fa28381f0f972c4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-12-06 02:38:23 +01:00
Christian Halstrick 1b9130e8db Make sure modifications to config-param trustFolderStat are detected
ObjectDirectory.searchPacksAgain() should always read trustFolderStat
from the config and not rely on a cached value.

Change-Id: I90edbaae3c64eea0c9894d05acde4267991575ee
2014-12-05 14:39:45 +01:00
Ilmars Poikans 786ad999cd Fix integer overflow in DiffFormatter when context is set to large int
In original code, if you call the DiffFormatter's setContext() method
with Integer.MAX_VALUE (to get full-context diffs) the format() method
will get into an infinite loop.

Bug: 382680
Change-Id: I804e82cde9b84b8ff232a20fb5cbde04478315e7
Signed-off-by: Ilmars Poikans <ilmars@delibero.lv>
2014-12-01 00:14:50 +02:00
Matthias Sohn c9a5fdb3cd Merge "Honor git-core meaning of receive.denyDeletes allowing tag deletion" 2014-11-29 19:18:31 -05:00
Shawn Pearce d1b627ed83 Honor git-core meaning of receive.denyDeletes allowing tag deletion
receive.denyDeletes parameter refers only to branch:
http://thread.gmane.org/gmane.comp.version-control.git/99746

Bug: 412640
Change-Id: Ief3fa6abc0c9a18ba0a671ff9854432cec480c4f
2014-11-29 10:49:04 -08:00
Shawn Pearce b6b843e519 Move checkPath from DirCacheCheckout to ObjectChecker
The bulk of the "is this sane" logic is inside of ObjectChecker.  The
only caller for the version in DirCacheCheckout is an obtuse usage for
the static isValidRefName() method in Repository.

Deprecate the weird single use method in DirCacheCheckout and move all
code for checking a sequence of path components into ObjectChecker,
where it makes sense alongside the existing code that checks a single
component at a time.

Reuse a single ObjectChecker for the local platform, to avoid looking
up the system properties on each path string considered.

Change-Id: Iae6e769f2bfcad05c166e70ff255f9cf9fcdc87e
2014-11-28 20:59:34 -08:00
Michael Keppler 1a72143780 Use baseline instead of centerline in PlotRenderer
If the text extent height of a to be rendered plot line is odd, then the
SWTPlotRenderer cannot calculate the correct Y position for drawing the
label and draws the label with a 1 pixel offset. SWT text drawing uses
the baseline as Y coordinate. Due to the given centerline API in the
AbstractPlotRenderer the overall calculation of the baseline for SWT is
effectively (height / 2) * 2, thereby rounding all odd heights downward
to the next even number.

This change pushes the division by 2 from the caller into the
implementations of drawText. A corresponding change will be pushed in
the egit repository.

Bug: 450813
Change-Id: I66f4e71873bb8e6f936fde573bbe4c35fe23a022
Signed-off-by: Michael Keppler <michael.keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-29 01:30:13 +01:00
Andrey Loskutov 147e24a7b2 Consider parent rules if ignore rule is negated
The change tries to make jgit behave more like native CLI git regarding
the negation rules. According to [1] "... prefix "!" which negates the
pattern; any matching file excluded by a previous pattern will become
included again." Negating the pattern should not automatically make the
file *not ignored* - other pattern rules have to be considered too.

The fix adds test cases for both bugs 448094 and 407475.

[1] https://www.kernel.org/pub/software/scm/git/docs/gitignore.html

Bug: 448094
Bug: 407475
Change-Id: I322954200dd3c683e3d8f4adc48506eb99e56ae1
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-11-29 01:24:20 +01:00
Shawn Pearce 3886a4f68b ResolveMerger: Use checkoutEntry during abort
The cleanUp path is trying to restore files that previously were
clean, but were overwritten in the work tree by a partial merge
attempt that has failed and needs to be aborted. Reuse the checkout
logic to write the file content and refresh the stat data.

Change-Id: I320d33b3744daf88d3155db99e957408937ddd00
2014-11-27 13:41:58 -08:00
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
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
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
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
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
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
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
Christian Halstrick 95172dea17 Support for Submodule configuration submodule.<name>.ignore
For each submodule native git allows to configure which modifications to
submodules should be ignored by the status command. It is possible to
ignore "none", "all", "dirty", "untracked" [1]. This configuration is
now supported by IndexDiff. The StatusCommand offers the possibility to
specify this mode.

[1] http://git-scm.com/docs/gitmodules

Change-Id: Ifd81d574a680f9b4152945ba70f8ec4af4f452c9
2014-11-03 04:32:03 -05:00
Andrey Loskutov 2f5a08798e Reimplementation of ignore rule parser
The current IgnoreRule/FileNameMatcher implementation scales not well
with huge repositories - it is both slow and memory expensive while
parsing glob expressions (bug 440732). Addtitionally, the "double star"
pattern (/**/) is not understood by the old parser (bug 416348).

The proposed implementation is a complete clean room rewrite of the
gitignore parser, aiming to add missing double star pattern support and
improve the performance and memory consumption.

The glob expressions from .gitignore rules are converted to Java regular
expressions (java.util.regex.Pattern). java.util.regex.Pattern code can
evaluate expression from gitignore rules considerable faster (and with
less memory consumption) as the old FileNameMatcher implementation.

CQ: 8828
Bug: 416348
Bug: 440732
Change-Id: Ibefb930381f2f16eddb9947e592752f8ae2b76e1
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-27 19:26:42 +01:00
Robin Stocker 6eca51923f Merge "Initialize 'pathLen' field also for empty directories" 2014-10-23 06:50:00 -04:00
Andrey Loskutov 4ea8c655d6 Initialize 'pathLen' field also for empty directories
Bug: 445363
Change-Id: Ia8428af84fb61ba0d572374a19e8e8c55b138a63
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2014-10-23 12:31:49 +02:00
Shawn Pearce 2c25a1fde0 Merge "Add retainOnReset(RevFlag) to RevWalk to simplify reset usage" 2014-10-20 13:45:28 -04:00
Shawn Pearce 048dbf4173 Add retainOnReset(RevFlag) to RevWalk to simplify reset usage
Applications sometimes use a RevFlag instead of a Set<RevObject>
to track boolean state bits about objects being processed. However
this requires careful use of the resetRetain() methods to avoid an
accidental clearing of the RevFlag bits, effectively clearing the
Set<RevObject> the application wanted to track.

Simplify that use case by offering retainOnReset, a collection of
flags that are never cleared by the RevWalk.

Change-Id: I4c05b89b1398e4a4f371eac3a5d1d5edddec838f
2014-10-19 11:36:08 -07:00
Robin Stocker 590e1b7602 BundleWriter: Support including HEAD in bundle
Bug: 446813
Change-Id: Ide64aec2a995dd7ff6c1325c3ada242a4eb4565e
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-10-19 14:40:29 +11:00
Matthias Sohn 5c85d5d58a Merge branch 'stable-3.5'
* stable-3.5:
  Prepare 3.5.2-SNAPSHOT builds
  JGit v3.5.1.201410131835-r
  Only hide gitdir if the repository isn't bare

Change-Id: I171e5fb8718cb6829bb1357859c95b4a29910ac6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-14 17:51:53 +02:00
Matthias Sohn dcb52291a9 Prepare 3.5.2-SNAPSHOT builds
Change-Id: Ib2ccdebe80bad0b09d2d31889a3ab89d77e341f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-14 01:29:37 +02:00
Matthias Sohn 450ce163ef JGit v3.5.1.201410131835-r
Change-Id: I37e049c8e81f963cfb7c17f1af91fd4245766aee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-14 00:38:49 +02:00
Christian Halstrick 2a01c98ea1 Merge "Only hide gitdir if the repository isn't bare" into stable-3.5 2014-10-13 11:57:55 -04:00
Matthias Sohn 13ffda0666 Fix ResetCommand to default to mixed reset
ResetCommand threw an NPE if neither mode nor path was defined. Instead
it should default to a mixed reset like native git does.

Change-Id: I455902394f9e7b0c7afae42381f34838f7f2a138
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-13 16:41:58 +02:00
Matthias Sohn 2983d224eb Merge branch 'stable-3.5'
* origin/stable-3.5:
  When marking commits as uninteresting don't care if the tree exists

Change-Id: I66559a72ed7284cb721cf929512af884c0db2d61
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-12 23:45:45 +02:00
Christian Halstrick 88b25a58f0 When marking commits as uninteresting don't care if the tree exists
When during an ObjectWalk commits are marked as uninteresting we should
be tolerant against the situation that the commit exists in the repo but
the referenced tree is not exisiting. Since commit
c4797fe986 we are throwing
MissingObjectException in such a case. This semantic differs from native
git behaviour and may cause push operations to fail while they would
work in native git. See:
http://dev.eclipse.org/mhonarc/lists/egit-dev/msg03585.html

Bug: 445744
Change-Id: Ib7dec10fd2ef1adbb8adbabb9d3d5a64e554286a
2014-10-10 10:52:43 -04:00
Christian Halstrick 6ed6494b8a Revert "When marking commits as uninteresting don't care if the tree exists"
This reverts commit 441fdb54ef.
2014-10-10 00:09:44 +02:00
Christian Halstrick 441fdb54ef When marking commits as uninteresting don't care if the tree exists
When during an ObjectWalk commits are marked as uninteresting we should
be tolerant against the situation that the commit exists in the repo but
the referenced tree is not exisiting. Since commit
c4797fe986 we are throwing
MissingObjectException in such a case. This semantic differs from native
git behaviour and may cause push operations to fail while they would
work in native git. See:
http://dev.eclipse.org/mhonarc/lists/egit-dev/msg03585.html

Bug: 445744
Change-Id: Ib7dec10fd2ef1adbb8adbabb9d3d5a64e554286a
2014-10-10 00:00:45 +02:00
Matthias Sohn 668acc6fc5 Only hide gitdir if the repository isn't bare
This problem was raised on the jgit list
https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02675.html

Change-Id: I8ce8a159120ce3747d31d6f012c6d2c0d0ce7917
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-10-07 09:28:58 +02:00
Matthias Sohn 9fd1325ecb Merge branch 'stable-3.5'
* stable-3.5:
  Prepare 3.5.1-SNAPSHOT builds
  JGit v3.5.0.201409260305-r
  Fix PackWriterBitmapWalker handling non-existing uninteresting objects
  Enable maven site generation for jgit
  Generate javadocs as part of Maven site project reports
  Compare API changes with clirr against 3.4.1
  [cli] Use chaining credentials provider to enable .netrc
  Add chaining credentials provider
  [Java 8] Configure doclint to accept missing descriptions
  Do not use .netrc implicitly if no CredentialsProvider was set
  Prepare post 3.5.0-rc1 builds
  JGit 3.5.0.201409071800-rc1
  Fix the ls-remote command when there is no local repo

Change-Id: Iaa4485cac6ff9c7917380e89e12e416e0f52a557
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-26 15:45:46 +02:00
Matthias Sohn 848186da86 Prepare 3.5.1-SNAPSHOT builds
Change-Id: Ibf89f996c9d9a7e431ee09261987bb76246de441
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-26 14:56:34 +02:00
Matthias Sohn 24a2f9e53d JGit v3.5.0.201409260305-r
Change-Id: Ibf382bda3dcbb4b70829b1dd3a8abfd07bc4879e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-26 09:02:45 +02:00
Christian Halstrick fa4f00b7ed Fix PackWriterBitmapWalker handling non-existing uninteresting objects
When writing new packs it should be allowed to specify objects as "have"
(objects which should not be included in the pack) which do not exist in
the local repository.

This works with the traditional PackWriter, but when PackWriter was
working on a repository with bitmap indexes and used
PackWriterBitmapWalker then this feature was broken. Non-existing "have"
objects lead to MissingObjectExceptions. That broke push and Gerrit
replication. When the replication target had branches unknown to the
replication source then the source repository wanted to build pack files
where "have" included branch-tips which were unknown in the source 
repository.

Bug: 427107
Change-Id: I6b6598a1ec49af68aa77ea6f1f06e827982ea4ac
Also-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-25 19:01:42 -04:00
Matthias Sohn 3f0d9795ea Add chaining credentials provider
The chaining credentials provider sequentially tries to obtain
credentials from a list of credential providers and returns the
credentials from the first provider which can provide them.

Change-Id: I499f304119d7066d011dbde3556dee6facee8ab0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-24 15:27:35 +02:00
Andrey Loskutov 85b62b4c9c Fixed API violation errors for 3.6 in ConfigConstants
Change-Id: Ibeb09eb23d47412fa93493bb4e81d24d437e31bc
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2014-09-24 11:26:06 +02:00
Christian Halstrick 227357f929 Add "aggressive" option to GC
JGit should offer the possibility to do a garbage collection in
"aggressive" mode. In this mode garbage collection more aggressively
optimize the repository at the expense of taking much more time.
Technically a aggressive mode garbage collection differs from a
non-aggressive one by:
- not reusing packed objects found in old packs. Recompress every object
- the configuration pack.window is set to 250 (the default is 10)
- the configuration pack.depths is set to 250 (the default is 50)

The associated classes in org.eclipse.jgit.api and the command line
command in org.eclipse.jgit.pgm expose this new option.

The configuration parameters gc.aggressiveDepth and gc.aggressiveWindow
have been introduced to configure this feature.

Bug: 444332
Change-Id: I024101f2810acf6be13ce144c9893d98f5c4ae76
2014-09-19 09:17:41 -04:00
Matthias Sohn 1c0b2a28ac Do not use .netrc implicitly if no CredentialsProvider was set
Do not silently set the NetRCCredentialsProvider if no
CredentialsProvider was set explicitly since applications may want to
have full control which provider should be used.

Bug: 444338
Change-Id: Ie096983bc1caa90443a504d302bfea8f2d26ab9e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-17 15:16:55 +02:00
Marc Strapetz f2ebc8d4c5 PackIndexV1 should check for possible corruption
Change-Id: I1dd741d3e522e396950c30d2f96e9713d0439078
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2014-09-08 17:12:40 +02:00
Matthias Sohn 66559681dd Prepare post 3.5.0-rc1 builds
Change-Id: Id9e01b867bff0ed10e887c15a12e5399b788b68e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-08 01:01:57 +02:00
Matthias Sohn 48820c7b07 JGit 3.5.0.201409071800-rc1
Change-Id: I59e5e2492820da111df1837fbf3649a2ae03841c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-07 23:58:44 +02:00
Robin Rosenberg bbe99d5b39 Fix the ls-remote command when there is no local repo
Bug: 436695
Change-Id: I567f9a8e355c7624efa3efc9bac4f3b9015afa97
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-07 01:10:51 +02:00
Matthias Sohn 6ccf609e89 Prepare 3.6.0-SNAPSHOT builds
Change-Id: I2d8c3768998c0cfc8d02d11009bc5b7ed1d75778
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-05 14:32:01 +02:00
Shawn Pearce bc90ce7788 PackWriter: Report more stats during partial writes
It can be useful for a server operator to know how long a pack
writer spent writing out objects, even if the request aborts and
never finishes.

Record more of the stats data inside of a finally block, to
ensure these can be included into the server's monitoring.

Change-Id: I00858aa393a948f8e742e64ae4c00953eadaef95
2014-09-04 12:45:18 -07:00
Robin Rosenberg 05896dabfc Drop warnings about unchecked casts in a few stable select places
Change-Id: Ie163a4940f0d13bbdefd8c4643c0944c71800544
2014-09-04 11:35:19 +02:00
Robin Rosenberg 4c6857d1ec Hide warnings about field hiding in the MyersDiff code
Just suppress warning in this stable code rather then fixing names

Change-Id: I07580aa3cbdaa66852a5c919769bbd9020d78703
2014-09-04 11:35:18 +02:00
Robin Rosenberg 409c32b1cf Fix warnings about missing serialVersionUID
Use @SuppressWarnings since these are private classes

Change-Id: Ic8e4c08b70627a3f9b031e2474092e1ce8116f22
2014-09-04 11:35:18 +02:00
Robin Rosenberg 1bb72eb758 Fix warning about missing serialVersionUID
Change-Id: Ia9532d1aaf92df9073c85c44ff2ca94796deefc2
2014-09-04 11:35:17 +02:00
Robin Rosenberg 2f6372337c Rename local variables/parameters to remove warnings about hiding
Change-Id: I73f38492b6a2e7fd6e77005efd0a8a8c65763e74
2014-09-04 11:35:16 +02:00
Robin Rosenberg 0bc98f17b2 Eliminate warnings for non-nls strings that will never be translated
Some of these eliminations just reduces the number of warnings on
lines where messages are constructed that can/will be translated.

Change-Id: I6eddb39ccc8f2488741bb58540d9ec5f5665e2c4
2014-09-04 11:28:03 +02:00
Robin Rosenberg 00c4a73fbc Windows: Hide the .git directory if hidedotfiles is set to non-false
Other .git files are not hidden with this patch

Change-Id: Idf63ca08d08f3a77c33f5848d02074f8d6a75758
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-04 11:24:54 +02:00
Konrad Kügler 9ac59efbbd PlotCommitList: Close plot lanes at root commits
Bug: 443006
Change-Id: I40b1eb044fa2d9e6c5d4b956c17e32ca6c1bd39f
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
2014-09-02 07:57:04 -04:00
Matthias Sohn 3885ce2a94 Prevent NPE if no CredentialsProvider is registered
If the git server requires authentication and no CredentialsProvider is
registered TransportHttp.connect() would throw an NPE since it tries to
reset the credentials provider. Instead throw a TransportException
explaining the problem.

Change-Id: Ib274e7d9c43bba301089975423de6a05ca5169f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-01 11:27:17 +02:00
Axel Richard 46f3007b52 Handle -m option for Merge command
Set the commit message to be used for the merge commit (in case one is
created)

Bug: 442886
Change-Id: Ie5ecc13822faa366f00b3daa07f74c8441cae195
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-30 01:17:24 +02:00
Shawn Pearce 7b7d033ee1 UploadPack: Always make PackWriter.Statistics available
If the packer fails, still obtain the stats and make them available
to the logger and the caller. Failures can frequently happen when
a client disconnects in the middle of a pack stream. Server admins
may still want to examine the timing metrics from counting and
compressing phases.

Change-Id: Iceae4f68b5473f4223d85c9edfb57837fc818eed
2014-08-29 12:56:17 -07:00
Marc Strapetz 6be184e15c PackIndexV2 should check for possible corruption
Change-Id: I1803ec6d8141f07dd4085778da6461abe81c30a9
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2014-08-29 10:08:42 +02:00
Yuxuan 'fishy' Wang 9ea357f336 Allow projects without path attribute in manifest.
In such case, we use the name attribute as the default value of path.

Change-Id: I53fa312d6b64c6eb2240f08af7d1d60cea99192a
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-28 21:16:56 -07:00
Shawn Pearce 7b28130758 Merge "PackIndexV2: fix possibly wrong check" 2014-08-28 19:53:36 -04:00
Saša Živkov c4797fe986 Let ObjectWalk.markUninteresting also mark the root tree as
uninteresting

Using the ObjectWalk and marking a commit as uninteresting didn't mark
its root tree as uninteresting. This caused the "missing tree ..."
error in Gerrit under special circumstances. For example, if the
patch-set 2 changes only the commit message then the patch-set 1
and patch-set 2 share the same root-tree:

  ps1 -> o   o <- ps2
          \ /
           o root-tree

The transported pack will contain the ps2 commit but not the root-tree
object.

When using the BaseReceivePack.setCheckReferencedObjectsAreReachable
JGit will check the reachability of all referenced objects not provided
in the transported pack. Since the ps1 was advertised it will properly
be marked as uninteresting. However, the root-tree was reachable because
the ObjectWalk.markUninteresting missed to mark it as uninteresting.
JGit was then rejecting the pack with the "missing tree ..." exception.

Gerrit-issue: https://code.google.com/p/gerrit/issues/detail?id=1582
Change-Id: Iff2de8810f14ca304e6655fc8debeb8f3e20712b
Signed-off-by: Saša Živkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-28 18:05:59 -04:00
Yuxuan 'fishy' Wang 684a2a058a Handles repo manifest file without default remote.
Change-Id: Ic45919a0b695e8a6f4ed47cc060e0c41f1d7e7ea
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-27 16:29:19 -07:00
Shawn Pearce 49305cde19 Merge "ReceivePack: Accept shallow lines from Git >= 1.9" 2014-08-27 16:56:16 -04:00
Shawn Pearce 199dd4a9a9 ReceivePack: Accept shallow lines from Git >= 1.9
In Git 1.9 (5dbd767601 "support pushing from a shallow clone")
the git-core project intentionally broke the existing send-pack
protocol from shallow clients.

Shallow clients now transmit their shallow information during push,
ahead of the old-new command sequence. JGit must accept these lines
when presented.

To protect the server against clients sending partial history,
require the connectivity check when pushed to by a shallow client.

Change-Id: I46639366b0900052c376091e1688f07def44ab79
2014-08-27 12:45:17 -07:00
Robin Rosenberg 82f74e490a Merge "Strip "<", ">", and "\n" from name/email in UserConfig" 2014-08-22 09:19:49 -04:00
Robin Rosenberg 5797dbe9a7 Merge "Throw URISyntaxException for incorrect percent-encoding" 2014-08-21 17:47:51 -04:00
Robin Stocker ce312d8afb Strip "<", ">", and "\n" from name/email in UserConfig
This matches what C Git does, see "stripped" in `man git-commit-tree`.

It also fixes the bug of the user where an user.email like "<>" would
show up as "<<>>" in EGit.

Bug: 439844
Change-Id: I567a3c620e191ce9d37d318417e63cb5d4483419
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-21 23:21:27 +10:00
Yi EungJun da6e729086 Throw URISyntaxException for incorrect percent-encoding
URIish.unescape() threw an ArrayIndexOutOfBoundsException if the given
url has incorrect percent-encoding (e.g. http://example.com/%gg). But an
URISyntaxException is much better to know the reason of the failure.

Change-Id: I3f40a26d43cd2eb4e32c11aba7dc2594bc1f98e2
Signed-off-by: Yi EungJun <eungjun.yi@navercorp.com>
2014-08-21 00:45:39 +09:00
Robin Rosenberg a0752f71fc Fix minor spelling error in comment
Change-Id: I320b5cd526827844d4fe0cbc0f32551010e98090
2014-08-19 16:21:59 +02:00
Yuxuan 'fishy' Wang 66fc834530 Support remote aliases in repo manifest.
Change-Id: Icbe5761b9d8a4ae5305bfe45b2d042f214156fc8
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-18 11:12:08 -07:00
Yuxuan 'fishy' Wang 5a26c538b3 Support non-default remotes in project tag.
Change-Id: I3c730a1ce379d142d3ed81dda4a73f86f1f9c3eb
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-18 10:57:09 -07:00