Commit Graph

2807 Commits

Author SHA1 Message Date
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
Robin Stocker 4bdd0037aa Add toString to Git with repository path
Useful for debugging.

Change-Id: I78b92ccbcc099370fc99a1d2fa2cf60d5f5892e6
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-17 17:48:05 +10:00
Shawn Pearce 9bb891e44d ResolveMerger: Use the ObjectReader to access objects
This is necessary to ensure objects accessed by the TreeWalk come from
the associated ObjectInserter when the merger is a RecursiveMerger
instance and a virtual common base was constructed but not flushed.

Change-Id: Iebe739d30fd868ebc4f61dbfb714673146a2c3ec
2014-08-15 10:27:31 -07:00
Marc Strapetz ce48fba05e PackIndexV2: fix possibly wrong check
According to http://stackoverflow.com/a/8381338, the maximum array
size is not Integer.MAX_VALUE, but Integer.MAX_VALUE - 8

Change-Id: I6ddc7470368acd20abf0885c53c89a982bb0f176
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2014-08-15 14:01:09 +02:00
Shawn Pearce 94c4d7eee8 Cleanup use of java.util.Inflater, fixing rare infinite loops
The native implementation of inflate() can set finished to return
true at the same time as it copies the last bytes into the buffer.

Check for finished on each iteration, terminating as soon as libz
knows the stream was completely inflated.

If not finished, it is likely input is required before the next
native call could do any useful work. Most invocations are passing
in a buffer large enough to store the entire result. A partial return
from inflate() will need more input before it can continue. Checking
right away that needsInput() is true saves a native call to determine
no bytes can be inflated without more input.

This should fix a rare infinite loop condition inside of inflation
when an object ends exactly at the end of a block boundary, and
the next block contains only the 20 byte trailing SHA-1.

When the stream is finished each new attempt to inflate() returns
n == 0, as no additional bytes were output. The needsInput() test
tries to add the length of the footer block to itself, but then loops
back around an reloads the same block as the block is smaller than
a full block size. A zero length input is set to the inflater,
which triggers needsInput() condition again.

Change-Id: I95d02bfeab4bf995a254d49166b4ae62d1f21346
2014-08-14 12:36:43 -07:00
Shawn Pearce 861f5f649f Add missing @since 3.5 tag to RepoCommand.setIncludedFileReader
Change-Id: Ib5d24f8dafacc0d12c36927c2bbc3ebef2fff7b2
2014-08-13 15:28:24 -07:00
Yuxuan 'fishy' Wang 34dd64f6fe Add support to <include> tag in repo manifest xml.
Change-Id: I32d468f92e24701ea680435bf3417e3850857303
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-13 13:04:28 -07:00
Shawn Pearce b1bea54113 Merge "Tweak the handling of remote url in jgit repo." 2014-08-13 16:02:57 -04:00
Shawn Pearce d70419ab00 Revert "Add a method to DfsOutputStream to read as an InputStream"
This reverts commit b646578d89.

openInputStream() is never used in JGit, nor is it used by any
known working DFS implementation. The method was added as a
utility for reading back from a DfsInserter, but the final
implementation of that feature does not requrire this method.

Change-Id: I075ad95e40af49c92b554480f8993ef5658f7684
2014-08-13 10:42:43 -07:00
Dave Borowitz 8ea4319388 Add a Merger.merge method that makes flushing optional
This allows callers performing multiple separate merges to reuse a
single ObjectInserter without flushing the inserter on each iteration
(which can be slow in the DFS case).

Change-Id: Icaff7d2bc2c20c873ce5a7d9af5002da84ae1c2b
2014-08-13 10:40:04 -07:00
Dave Borowitz 0ab3f43c85 Teach mergers to use ObjectInserter.newReader()
This allows the RecursiveMerger to iteratively create new merge bases
without necessarily flushing packs to storage in the DFS case;
flushing only need happen at the end of the whole merge process.

Since Merger's walk now depends on its inserter, we need to construct
an inserter at Merger construction time.  This should not be a
significant increase in overhead since unused inserters don't use any
resources (beyond a reference to the Repository).

We also must release and recreate the walk whenever setObjectInserter
is called, which can break usages where setObjectInserter is called in
the middle of stateful operations on the walk.  No usages of this
method within JGit currently do this; the inserter is only ever set
before any stateful walk operations happen.

Change-Id: I9682a6aa4a2c37dccef8e163f132ddb791d79103
2014-08-13 10:39:57 -07:00
Yuxuan 'fishy' Wang 38a24bc799 Tweak the handling of remote url in jgit repo.
This kind of reverted 31148. URI.resolve actually can handle the absolute URL
well, the problem is only the missing "/".

Change-Id: Iee5866c005cbc1430dc20ee7db321b8b51afed30
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-13 10:36:56 -07:00
Dave Borowitz e1856dbf44 Add a method to ObjectInserter to read back inserted objects
In the DFS implementation, flushing an inserter writes a new pack to
the storage system and is potentially very slow, but was the only way
to ensure previously-inserted objects were available.  For some tasks,
like performing a series of three-way merges, the total size of all
inserted objects may be small enough to avoid flushing the in-memory
buffered data.

DfsOutputStream already provides a read method to read back from the
not-yet-flushed data, so use this to provide an ObjectReader in the
DFS case.

In the file-backed case, objects are written out loosely on the fly,
so the implementation can just return the existing WindowCursor.

Change-Id: I454fdfb88f4d215e31b7da2b2a069853b197b3dd
2014-08-13 10:27:12 -07:00
Shawn Pearce 63eb9042a4 DfsInserter: buffer up to streamFileThreshold from InputStream
Since 2badedcbe0 in-core merges can write up to 10 MiB
into a TemporaryBuffer.Heap strategy, where the data is stored
as a chain of byte[] blocks.

Support the inserter reading up to the streamFileThreshold (default 50
MiB) from the supplied input stream and hash the content to determine
if the merged result blob is already present in the repository.  This
allows the inserter to avoid creating duplicate objects in more cases,
reducing repository pack file churn.

Change-Id: I38967e2a0cff14c0a856cdb46a2c8fedbeb21ed5
2014-08-12 18:55:12 -07:00
Dave Borowitz fa5582f3fe Merger: clarify getBaseCommit javadoc
Change-Id: Ic52475248a545d51d3d8ac31a24f0344a1241e45
2014-08-11 14:46:45 -07:00
Dave Borowitz e06082c171 Reuse Merger's ObjectReader from ResolveMerger
The base Merger class already has a single ObjectReader instance that
it handles releasing as necessary, so creating new readers is not
necessary.

Change-Id: I990ec43af7df448c7825fc1b10e62eadaa3e0c2a
2014-08-11 14:46:31 -07:00
Robin Rosenberg 06ab442b05 Merge "Fix CheckoutCommand not setting up tracking" 2014-08-11 16:23:38 -04:00
Shawn Pearce 2badedcbe0 Process most in-core merges without local temp files
Instead of always writing to disk use TemporaryBuffer.LocalFile to
store up to 10 MiB of merge result in RAM. Most source code will
fit into this limit, avoiding local disk IO for simple merges.

Larger files will automatically spool to a temporary file that
can be cleaned up in the finally, reducing the risk of leaving
them on disk and consuming space in /tmp.

Change-Id: Ieccbd9b354d4dd3d2bc1304857325ae7a9f34ec6
2014-08-08 17:53:49 -07:00
Shawn Pearce 2c33c725f9 ResolveMerger: push result file creation into updateIndex()
The only caller of writeMergedFile is updateIndex, and the only
user of this path object is the code within the method. This is
a no-op change that opens the door to refactoring the way temp
files are handled for inCore merges.

Change-Id: I863a303194689a806b667e55eb958e1decf046c1
2014-08-08 15:04:57 -07:00
Shawn Pearce 4bd28bc958 RecursiveMerger: do not insert virtual commits into repository
When merging common ancestors to create a single virtual common
ancestor the commit does not need to be inserted into the Git
repository. Instead just mock it out in memory as part of the
merger's RevWalk pool.

Make the author and committer stable and predictable for any
given pair of merge bases. It is not necessary for the caller's
name or email to be used as the commit will not be written out.

Change-Id: I88d5ee4de121950e1b032a5c10486c9d2c42656c
2014-08-08 11:31:24 -07:00
Yuxuan 'fishy' Wang 66ad4237be Fix non-relative remote defined in manifest xml.
Currently if the remote defined in repo manifest xml is non-relative (e.g.
"https://chromium.googlesource.com"), our code will break. This change fixed
that.

It also makes that remotes are ending with "/".

Change-Id: Icef46360b32227a9db1d9bb9e6d929c72aeaa8df
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-08-06 22:26:17 -07:00
Robin Stocker 544f65e655 Fix CheckoutCommand not setting up tracking
Instead of passing on the start point as is to CreateBranchCommand, the
resolved ObjectId was used. Given this, CreateBranchCommand did not set
up tracking.

This also fixes CreateBranchCommand with setStartPoint(null) to use HEAD
(instead of NPEing), as documented in the Javadoc.

Bug: 441153
Change-Id: I5ed82b4a4b4a32a81a7fa2854636b921bcb3d471
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-05 23:38:07 +10:00
Robin Rosenberg d97558fb1c Merge "Add isRebase to API of BranchConfig" 2014-08-03 07:33:28 -04:00
Robin Rosenberg b397e7b6e0 Merge "Use bitcheck to check for presence of OPT_FULL option" 2014-08-03 04:51:12 -04:00
Robin Stocker f5494c186f Add isRebase to API of BranchConfig
Change-Id: I9819f49410e30d32c2157db0556a0dd6a0bcc5a4
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-08-03 18:38:38 +10:00
Alexey Kuznetsov a4f560551d NetRC parser and credentials provider.
Adds default git command line behaviour of reading credentials
for https connections from .netrc file.

Bug: 428229
Change-Id: I88699ca5da6a20bdeaed24b7e3899cc1022b8e7c
Signed-off-by: Alexey Kuznetsov <axet@me.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-03 01:47:43 +02:00
Kevin Sawicki d2fa3987a0 Use bitcheck to check for presence of OPT_FULL option
Previously an equality check was performed so an exception would
be thrown if any other options were set.

Change-Id: I36b60e2c0a8aef9fcfe663055dba520192996872
2014-08-02 18:20:11 -04:00
Robin Stocker 93530625cf Enhance BranchConfig API to expose branch.* options
With these, more code can use BranchConfig instead of directly accessing
the raw configuration values.

Change-Id: I4b52f97ff0e3fc8f097512806f043c615a3d2594
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-03 00:06:14 +02:00
Christian Halstrick ddbf67e058 IndexDiffFilter should never filter entries with stage!=0
If the IndexDiffFilter is asked whether it should include or filter out
a certain path and for that path there is a dircache entry with a stage
different from 0, then the filter should never filter out this entry.
IndexDiffFilter is an optimized version of AnyDiffFilter and there is no
case where the index contains non-0 stages but we still don't see any
diff for that path.

Change-Id: I25915880f304090fe90584c79bddf021231227a2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-02 23:04:26 +02:00
Robin Rosenberg fd07ee54ef Merge "HistogramDiff: Convert stack recursion to heap managed queue" 2014-08-02 05:35:18 -04:00
Robin Stocker 66909cd7a6 Fix Javadoc errors with Java 8
Bug: 440414
Change-Id: Icce87bd23a3698513b76246677f1d45ddbcaab47
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-08-02 00:47:13 +02:00
Christian Halstrick adbf0541dc Fix API errors raised on ResolveMerger affecting API providers only
In change If45bc3d078b3d3de87b758e71d7379059d709603 a new parameter was
added to 3 protected methods of ResolveMerger. This breaks the code of
developers which have subclassed ResolveMerger. The API baseline check
in Eclipse reports this as API breakage.

Since this will break only providers but not consumers of the API this
should be allowed also in minor versions. According to OSGi semantic
versioning
http://www.osgi.org/wiki/uploads/Links/SemanticVersioning.pdf
breaking providers in a minor version update is ok.

Therefore silence these errors using API filter rules.

Bug: 440757
Change-Id: Icabbd0e1de7e877c66a5c4a2c8391473f992a1aa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-31 00:02:17 +02:00
Matthias Sohn efce340474 Implement RepoCommand.Project.hashCode() since we override equals()
Bug: 440757
Change-Id: I16614c75b62b2fbef05419dd8667e3c50889abe4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-30 23:54:50 +02:00
Matthias Sohn 56fdbadc76 Remove @Override annotation illegal for interfaces on Java 5
Bug: 440757
Change-Id: I11897e8e680722313f28d9d241e23e92eddeb966
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-30 23:54:36 +02:00
Matthias Sohn 9b157c6dab Mark package org.eclipse.jgit.gitrepo.internal as x-internal
It's an internal package which isn't part of the API. Mark it x-internal
to silence @since tag warnings which are only raised for new API.

Bug: 440757
Change-Id: Id05deaca43f135cd1bfe83cf1f29787cbbdbecac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-30 23:54:24 +02:00
Andrey Loskutov 3a161ac467 Small performance optimization for ignore rules/fnmatcher
- don't check empty segments generated by String.split()
 - don't continue to add segments if the matcher fails to match input
 - don't add empty heads
 - don't iterate over empty heads.

Bug: 440732
Change-Id: I7d04dccfe24d91275d17ba246662337d6dba66df
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-30 23:37:27 +02:00
Andrey Loskutov 0307123e5a Added toString() methods for better debugging of ignore rules
Change-Id: Ie31687faa2df47ecaacace2504c3b4e93f1ea809
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-30 23:17:43 +02:00
Maik Schreiber 7ff1e0d8f5 Fix RevertCommand to correctly revert multiple commits at once.
The fix is to move the new head commit to the newly-created revert
commit, so that additional revert commits will use the correct head.

Change-Id: I5de3a9a2a4c276e60af732e9c507cbbdfd1a4652
Signed-off-by: Maik Schreiber <blizzy@blizzy.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-07-30 16:20:08 +02:00
Shawn Pearce 7b0ee393ba Merge "Remove overlapping submodules from repo manifest." 2014-07-29 19:28:11 -04:00
Yuxuan 'fishy' Wang a9b9c5b324 Remove overlapping submodules from repo manifest.
Apparently repo allows projects overlapping, e.g. one project's path is "foo"
and another project's path is "foo/bar". This is not supported in git submodule.
At JGit repo side we'll skip all the submodules that are in subdirectories of
other submodules, and on repo side we'll make them submodules to resolve this
problem.

Change-Id: I6820c4ef400c530a36150b1228706adfcc43ef64
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-07-29 16:16:36 -07:00
Shawn Pearce 219b9045f4 Merge "Added the missing export in MANIFEST.MF." 2014-07-29 19:01:13 -04:00
Christian Halstrick 5171a1843a Merge "RecursiveMerger should not fail on content-merge conflicts of parents" 2014-07-29 03:46:52 -04:00
Yuxuan 'fishy' Wang 73d38bfb33 Strip trailing /s in repo base URI.
Change-Id: I71040db2cca69638cfad89acdc9179ee80592b27
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-07-28 16:13:50 -07:00
Christian Halstrick 3b031fe3dc RecursiveMerger should not fail on content-merge conflicts of parents
Previously when RecursiveMerger was trying to create a single virtual
common base for the merge it was failing when this lead to content-merge
conflicts. This is different from what native git is doing. When native
git's recursive merge algorithm creates a new common base it will merge
the multiple parents and simply take the merge result (potentially
including conflict markers) as common base. See my discussion with Shawn
here: http://www.spinics.net/lists/git/msg234959.html :

  > - How should workingtree, index (stage1,2,3) look like if during
that
  > merge of common ancestors a conflict occurs? Will I see in stage2
and
  > stage3 really see content of X1 and X2?

  Its done entirely in memory and never touches the working tree or
  index. When a conflict exists in the X1-X2 merge the conflict is
  preserved into the new virtual base.

There is still the possibility that the merge of parents lead to
conflicts. File/Folder conclicts, conflicts on filemodes. This commit
only fixes the situation for conflicts when merging content.

Bug: 438203
Change-Id: If45bc3d078b3d3de87b758e71d7379059d709603
2014-07-28 14:52:07 +02:00
Christian Halstrick 289b7c60a9 Fixed message for exception thrown during recursive merge
During recursive merge jgit potentially has to merge multiple
common ancestors. If this fails because there are conflicts then
the exception thrown for that should have a message which states
this clearly. Previously a wrong message was given ("More than 200
merge bases ...")

Change-Id: Ia3c058d5575decdefd50390ed83b63668d31c1d1
2014-07-28 14:43:22 +02:00
Shawn Pearce d11ca1b084 HistogramDiff: Convert stack recursion to heap managed queue
Each time the longest common substring is found the diff algorithm
recurses to reprocess the regions before and after the common string.

Large files with many edits can trigger StackOverflowError as the
algorithm attempts to process a deeply split tree of regions. This
is especially prone to happen in servers where the Java stack size
may have been limited to 1M or even 256K.

To keep edits produced in order a queue is used to process edits
in a depth-first strategy.

Change-Id: Iae7260c6934efdffac7c7bee4d3633a8208924f7
2014-07-25 10:04:23 -07:00
Christian Halstrick 0c4553d28a Fix RecursiveMerger's internal use of merge to find a merge base
When RecursiveMerger tried to determine a common base tree it was
recursively tried to merge multiple common bases. But these intermediate
merges which have just been done to determine a single common base for
the final merge already filled some important fields (toBeCheckedOut,
toBeDeleted, ...). These side effects of the intermediate merges led to
wrong results of the final merge. One symptom was that after a recursive
merge which should be succesful you could still see leftover files in
the worktree: files which existed in the (virtual) common base but which
don't exist anymore in the branches to be merged.

The solution is easy: Clear the appropriate fields after common base
determination and start the final merge with a clean state.

Change-Id: I644ea9e1cb15360f7901bc0483cdb9286308c226
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-07-25 03:32:38 -04:00
Christian Halstrick cf9b01b09a Handle initial checkout correctly
As described in native gits file "git-read-tree.txt" git has in a
special mode when doing the "initial" checkout. "Initial" means that the
index is empty before the checkout. This was not handled correctly in
JGit and is fixed in this commit. Also see
https://github.com/git/git/blob/master/Documentation/git-read-tree.txt#L181

Change-Id: I9b9d1bd9ebf349cfca420c891c7b099a18d07ba4
2014-07-25 03:31:31 -04:00
Yuxuan 'fishy' Wang c7adc0c91c Added the missing export in MANIFEST.MF.
This fixes bug 440352.

Change-Id: I4b1c63087a97b7b2f3d7bdb5e066424a84ef6cef
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-07-24 08:19:33 -07:00
Konrad Kügler 48544e27ae Preserve merges during pull if configured to do so
Setting branch.<name>.rebase or pull.rebase to 'preserve' will preserve
merges during rebase. Also, pull.rebase is now consulted if there is no
branch-specific configuration.

Bug: 429664
Change-Id: I345fa295c7e774e0d0a8e6aba30fbfc3552e0084
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
2014-07-15 19:08:19 -04:00
Konrad Kügler e0fbae5dc3 Rebase: Add --preserve-merges support
With --preserve-merges C Git re-does merges using the rewritten merge
parents, discarding the old merge commit. For the common use-case of
pull with rebase this is unfortunate, as it loses the merge conflict
resolution (and other fixes in the merge), which may have taken quite
some time to get right in the first place.

To overcome this we use a two-fold approach:
If any of the (non-first) merge parents of a merge were rewritten, we
also redo the merge, to include the (potential) new changes in those
commits.
If only the first parent was rewritten, i.e. we are merging a branch
that is otherwise unaffected by the rebase, we instead cherry-pick the
merge commit at hand. This is done with the --mainline 1 and --no-commit
options to apply the changes introduced by the merge. Then we set up an
appropriate MERGE_HEAD and commit the result, thus effectively forging a
merge.

Apart from the approach taken to rebase merge commits, this
implementation closely follows C Git. As a result, both Git
implementations can continue rebases of each other.

Preserving merges works for both interactive and non-interactive rebase,
but as in C Git it is easy do get undesired outcomes with interactive
rebase.

CommitCommand supports committing merges during rebase now.

Bug: 439421
Change-Id: I4cf69b9d4ec6109d130ab8e3f42fcbdac25a13b2
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
2014-07-15 19:00:58 -04:00
Konrad Kügler b9a0077062 Repository.writeMergeHeads to accept a list with subtypes of ObjectId
Allows to pass for example a List<RevCommit>.

Change-Id: I5522707060d7d3e0d848ba579956dc62f8fa0234
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
2014-07-14 14:54:52 -04:00
Konrad Kügler 0f679dbda5 Cherry-Pick: Support --no-commit
Change-Id: Ic4c313a8971a5aa15745518c49e2587a1a0fe8d4
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
2014-07-14 20:01:04 +02:00
Robin Rosenberg 89ad10ec27 Handle diff formatting when there is nothing to compare with
DiffFormatter now suports either side being null and the log program
will output the diff for the first commit.

Bug: 395791
Change-Id: I378957b57e9ad1f7195ba416f402178453f0ebd3
2014-07-06 18:45:48 +02:00
Robin Rosenberg a03bdcbbb4 Don't warn for methods that can be static
Making the methods static would gain little in performance,
make the code harder to change. Removing unncessary warnings
is more important.

Change-Id: If3e6aa9c1d92e58b4e7a8e246cf4aace237d7a7b
2014-07-02 00:36:38 +02:00
Robin Rosenberg 8032b64980 Add new default settings from Eclipse 4.4
These settings were added by Eclipse simply by touching
the project settings. Adding these makes it simpler to see
what local changes have been made.

Change-Id: Iab0aa62530312eb0c78b03b5c6a632742bcc4978
2014-07-02 00:34:41 +02:00
Robin Stocker 26e0c533d0 Clarify comments in message properties files (and fix grammar)
Bug: 438261
Change-Id: I7b98475886ef789ae7635d8c9e008fc1aa00d534
Signed-off-by: Robin Stocker <robin@nibor.org>
2014-06-30 20:54:32 +10:00
Robin Rosenberg 844739baa1 Add a comment to the message properties files on how they are processed
Change-Id: I073f0c2c0729e6a5d3f1834203f0cfeb4c462eda
2014-06-29 15:55:53 +10:00
Robin Rosenberg 5054f36d4b Fix spelling error in error messgae
Change-Id: I5f712ba290592f7c5aa9ee865ff30383ad315247
2014-06-29 15:55:53 +10:00
Robin Rosenberg 350ba91585 Fix formatting errors in error messages
{} is plain wrong and is not accepted by MessageFormat, the other risk
becoming wrong if another single quote is introduced in the future and
sets a bad example.

Bug: 438261
Change-Id: I2948ca90c10f6ec2574f7f2b9be0a72821ea4daf
2014-06-29 15:55:53 +10:00
Matthias Sohn 64dde09b85 Merge branch 'stable-3.4'
* stable-3.4:
  Prepare 3.4.2-SNAPSHOT builds
  JGit v3.4.1.201406201815-r
  Allow retrying connecting SshSession in case of an exception

Change-Id: I7efb009b9e012637a16c57e2e93e074023b8e46c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-21 01:28:55 +02:00
Matthias Sohn 7865d7100e Prepare 3.4.2-SNAPSHOT builds
Change-Id: If88217d84b88cda6d04c159418d5bc86233fe28c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-21 00:57:43 +02:00
Matthias Sohn 03f6e83c40 JGit v3.4.1.201406201815-r
Change-Id: I4383a90fd91a243cd5ce5d0ae4e53874b36c1f47
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-21 00:16:29 +02:00
Stefan Lay 4b2b3294b8 Allow retrying connecting SshSession in case of an exception
Connecting to an SshSession may fail due to different reasons. Jsch for 
example often throws an com.jcraft.jsch.JschException: verify: false.[1]
The issue is still not fixed in JSch 0.1.51.
 
In such a case it is worth retrying to connect. The number of connection
attempts can be configured using ssh_config parameter
"ConnectionAttempts" [2].

Don't retry if the user canceled authentication.

[1] http://sourceforge.net/p/jsch/bugs/58/
[2] http://linux.die.net/man/5/ssh_config

Bug: 437656
Change-Id: I6dd2a3786b7d3f15f5a46821d8edac987a57e381
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-20 11:48:53 +02:00
Robin Rosenberg 79792c59b6 Remove no longer needed API breakage filters
Change-Id: I2ea2dec55c187b62662195bae810b3f0af8a2983
2014-06-15 23:34:59 +02:00
Robin Rosenberg 78cd2bb9e0 Remove an unnecessary semicolon
Change-Id: I6c5b085ae4a47d0026bd2b2341de76ab333936b9
2014-06-15 23:33:06 +02:00
Robin Rosenberg 447fd6a948 Remove an unnecessary $NON-NLS$ comment
Change-Id: I8335464061dac1c20de2b698f834e516ef78cf3d
2014-06-15 23:30:44 +02:00
Robin Rosenberg be025ff7d2 Merge "Enable NLS / TranslationBundle to be used in OSGi" 2014-06-15 15:58:29 -04:00
Dave Borowitz 7eb0b702fd Don't set REWRITE flag unless parent rewriting is requested
Change-Id: I65e3702ceb6c8854a2c358cfc2c2e3a9fb9486ff
2014-06-12 13:52:09 -07:00
Dave Borowitz eb69cef35c Rename RewriteTreeFilter to TreeRevFilter and make it public
The current behavior of passing a TreeFilter to RevWalk has limited
usefulness, since the RevFilter derived from the TreeFilter is always
ANDed together with any other RevFilters. It is also tied fairly
tightly to the parent rewriting mechanism.

Make TreeRevFilter a generic RevFilter that matches modified paths
against any TreeFilter. This allows for more complex logic like
(modified this path OR authored by this person).

Leave the rewrite flag logic in this class, since it's closely tied to
the parent comparison code, but hidden behind a protected constructor.

Change-Id: Ia72ef591a99415e6f340c5f64583a49c91f1b82f
2014-06-12 13:52:09 -07:00
Matthias Sohn 2a562b94d6 Add missing javadoc and since tag for RepoCommand.readFileFromRepo()
Change-Id: Ib0a98ce633e83c82a58b633c767e70d316b7254c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-12 10:50:03 +02:00
Matthias Sohn 126eb94f77 Prepare post 3.4.0 builds
Change-Id: I49f3741f3973b247a635f7c99b72309d2381a377
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-11 17:45:39 +02:00
Matthias Sohn d0daad884f JGit v3.4.0.201406110918-r
Change-Id: I56543234316f04bff4e45628bcb8286a6e52e31f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-11 15:20:26 +02:00
Yuxuan 'fishy' Wang afa2154e45 Refactor DefaultRemoteReader for easier code reuse
Change-Id: I7f326b4fc96198de7b424e15d8329bde7d7b39cf
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-06-10 16:21:42 -07:00
Robin Rosenberg 83846d1f6d Merge "Fixed the problem with calling LsRemoteCommand without a local repository over the ssh and git:// protocols." 2014-06-10 15:49:29 -04:00
Robin Rosenberg 79004dd42a Add missing @since to RepoCommand.setInputStream
Change-Id: I2fa1a5c28a1521a837aeaeb994e5cce8d7c4e645
2014-06-10 09:59:17 +02:00
Yuxuan 'fishy' Wang acd7ed5269 Added setInputStream to RepoCommand.
Sometimes an input stream is more useful than the filename of the xml manifest.

Change-Id: Icb09ac751b3d8d7eb14427ad1aac8cee0c371c5f
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-06-09 13:26:52 -04:00
Dave Borowitz c8ddac2a86 Merge "Better way to handle relative URLs in manifest XML" 2014-06-09 13:26:25 -04:00
Anton Bannykh f4943de29b Fixed the problem with calling LsRemoteCommand without a local repository over the ssh and git:// protocols.
Bug: 436695
Change-Id: Ifd69fbc04156fa4dacdcba6225768f43843eee97
Signed-off-by: Anton Bannykh <anton.bannykh@gmail.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-06-08 16:42:02 +02:00
Robin Rosenberg dc66469e11 LsRemoteCommand - internal execute need not be protected
Change-Id: I04d054d9f19e4ee200f72b25962be4759cfe5d7e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-08 01:32:17 +02:00
Robin Rosenberg 4dc3ba4327 Merge "Fix DeltaTask infinite loop" 2014-06-06 07:40:37 -04:00
Robin Rosenberg 926627fa41 Merge "Make JavaDoc validator happy by declaring GitAPIException on callAsMap" 2014-06-06 07:11:10 -04:00
Yuxuan 'fishy' Wang 39001eacc1 Better way to handle relative URLs in manifest XML
The old implementation will NOT strip the filename part from the baseUrl, e.g.
https://android.googlesource.com/platform/manifest with .. will be resolved to
https://android.googlesource.com/platform/, which is actually wrong. This
implementation will resolve it to https://android.googlesource.com/ to match the
behavior of repo.

Change-Id: Ia32c8b34e16eacdf37a0da7025bf0b5cc5f67ed2
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-06-05 17:40:37 -07:00
Hugo Arès d439c8dfe5 Fix DeltaTask infinite loop
DeltaTask$Block.partitionTask was doing an infinite loop if number of
threads was greater than the totalWeight. The weightPerThread was 0
which was causing the infinite loop. Set the weightPerThread to a
minimal value of one.

Bug: 420915
Change-Id: Ia8e3ad956d53d8193937b7fa1bc19aafde9767ff
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
2014-06-05 15:20:04 -04:00
Robin Rosenberg 64b0531c35 Prepare 3.5.0-SNAPSHOT builds
Change-Id: I53bd500188e09ae2e007a58b3cd89aa0805d6f2a
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2014-06-04 18:23:29 -04:00
Matthias Sohn f449f6b1c9 Merge branch 'stable-3.4'
* stable-3.4:
  Prepare post 3.4 RC3 builds
  JGit v3.4.0.201406041058-rc3
  blame: Un-break isFile check in tree walk
  Prepare post 3.4.0 RC2 builds
  JGit v3.4.0.201405281120-rc2
  Fix authentication type names broken by 0b5441a8
  Update Luna target platform to Orbit release R20140525021250

Change-Id: I344f1bbb8939bda01d524ec1a3218aa32bcc62f5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-04 23:29:09 +02:00
Matthias Sohn 3b83e1a398 Prepare post 3.4 RC3 builds
Change-Id: I9730bb349d0295c811aa3a9ba0f67bd946e86d1e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-04 22:14:52 +02:00
Matthias Sohn dd06dcdcf2 JGit v3.4.0.201406041058-rc3
Change-Id: If0cfec023788cae7713dd1ccc250e221365ef984
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-06-04 16:58:04 +02:00
Jonathan Nieder 9b46a47fb7 blame: Un-break isFile check in tree walk
Originally, blame's walk to find a scapegoat to blame for a file
walking backward from a commit used the test

	treeWalk.getFileMode(0).getObjectType() != OBJ_BLOB

to throw out gitlink (submodule) entries.  Later, 52500d3264 (blame:
Micro optimize blob lookup in tree, 2014-04-17) changed that test to

	(treeWalk.getRawMode(0) & TYPE_FILE) != TYPE_FILE

These checks are not the same, though: the older test accepts files
and symlinks, while the newer one accepts files, symlinks, and gitlink
(submodule) entries.  This is particularly broken in the submodule
case --- trying to parse the referred-to commit as a blob produces

	caught an exception: GET /gerrit/+blame/master/plugins/reviewnotes HTTP/1.1
	org.eclipse.jgit.errors.MissingObjectException: Missing blob 61702414c046dd6b811c9137b765f9db422f83db

Stick to just (possibly executable) files instead.  Symlinks are not
line-oriented data so blame on a symlink is not likely to be useful.

A quick grep for '& TYPE_' doesn't find any other instances of this
bug.

Change-Id: Iebcc91f1bee3c91adda51dccd6372e8302bf23fe
Signed-off-by: Jonathan Nieder <jrn@google.com>
2014-06-04 10:26:01 -04:00
Robin Rosenberg 9e7fa6dd33 Make JavaDoc validator happy by declaring GitAPIException on callAsMap
Change-Id: I9caa559a3d4eb0ec93d90cf1e18aed785ef85a84
2014-06-04 10:36:58 +02:00
Rüdiger Herrmann 02baeab4c4 Enable NLS / TranslationBundle to be used in OSGi
TranslationBundle#load() used to load resource bundles through
ResourceBundle#getBundle() without explicitly specifying a class loader.
In this case, the class laoder of the calling class (TranslationBundle
here) is used. This approach fails in runtime environments like OSGi
where there are multiple class loaders.

This change enables loading resource bundles in multi class loaders
environments. The fix is to pass the class loader of the
TranslationBundle-derived class to ResourceBundle#getBundle().

Bug: 436232
Change-Id: I39db61e012dc93ebf388a71bf6088a3310a22bac
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2014-06-01 11:59:21 +02:00
Matthias Sohn 386dff2271 Prepare post 3.4.0 RC2 builds
Change-Id: Id8d784ba7b0aba7c6a00f459bf1ac54c1d36d061
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-28 17:41:20 +02:00
Matthias Sohn 314fade855 JGit v3.4.0.201405281120-rc2
Change-Id: Ifd376f58cf867fc84d39582c49e971d998abf63d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-28 17:19:39 +02:00
Dani Megert 0b9bef49f4 Remove unused import
Change-Id: I6f59539350ab28605e2e1fe1f30354cd68aa7740
Signed-off-by: Dani Megert <Daniel_Megert@ch.ibm.com>
2014-05-28 07:53:28 -04:00
Yuxuan 'fishy' Wang eb98ebcc27 Unit test for the updating behavior in RepoCommand API.
When update the manifest against a bare repository, RepoCommand will replace
every existing content from the repository with contents populated from the
manifest. Added note for that and a unit test to make sure this behavior.

Change-Id: I1d5960e84bca5aa2a4e86f424d2ddd4197894cdc
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-05-27 12:50:15 -07:00
Matthias Sohn f80b41fbc1 Fix authentication type names broken by 0b5441a8
0b5441a8 introduced an enum for authentication types and changed the
case of digest and basic authentication type names to all uppercase.
This broke digest authentication at least when using Gerrit as the git
server. 

According to RFC2617 [1] "Basic" and "Digest" is the literal to be used
in authentication headers and not "BASIC" [1] and "DIGEST" [2].
According to RFC4559 "Negotiate" [3] is used for SPNEGO based
authentication.

[1] http://tools.ietf.org/html/rfc2617#page-5
[2] http://tools.ietf.org/html/rfc2617#page-8
[3] http://tools.ietf.org/html/rfc4559#page-3

Bug: 435866
Change-Id: I6173aff9352d7def225cafe2d73e5176ad40dff0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-27 10:20:42 +02:00
Yuxuan 'fishy' Wang 30cd891a48 Adds a callAsMap() function to LsRemoteCommand.
The call() function of LsRemoteCommand returns Collection<Ref>, while its
internal is using Map<String, Ref> all the time. Sometimes the map is much more
useful to the caller so add a callAsMap() function to keep the API
compatibility.

Change-Id: Icb96b71277d5e2de59872aa777352dedc048c4e3
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2014-05-24 12:19:23 -07:00
Andreas Hermann 44f81d956b Allow to include untracked files in stash operations.
Unstashed changes are saved in a commit which is added as an additional
parent to the stash commit.
This behaviour is fully compatible with C Git stashing of untracked
files.

Bug: 434411
Change-Id: I2af784deb0c2320bb57bc4fd472a8daad8674e7d
Signed-off-by: Andreas Hermann <a.v.hermann@gmail.com>
2014-05-22 23:56:08 +02:00
Andreas Hermann b7e46c07f9 Fix for reflog corruption caused by multiline message
If a client passes a multiline message as argument to ReflogWriter.log()
the Reflog gets corrupted and cannot be parsed. ReflogWriter.log() is
invoked implicitly from various commands such as StashCreate, Rebase and
many more. However the message is not always filtered for line feeds.

Such an example is the StashCreateOperation of EGit which passes
unchecked user input as commit message. If a multiline comment is pasted
to the stash create dialog, the reflog gets corrupted.

ReflogWriter now replaces line endings in log message with spaces.

Bug: 435509
Change-Id: I3010cc902e13bee4d7b6696dfd11ab51062739d3
Signed-off-by: Andreas Hermann <a.v.hermann@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-22 22:58:44 +02:00
Konrad Kügler 7d6dcd4b34 Improve layout of branches in the commit graph
The aim of this change is to place all commits of a branch on the same
lane and commits of other (side) branches on different lanes.

The algorithm treats first parents of a commit specially by placing them
on the same lane as the commit itself. When a commit is the first parent
of multiple children it could be placed on any of these children's
lanes. In this case it is placed on the longest child lane, as this is
usually the lane of the branch the commit actually was made on.

Other (non-first) parents are placed on new lanes. This creates a layout
that should make it easier to see branches and merges and follow linear
branch histories.
This differs from the previous approach, which sometimes plotted the
commits of a side branch on the same lane as the base branch commits and
further commits on the base branch appeared on a different lane.
This made the base branch appear as if it was the side branch and
the side branch appears to be the base branch.

In addition to lane assignment, also the plotting code changed to start
drawing a branch lane from the commit where it forks out. Previously it
started only when the first commit on the branch appeared.

Active lanes are continued with every commit that is processed.
Previously lanes were only continued when the next commit on the lane
was encountered. This could produce (temporarily) dangling commits if
the next commit on the lane was not processed yet.

CQ: 8299
Bug: 419359
Bug: 434945
Change-Id: Ibe547aa24b5948ae264f7d0f56a492a4ef335608
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-22 22:34:22 +02:00
Konrad Kügler c4f3856b39 PlotCommitList: Remove handling of children that have no lane yet
Child commits always have a lane assigned when their parents are
processed, so this code is no longer necessary.

Children only assign themselves to parents in
PlotCommitList.setupChildren(), which is called from enter(), when the
child is processed. If the child leaves enter() it should always have a
lane assigned. As a result of this, when processing a parent, all its
known children already have lanes assigned. If the underlying RevWalk
emits a parent before one of its children (which it should not do), the
parent does not know of the child emitted later, because setupChildren()
has not been called for the child yet. So even in this case, no child
without a lane is encountered when processing a (parent) commit.

Change-Id: I982adc5c114370ecfd699d96221a76463de900ca
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-22 22:29:26 +02:00
Konrad Kügler 09f6b1878a PlotCommitList: Refactor lane creation and position allocation
This also properly removes the newly determinded lane position from the
freePositions set in handleBlockedLanes(). closeLane() does only recycle
active lanes, to avoid recycling lanes twice.

Change-Id: Icd019fcf7974441ed05686bb61d6de4e8bf4ab7c
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-22 22:28:50 +02:00
Matthias Sohn 18fdb5684f Add missing since tags
Change-Id: I6090b81aa963731af369babbe71b05ac817ee3dc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-05-21 22:34:17 +02:00