]> source.dussan.org Git - jgit.git/log
jgit.git
12 years agoMerge changes I4f73487b,I1d1ed122
Matthias Sohn [Tue, 21 Aug 2012 20:59:42 +0000 (16:59 -0400)]
Merge changes I4f73487b,I1d1ed122

* changes:
  The Git API's only likes /, not \ in paths
  Skip a test that cannot be verified on Windows

12 years agoThe Git API's only likes /, not \ in paths 28/7328/1
Robin Rosenberg [Tue, 21 Aug 2012 16:21:17 +0000 (18:21 +0200)]
The Git API's only likes /, not \ in paths

Therefore this test fails on Windows

Change-Id: I4f73487b720ea1479e95108344f1dc3711106408

12 years agoSkip a test that cannot be verified on Windows 27/7327/1
Robin Rosenberg [Tue, 21 Aug 2012 16:17:31 +0000 (18:17 +0200)]
Skip a test that cannot be verified on Windows

Change-Id: I1d1ed122c714f39ca7fb557224756205274804eb

12 years agoTeach BranchTrackingStatus to handle tracking of local branches 91/7191/4
Matthias Sohn [Fri, 17 Aug 2012 22:29:45 +0000 (00:29 +0200)]
Teach BranchTrackingStatus to handle tracking of local branches

EGit wasn't able to decorate local branches tracking another local
branch with number of commits the checked out local branch differs from
the other local branch it's tracking.

Bug: 376970
Change-Id: I74e932d5eacd74dbf6b0dffcfc65ba3222a8250e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoImprove ours/theirs conflict markers for rebase, cherry-pick 22/7222/3
Robin Stocker [Fri, 17 Aug 2012 22:11:45 +0000 (00:11 +0200)]
Improve ours/theirs conflict markers for rebase, cherry-pick

On conflicts in rebase or cherry-pick, the conflict markers were like
this:

    <<<<<<< OURS
    a
    =======
    b
    >>>>>>> THEIRS

This is technically correct, but it could be better.

It's especially confusing during a rebase, where the meaning of
OURS/THEIRS is not obvious. The intuition is that "ours" is the commits
that "I" did before the rebase, but it's the other way around because of
the way rebase works. See various bug reports and stackoverflow
discussions.

With this change, in the case of a cherry-pick while on master, the
markers will be like this:

    <<<<<<< master
    a
    =======
    b
    >>>>>>> bad1dea Message of the commit I'm cherry-picking

In the case of a "git rebase master":

    <<<<<<< Upstream, based on master
    a
    =======
    b
    >>>>>>> b161dea Message of a commit I'm rebasing

It's not "master" because that would only be correct for the first
cherry-pick during a rebase, after that, it's master + already
cherry-picked commits.

And in the case of a "git pull --rebase":

    <<<<<<< Upstream, based on branch 'master' of git@example.org:repo
    a
    =======
    b
    >>>>>>> b161dea Message of a commit I'm rebasing

Bug: 336819
Change-Id: I1333a8dd170bb0077f491962013485efb6f2a926
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge changes Ie949f321,I403de522
Shawn Pearce [Wed, 15 Aug 2012 19:31:33 +0000 (15:31 -0400)]
Merge changes Ie949f321,I403de522

* changes:
  Implement wasDeltaAttempted() in DfsObjectRepresentation.
  Do not delta compress objects that have already tried to compress.

12 years agoFix idOffset when the working tree iterator matches a dircache entry 31/7231/4
Robin Rosenberg [Wed, 15 Aug 2012 12:33:16 +0000 (14:33 +0200)]
Fix idOffset when the working tree iterator matches a dircache entry

idOffset is not zero when idBuffer comes from blob in the dircache

Change-Id: Iff768422cba140a5d6a776e2c627b852f079c1da

12 years agoImplement wasDeltaAttempted() in DfsObjectRepresentation. 13/7213/1
Colby Ranger [Mon, 13 Aug 2012 22:54:06 +0000 (15:54 -0700)]
Implement wasDeltaAttempted() in DfsObjectRepresentation.

In DFS, everything is stored in a pack but only objects in a pack with
source GC or UNREACHABLE_GARBAGE have had delta compression attempted.
Expose the PackSource setter and getter on DfsPackDescription in order
to implement wasDeltaAttempted.

Change-Id: Ie949f321147ad870f1c3f23b552343bbbda32152

12 years agoDo not delta compress objects that have already tried to compress. 11/7211/2
Colby Ranger [Mon, 13 Aug 2012 20:52:33 +0000 (13:52 -0700)]
Do not delta compress objects that have already tried to compress.

If an object is in a pack file already, delta compression will not
attempt to re-compress it. This assumes that the previous
packing already performed the optimal compression attempt, however,
the subclasses of StoredObjectRepresentation may use other heuristics
to determine if the stored format is optimal.

Change-Id: I403de522f4b0dd2667d54f6faed621f392c07786

12 years agoMerge "Allow JGit to read C Git rebase state"
Christian Halstrick [Mon, 13 Aug 2012 13:43:42 +0000 (09:43 -0400)]
Merge "Allow JGit to read C Git rebase state"

12 years agoMake CheckoutCommand pass modified files through result 37/5337/9
Markus Duft [Mon, 4 Jun 2012 13:37:53 +0000 (15:37 +0200)]
Make CheckoutCommand pass modified files through result

This change makes CheckoutCommand pass the list of modified files
through the OK result, enabling outside world to react in a smaller
scope (for example refresh only resources containing the modified
files).

Change-Id: I53c50ee09bc0d3ff501bdc25196e52e739c3f1f9
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoAllow JGit to read C Git rebase state 18/7118/2
Robin Rosenberg [Tue, 7 Aug 2012 14:49:45 +0000 (16:49 +0200)]
Allow JGit to read C Git rebase state

C Git prefixes the time stamp in the author script with a "@"

Change-Id: I140b29519acc101da78296eef562368fc6b61135

12 years agoAllow detection of case insensitive file systems 28/6028/3
Matthias Sohn [Fri, 18 May 2012 14:52:50 +0000 (16:52 +0200)]
Allow detection of case insensitive file systems

Change-Id: I03f59d07bcc3338ef8d392cbd940799186ca03bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
12 years agoEnsure a directory exists before trying to create/merge a file into it. 96/7096/5
Jevgeni Zelenkov [Mon, 6 Aug 2012 06:59:28 +0000 (08:59 +0200)]
Ensure a directory exists before trying to create/merge a file into it.

Since git doesn't keep track of empty directories, they should be
created first. Test case included demonstrates that using
StashApplyCommand(). Bugfix is applied to the DirCacheCheckout class,
because StashApplyCommand() uses it internally to apply a stash.

Change-Id: Iac259229ef919f9e92e7e51a671d877172bb88a8
Signed-off-by: Jevgeni Zelenkov <jevgeni.zelenkov@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge "Fix PlotCommit for commits with duplicate parents"
Robin Rosenberg [Sun, 5 Aug 2012 10:51:27 +0000 (06:51 -0400)]
Merge "Fix PlotCommit for commits with duplicate parents"

12 years agoFix PlotCommit for commits with duplicate parents 92/6592/3
Robin Rosenberg [Sun, 5 Aug 2012 10:50:06 +0000 (12:50 +0200)]
Fix PlotCommit for commits with duplicate parents

JGit allows to create commits which have duplicate parents: e.g. a
commit X has first parent Y and second parent Y. Such commits are not
handled correctly by PlotCommit leading to wrong display of the history
in EGit. In such cases there is a never ending passing line drawn beside
all commits younger than the commit with duplicate parents. This commit
fixes this by explicitly checking for duplicate parents.

In a different commit we should fix JGit not to create commits with
duplicate parents. I think native git also doesn't allow such commits,
although history display in native git (gitk, git log --graph) is not
damaged by such commits.

Change-Id: Ie3019ef613a507023958bea27b1badc3b8950279

12 years agoMerge "Update the README file to refer to the EDL rather than BSD license."
Shawn Pearce [Wed, 1 Aug 2012 21:29:04 +0000 (17:29 -0400)]
Merge "Update the README file to refer to the EDL rather than BSD license."

12 years agoUpdate the README file to refer to the EDL rather than BSD license. 39/7039/1
Robin Rosenberg [Wed, 1 Aug 2012 21:25:20 +0000 (23:25 +0200)]
Update the README file to refer to the EDL rather than BSD license.

The wordings of the two license are the same. This change is there
to make this file consistent with the LICENSE file.

Change-Id: I7c9d7a8f3622dd4099ca311af3dd032034bf56c0

12 years agoMerge "Fix resolving of relative file URIs in TransportLocal"
Robin Rosenberg [Sun, 29 Jul 2012 22:31:39 +0000 (18:31 -0400)]
Merge "Fix resolving of relative file URIs in TransportLocal"

12 years agoMerge "Garbage collector for FileRepositories"
Robin Rosenberg [Sun, 29 Jul 2012 14:16:22 +0000 (10:16 -0400)]
Merge "Garbage collector for FileRepositories"

12 years agoGarbage collector for FileRepositories 05/4705/21
Christian Halstrick [Wed, 9 May 2012 08:45:17 +0000 (10:45 +0200)]
Garbage collector for FileRepositories

Implements a garbage collector for FileRepositories. Main ideas are
copied from the garbage collector for DFS based repos
(DfsGarbageCollector). Added functionalities are
- pruning loose objects
- handling of the index
- packing refs
- handling of reflogs (objects referenced from reflog will not be
pruned/)

These are features of a GC which are not handled in this change and
which should come with subsequent changes:
- unpacking packed objects into loose objects (to support that pruning
packed objects doesn't delete them until they are older than two weeks)
- expiration of reflogs
- support for configuration parameters (e.g. gc.pruneExpire)

Change-Id: I14ea5cb7e0fd1b5c50b994fd77f4e05bfbb9d911
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
12 years agoMerge "Expose some DFS APIs as public or protected"
Shawn O. Pearce [Sun, 29 Jul 2012 05:01:35 +0000 (01:01 -0400)]
Merge "Expose some DFS APIs as public or protected"

12 years agoExpose some DFS APIs as public or protected 79/6979/2
Shawn O. Pearce [Mon, 23 Jul 2012 22:50:52 +0000 (15:50 -0700)]
Expose some DFS APIs as public or protected

Expose class DfsReader and method DfsPackFile.hasObject() as public.
Applications may want to be able to inquire about some details of
the storage of a repository. Make this possible by exposing some
simple accessor methods.

Expose method DfsObjDatabase.clearCache() as protected, allowing
implementing subclasses to dump the cache if necessary, and force
it to reload on a future request.

Change-Id: Ic592c82d45ace9f2fa5f8d7e4bacfdce96dea969

12 years agoFix resolving of relative file URIs in TransportLocal 96/6996/1
Robin Stocker [Fri, 27 Jul 2012 09:53:51 +0000 (11:53 +0200)]
Fix resolving of relative file URIs in TransportLocal

A configured remote url like "../repo" works with C Git.

In JGit, it only worked if Java's current working directory happened to
be the local repository working directory.

Change-Id: I33ba3f81b37d03cf17ca7ae25a90774a27e7e02b
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoMerge "[findBugs] Make ChunkKey serializable"
Robin Rosenberg [Thu, 26 Jul 2012 21:21:51 +0000 (17:21 -0400)]
Merge "[findBugs] Make ChunkKey serializable"

12 years agoAgain teach ResolveMerger to create more correct DirCacheEntry's 78/6978/1
Christian Halstrick [Thu, 26 Jul 2012 14:20:38 +0000 (16:20 +0200)]
Again teach ResolveMerger to create more correct DirCacheEntry's

Currently, after a merge/cherry-pick/rebase, all index entries are
smudged as the ResolveMerger never sets entry lengths and/or
modification times. This change teaches it to re-set them at least for
things it did not touch. The other entries are then repaired when the
index is persisted, or entries are checked out.

The first attempt to get this in was commit
3ea694c2523d909190b5350e13254a62e94ec5d5 which has been reverted.
Since then some fixes to ResolveMerger and a few more tests have
been added which check situations where the index is not matching
HEAD before we merge.

Change-Id: I648fda30846615b3bf688c34274c6cf4bc857832
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Also-by: Markus Duft <markus.duft@salomon.at>
12 years agoMerge "Revert "Teach ResolveMerger to create more correct DirCacheEntry's""
Shawn Pearce [Wed, 25 Jul 2012 14:59:32 +0000 (10:59 -0400)]
Merge "Revert "Teach ResolveMerger to create more correct DirCacheEntry's""

12 years agoRevert "Teach ResolveMerger to create more correct DirCacheEntry's" 53/6953/1
Shawn Pearce [Wed, 25 Jul 2012 00:07:48 +0000 (20:07 -0400)]
Revert "Teach ResolveMerger to create more correct DirCacheEntry's"

This reverts commit 3ea694c2523d909190b5350e13254a62e94ec5d5

Merges with unmodified subtrees are broken with this commit present.
Back it out until a fixed version can be supplied.

12 years agoMerge "Teach ResolveMerger to create more correct DirCacheEntry's"
Robin Rosenberg [Thu, 19 Jul 2012 13:26:23 +0000 (09:26 -0400)]
Merge "Teach ResolveMerger to create more correct DirCacheEntry's"

12 years agoTeach ResolveMerger to create more correct DirCacheEntry's 46/6646/8
Markus Duft [Tue, 17 Jul 2012 16:32:38 +0000 (18:32 +0200)]
Teach ResolveMerger to create more correct DirCacheEntry's

Currently, after a merge/cherry-pick/rebase, all index entries are
smudged as the ResolveMerger never sets entry lengths and/or
modification times. This change teaches it to re-set them at least for
things it did not touch. The other entries are then repaired when the
index is persisted, or entries are checked out.

Change-Id: I0944f2017483d32043d0d09409b13055b5609a4b
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
12 years agoshow: Implement command line show for any object 57/1557/4
Shawn O. Pearce [Wed, 8 Sep 2010 04:40:11 +0000 (21:40 -0700)]
show: Implement command line show for any object

Change-Id: I4dea84428d48b3de0e187c510b766f965323b21b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoFix "description" in o.e.jgit.source.feature/feature.properties 12/6112/3
Tomasz Zarna [Mon, 16 Jul 2012 22:37:03 +0000 (00:37 +0200)]
Fix "description" in o.e.jgit.source.feature/feature.properties

Currently, update manager displays the comment message (starting with
"###...") which should not be part of the description.

Change-Id: I1c748cd5987b30f25aca3ca8eb593448bcf128ae
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMake ApplyCommand create missing parent directories for new files 73/6673/3
Markus Duft [Mon, 9 Jul 2012 10:47:52 +0000 (12:47 +0200)]
Make ApplyCommand create missing parent directories for new files

Otherwise applying will fail with a FileNotFoundException, because
File.createNewFile() fails with missing parents.

Contains change & according test.

Change-Id: I970522b549b8bb260ca6720da11f12c57ee8a492
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoMerge "Rename local variables in Repository.resolve"
Christian Halstrick [Mon, 16 Jul 2012 08:09:12 +0000 (04:09 -0400)]
Merge "Rename local variables in Repository.resolve"

12 years ago[findBugs] Make ChunkKey serializable 86/6786/1
Robin Stocker [Sun, 15 Jul 2012 16:05:15 +0000 (18:05 +0200)]
[findBugs] Make ChunkKey serializable

It's used in DhtMissingChunkException, which is serializable.

Change-Id: I2b76bc1bc373efd44214be4598a03c62c681a200
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoTypo in CLIText#unknownMergeStratey, should be #unknownMergeStrategy 40/6040/2
Tomasz Zarna [Sun, 20 May 2012 10:00:46 +0000 (12:00 +0200)]
Typo in CLIText#unknownMergeStratey, should be #unknownMergeStrategy

Change-Id: I4d4aa59723d6422ff755165e45f368da76d309ab
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoRename local variables in Repository.resolve 72/6772/1
Robin Rosenberg [Tue, 10 Jul 2012 22:56:42 +0000 (00:56 +0200)]
Rename local variables in Repository.resolve

This is to prepare for extension. The new names better reflect
the content of the variables.

Change-Id: Ic2b4741ab33223aa7f239915d9138b254890bf7b

12 years agoGet rid of warning about possible NullPointerException 41/6441/3
Robin Rosenberg [Wed, 6 Jun 2012 00:32:43 +0000 (02:32 +0200)]
Get rid of warning about possible NullPointerException

Do this by using one of the two references that are dependent
of checkReferencedIsReachable.

Change-Id: I4f16916c62ed8ea434013925f49fb03fe57b7d7e

12 years agoMerge "Work around smart HTTP bugs in C Git"
Shawn O. Pearce [Wed, 11 Jul 2012 18:07:30 +0000 (14:07 -0400)]
Merge "Work around smart HTTP bugs in C Git"

12 years agoCreate parent dir if necessary on checkout 66/6666/1
Robin Stocker [Sun, 8 Jul 2012 12:48:39 +0000 (14:48 +0200)]
Create parent dir if necessary on checkout

An example where this is necessary is when a whole directory was deleted
and checkout is used to restore a file which was in that directory.

Bug: 372133
Change-Id: I1d45e0a5d2525fe1fdfbf08c9c5c166dd909e9fd
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoMerge branch 'stable-2.0' 88/6588/1
Matthias Sohn [Mon, 2 Jul 2012 20:18:59 +0000 (22:18 +0200)]
Merge branch 'stable-2.0'

* stable-2.0:
  Improve performance of persisting an index by magnitudes

Change-Id: I880f4d0be81c263b598ee24e8373c6f8cb781c51
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoImprove performance of persisting an index by magnitudes 35/6535/2 stable-2.0
Christian Halstrick [Thu, 28 Jun 2012 18:06:29 +0000 (11:06 -0700)]
Improve performance of persisting an index by magnitudes

When updating smudged entries use a pathfilter to iterate only over
working tree files which have an associated smudged index entry.

Commit dac66672df0535f61a13273524d46e1e0012ca69 introduced that we
check and update smudged entries while persisting a dircache. Before
that commit adding a file to git caused  file i/o for the index file,
the object database (to store new content) and all files we wanted to
add (to read new content). After that commit we have additionally file
i/o for every file in the working tree (even ignored files).
Especially on windows iterating over the working tree can be very
time consuming. This decreased the performance of persisting a dircache
dramatically (I measured factors 4 to 10 while adding a file to linux
kernel repo). One could easily see this effect when dragging&dropping
modified files in a linux kernel repo in the egit staging view.

Change-Id: I568dec77635013cf6bb46f652d3f2b89de041c82
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoWork around smart HTTP bugs in C Git 31/6531/4
Shawn O. Pearce [Wed, 27 Jun 2012 18:06:37 +0000 (11:06 -0700)]
Work around smart HTTP bugs in C Git

I have unfortunately introduced a few bugs in the native Git client
over the years. 1.7.5 is unable to send chunked requests correctly,
resulting in corrupt data at the server. Ban this client whenever
it uses chunked encoding with an error message.

Prior to some more recent versions, git push over HTTP failed to
report status information and error messages due to a race within
the client and its helper process. Check for these bad versions and
send errors as messages before the status report, enabling users
to see the failures on their terminal.

Change-Id: Ic62d6591cbd851d21dbb3e9b023d655eaecb0624

12 years agoMake InMemoryRepository pack names globally unique 32/6532/1
Dave Borowitz [Wed, 27 Jun 2012 20:55:25 +0000 (13:55 -0700)]
Make InMemoryRepository pack names globally unique

It was easy to create multiple packs with exactly the same name and
same DfsRepositoryDescription in a test, which can poison the
DfsBlockCache. The javadoc for DfsObjDatabase.newPack() explicitly
says pack names should be unique within an entire DFS, so do this by
making the packId AtomicInteger static.

Arguably, test writers shouldn't be doing things like putting
'new DfsRepositoryDescription("test")' in a setUp() method, but that's
a natural thing to do, and we don't document this restriction
anywhere.

Change-Id: I9477413ab3950d83b7d17e173fbc0a3e064896e3

12 years agoMerge "Disable PackParser EOF check if more data expected"
Shawn Pearce [Wed, 27 Jun 2012 14:26:40 +0000 (10:26 -0400)]
Merge "Disable PackParser EOF check if more data expected"

12 years agoDisable PackParser EOF check if more data expected 23/6523/1
Ian Wetherbee [Tue, 26 Jun 2012 23:42:09 +0000 (16:42 -0700)]
Disable PackParser EOF check if more data expected

The PackParser EOF check is incompatible with the expect data after
pack footer flag, so turn off the EOF check if the expecting data
flag is true.

Change-Id: I697ebd9e1d1eed765d00aecaef955cf978cfd0b9

12 years agoUse the working tree's .gitmodules in SubmoduleWalk.forIndex() 02/6502/4
Dave Borowitz [Mon, 25 Jun 2012 17:46:36 +0000 (10:46 -0700)]
Use the working tree's .gitmodules in SubmoduleWalk.forIndex()

This was broken in fe1f1b8f8aba60fdd1ad6f0f72e9c9180978cc60, which
preferred the index over the working tree when both were present.

Change-Id: I97dcf9a088adcbd0187fa7eec9ef34445ce3a981
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoMerge changes I6b2ce96b,I499f518f
Christian Halstrick [Mon, 25 Jun 2012 07:08:03 +0000 (03:08 -0400)]
Merge changes I6b2ce96b,I499f518f

* changes:
  Fix order of deletion for files/dirs in ResolveMerger
  Don't return success on failing paths in ResolveMerger

12 years agoAdd toString() to simplify debugging rebase steps 77/6477/1
Matthias Sohn [Sat, 23 Jun 2012 23:00:31 +0000 (01:00 +0200)]
Add toString() to simplify debugging rebase steps

Change-Id: Id1508c5f007a6a6680928992a1c7524c266a9ce4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoIgnore empty lines when parsing git-rebase-todo 37/6237/2
Robin Stocker [Mon, 4 Jun 2012 13:35:16 +0000 (15:35 +0200)]
Ignore empty lines when parsing git-rebase-todo

When starting a rebase with C Git, there may be empty lines in the
git-rebase-todo file. Before this change, JGit would fail to parse the
file with e.g. the following exception:

  JGitInternalException: Unknown or unsupported command "
  #", only "pick" is allowed.

This happened when there was an empty line just before the comments,
because the nextSpace would be the one from the comment. Now the empty
lines are ignored by checking for nextSpace < ptr outside of the loop.

Change-Id: I94ad299f367c846e7729c74f49c6b8f93f75ae81
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoFix order of deletion for files/dirs in ResolveMerger 27/6327/2
Robin Stocker [Tue, 12 Jun 2012 17:03:52 +0000 (19:03 +0200)]
Fix order of deletion for files/dirs in ResolveMerger

Before, the paths to delete were stored in a HashMap, which doesn't have
a particular order. So when e.g. both the file "a/b" and the directory
"a" were to be deleted, it would sometimes try to delete "a" first. This
resulted in a failed path because File#delete() fails when a directory
isn't empty.

With this change, an ArrayList is used for storing the paths to delete.
The list contains the paths in a top-down order, as defined by the order
of processEntry. When the files are deleted, the list is iterated in
reverse, ensuring that all files of a directory are deleted before the
directory itself.

Bug: 354099
Change-Id: I6b2ce96b3932ca84ecdfbeab457ce823c95433fb
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoDon't return success on failing paths in ResolveMerger 26/6326/2
Robin Stocker [Tue, 12 Jun 2012 16:12:14 +0000 (18:12 +0200)]
Don't return success on failing paths in ResolveMerger

ResolveMerger#mergeImpl() was only returning false (= failed) when there
were unmerged paths. In the case when there were only failing paths, it
returned true.

Because MergeCommand looks at the return value for determining if the
merge failed, it would fall into the successful case there, where it
should instead return a MergeResult with MergeStatus.FAILED.

This change adds a test case for this and makes the ResolveMerger return
false when there are failing paths.

This was discovered while working on fixing bug 354099 and is needed for
its test case.

Bug: 354099
Change-Id: I499f518f6289ef93e017db924b2aa857f2154707
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoMerge "Serve 403 from RepositoryFilter on ServiceMayNotContinueException"
Shawn Pearce [Thu, 21 Jun 2012 14:45:41 +0000 (10:45 -0400)]
Merge "Serve 403 from RepositoryFilter on ServiceMayNotContinueException"

12 years agoMake clear method on StoredConfig public 40/6440/2
Robin Rosenberg [Wed, 20 Jun 2012 23:07:36 +0000 (01:07 +0200)]
Make clear method on StoredConfig public

EGit needs this to be able to revert unsaved changes.

Change-Id: I50cc8056aaff47fef6080970866962e3eb634e29
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoServe 403 from RepositoryFilter on ServiceMayNotContinueException 60/6460/1
Dave Borowitz [Wed, 20 Jun 2012 21:53:59 +0000 (14:53 -0700)]
Serve 403 from RepositoryFilter on ServiceMayNotContinueException

This has no effect on Git clients, but for browsers, 403 Forbidden may
be more appropriate. 500 Internal Server Error implies that there is
a problem with the server, whereas ServiceMayNotContinueException is
specifically intended to cover cases where the server is functioning
correctly but has determined that the request may not proceed.

Change-Id: I825abd2a029d372060103655eabf488a0547c1e8

12 years agoMerge "Fix boxing warnings in org.eclipse.jgit.lib.ConfigTest"
Shawn Pearce [Mon, 18 Jun 2012 16:01:49 +0000 (12:01 -0400)]
Merge "Fix boxing warnings in org.eclipse.jgit.lib.ConfigTest"

12 years agoFix boxing warnings in org.eclipse.jgit.lib.ConfigTest 07/6107/2
Tomasz Zarna [Mon, 18 Jun 2012 15:41:34 +0000 (17:41 +0200)]
Fix boxing warnings in org.eclipse.jgit.lib.ConfigTest

Change-Id: Ie6ae7ade36a117c22c656f792266d4116d52b9bc

12 years agoMerge "Refactor TransportHttp for long-polling"
Shawn Pearce [Sat, 16 Jun 2012 19:31:26 +0000 (15:31 -0400)]
Merge "Refactor TransportHttp for long-polling"

12 years agoMerge "ReceivePack supports InputStream data after pack"
Shawn Pearce [Sat, 16 Jun 2012 19:28:19 +0000 (15:28 -0400)]
Merge "ReceivePack supports InputStream data after pack"

12 years agoIn org.eclipse.jgit.pgm.ConfigTest expect core.filemode=false on Windows 05/6105/3
Tomasz Zarna [Fri, 15 Jun 2012 22:26:31 +0000 (00:26 +0200)]
In org.eclipse.jgit.pgm.ConfigTest expect core.filemode=false on Windows

Change-Id: I8f8ae7a8bc0793643184bc0e7afa9f4e2c5ff1a1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoFix resource leaks due to unclosed repositories 43/6343/3
Christian Halstrick [Fri, 15 Jun 2012 22:19:51 +0000 (00:19 +0200)]
Fix resource leaks due to unclosed repositories

Whenever a call to JGit returns a Repository the caller should make sure
to call close() on it if he doesn't need it anymore. Since instances of
Repository contain e.g. open FileOutputStreams (for pack files)
forgetting to close the repository can lead to resource leaks.

This was the reason why dozens of the JUnit tests failed on Windows
with "Can't delete file ...." errors.

In LocalDiskRepositoryTestCase.tearDown() we tried to delete the
repositories we used during tests which failed because we had open
FileOutputStreams.

Not only the obvious cases during Clone or Init operations returned
Repositories, but also the new SubModule API created repository
instances. In some places we even forgot to close submodule repositories
in our internal coding.

To see the effects of this fix run the JGit JUnit tests under Windows.
On other platforms it's harder to see because either the leaking
resources don't lead to failing JUnit tests (on Unix you can delete
files with open FileOutputStreams) or the java gc runs differently and
cleans up the resources earlier.

Change-Id: I6d4f637b0d4af20ff4d501db091548696373a58a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoReceivePack supports InputStream data after pack 59/6359/3
Ian Wetherbee [Thu, 7 Jun 2012 02:29:34 +0000 (19:29 -0700)]
ReceivePack supports InputStream data after pack

When receiving a pack, data buffered after the pack can restored
to the InputStream if the stream supports mark and reset.

Change-Id: If04915c32c91be28db8df7e8491ed3e9fe0e1608

12 years agoFix LockFileTest on Windows 42/6342/2
Christian Halstrick [Fri, 15 Jun 2012 22:06:50 +0000 (00:06 +0200)]
Fix LockFileTest on Windows

LockFileTest was failing on Windows because we couldn't delete the lock
file of the index. The reason was that a LockFile instance still had an
open handle to the lock file preventing us to delete the file (in
contrast to the behavior on other platforms).

Change-Id: I1d50442b7eb8a27f98f69ad77c5e24a9698a7b66
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoRefactor TransportHttp for long-polling 61/6361/2
Ian Wetherbee [Thu, 7 Jun 2012 23:10:09 +0000 (16:10 -0700)]
Refactor TransportHttp for long-polling

Split Service into MultiRequestService (fetch, push) and
LongPollService (upcoming publish-subscribe).

Change-Id: Ice373d3dee63c395490d2707473ccf20a022e5cf

12 years agoRead .gitmodules config from the tree in SubmoduleWalk 67/6367/5
Dave Borowitz [Thu, 14 Jun 2012 22:07:13 +0000 (15:07 -0700)]
Read .gitmodules config from the tree in SubmoduleWalk

It is not always appropriate to use the .gitmodules file from the
working tree, for example if reading the modules at a specific commit.
And sometimes it is impossible, as in a bare repository.

When using the static factory methods, automatically set up the
appropriate root tree so lazy loading of the config file reads from
the appropriate place. Leave the current behavior of looking in the
working tree as a fallback for the case where walking the index.

Change-Id: I71b7ed3ba16c80b0adb8c5fd85b5c37fd4aef8eb

12 years agoAdd a CommitBuilder method to edit arbitrary DirCacheEntrys 77/6377/2
Dave Borowitz [Fri, 15 Jun 2012 18:05:12 +0000 (11:05 -0700)]
Add a CommitBuilder method to edit arbitrary DirCacheEntrys

Change-Id: Ic2f5ec28621219a8ff1272674e2bf2c8d36eb107

12 years agoAdd a release() method to SubmoduleWalk 66/6366/2
Dave Borowitz [Thu, 14 Jun 2012 22:06:09 +0000 (15:06 -0700)]
Add a release() method to SubmoduleWalk

We need a way to release the underlying TreeWalk. Also, use this
method to release walks from the static factory methods on error or
when submodules are not found.

Change-Id: I6bedc2db78bcd577aef2cfe6715bb981a26dcfd7

12 years agoAdd "--squash" option to MergeCommand 95/4995/12
Tomasz Zarna [Wed, 13 Jun 2012 21:28:55 +0000 (23:28 +0200)]
Add "--squash" option to MergeCommand

CQ: 6570
Bug: 351806
Change-Id: I5e47810376419264ecf4247b5a333af5c8945080
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoRemove unused import of ObjectInserter in ResolveMerger 69/6369/1
Tomasz Zarna [Fri, 15 Jun 2012 06:35:46 +0000 (08:35 +0200)]
Remove unused import of ObjectInserter in ResolveMerger

Change-Id: I415894418f6fbe922c61294b21e15eee64e8a806

12 years agoMerge "Add Transport URI constructor without a repository"
Shawn Pearce [Fri, 15 Jun 2012 05:53:45 +0000 (01:53 -0400)]
Merge "Add Transport URI constructor without a repository"

12 years agoMerge "Fix UnionInputStream.read to be more Java-like"
Shawn Pearce [Fri, 15 Jun 2012 05:27:43 +0000 (01:27 -0400)]
Merge "Fix UnionInputStream.read to be more Java-like"

12 years agoFix UnionInputStream.read to be more Java-like 58/6358/2
Ian Wetherbee [Thu, 7 Jun 2012 23:22:53 +0000 (16:22 -0700)]
Fix UnionInputStream.read to be more Java-like

Relax the read() method to not block until exactly "len" bytes have
been read. Instead, return when one or more bytes have been read, up
to "len", so UnionInputStream more closely resembles InputStream's
read() method.

Change-Id: I3f632be8eb85a4a0baf27c9f067c8d817162de2b

12 years agoUse only a single ObjectInserter in ResolveMerger 68/6368/1
Shawn O. Pearce [Fri, 15 Jun 2012 01:43:40 +0000 (18:43 -0700)]
Use only a single ObjectInserter in ResolveMerger

The base class supplies an ObjectInserter to its implementations
by way of the getObjectInserter method. Tracking a second inserter
instance doesn't match with the expected behavior.

Change-Id: I78996bd06ef9028c8aa2e4e192ff647c43da847d

12 years agoDefine ObjectInserter.Filter to wrap another ObjectInserter 64/6364/1
Shawn O. Pearce [Thu, 14 Jun 2012 19:49:57 +0000 (12:49 -0700)]
Define ObjectInserter.Filter to wrap another ObjectInserter

Filter supports wrapping another ObjectInserter. By default all
methods are delegated to the wrapped inserter. Implementors may
override methods selectively for altered behavior.

The instance that is wrapped may be determined dynamically by code,
supporting lazy allocation of the delegate, or other patterns like
object pooling.

Change-Id: I7b2613d09e73f94e675bad33afbb693f6a7f3df6

12 years agoAllow applications to pass ObjectInserter to Merger 63/6363/1
Shawn O. Pearce [Thu, 14 Jun 2012 19:42:39 +0000 (12:42 -0700)]
Allow applications to pass ObjectInserter to Merger

Gerrit Code Review needs to control which inserter is used by a
Merger. Allow the application to set the inserter before calling
merge, giving callers more direct control over how objects will
be created.

Change-Id: I3c527a493db4659e95289ff3077cffb9e32336cf

12 years agoAdd Transport URI constructor without a repository 60/6360/1
Ian Wetherbee [Thu, 7 Jun 2012 22:15:12 +0000 (15:15 -0700)]
Add Transport URI constructor without a repository

Let a Transport instance be opened with only a URI, for use in the
upcoming publish-subscribe feature.

Change-Id: I391c60c10d034b5c1c0ef19b1f24a9ba76b17bb5

12 years agoPrepare 2.1.0 builds 48/6348/1
Matthias Sohn [Wed, 13 Jun 2012 22:45:13 +0000 (00:45 +0200)]
Prepare 2.1.0 builds

Change-Id: I4aad3efdd435d8d5eb53c84a8d38132acce97c25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge branch 'stable-2.0' 47/6347/1
Matthias Sohn [Wed, 13 Jun 2012 22:20:22 +0000 (00:20 +0200)]
Merge branch 'stable-2.0'

* stable-2.0:
  Prepare post v2.0.0.201206130900-r builds
  JGit v2.0.0.201206130900-r
  Add org.eclipse.jgit.pgm.feature to enable consumption via p2
  Do not set core.autocrlf when creating repo

Change-Id: Ifdd71a6bc14d9c79f4433ebc3b53bf0042a4d4c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoPrepare post v2.0.0.201206130900-r builds 46/6346/1
Matthias Sohn [Wed, 13 Jun 2012 22:19:30 +0000 (00:19 +0200)]
Prepare post v2.0.0.201206130900-r builds

Change-Id: I51b1bbed35288c5285b3d6860efba97d58de5a1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoFix GitDateFormatter javadoc. 21/6121/2
Tomasz Zarna [Wed, 13 Jun 2012 22:06:30 +0000 (00:06 +0200)]
Fix GitDateFormatter javadoc.

Change-Id: I627bdc387754a626ed8b1839494c05dfd5950d11
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoJGit v2.0.0.201206130900-r 39/6339/1 v2.0.0.201206130900-r
Matthias Sohn [Wed, 13 Jun 2012 13:03:59 +0000 (15:03 +0200)]
JGit v2.0.0.201206130900-r

Change-Id: I685e09b3e37d68614df1b5cc5f687a65cd6eb82d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoAdd org.eclipse.jgit.pgm.feature to enable consumption via p2 18/6318/2
Matthias Sohn [Mon, 11 Jun 2012 22:17:55 +0000 (00:17 +0200)]
Add org.eclipse.jgit.pgm.feature to enable consumption via p2

Orion wants to consume the pgm bundle from a p2 repository in their
build. Also add corresponding source bundle and feature to provision
sources via a target platform.

Bug: 373789
Change-Id: I0016ee155553c546606b63d310666eb10bd997e1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoDo not set core.autocrlf when creating repo 16/6316/2
Robin Rosenberg [Tue, 12 Jun 2012 11:56:42 +0000 (13:56 +0200)]
Do not set core.autocrlf when creating repo

core.autorlf defaults to false, but can be set in the user or
"system" config files. Note that EGit/JGit may not know
where the "system" config file is located.

Also fix pgm's ConfigTest which depends on default repository
configuration.

Bug: 382067
Change-Id: I2c698a76e30d968e7f351b4f5a2195f0b124f62f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoAdd missing license header to modification times test. 09/6309/1
Markus Duft [Mon, 11 Jun 2012 05:13:58 +0000 (07:13 +0200)]
Add missing license header to modification times test.

This adds the header i forgot to add in
I18047f5725f22811bb4194ca1d3a3cac56074183.

Change-Id: I9160b0632c65da9e30a88688c4d9216b5f93d818

12 years agoMerge changes I1c87fea9,I7bd5011f,Ie800c557
Shawn Pearce [Fri, 8 Jun 2012 20:02:35 +0000 (16:02 -0400)]
Merge changes I1c87fea9,I7bd5011f,Ie800c557

* changes:
  Add MetaFilter.serveRegex(Pattern)
  Expand RegexPipeline documentation
  Add simple tests for RegexPipeline

12 years agoAdd MetaFilter.serveRegex(Pattern) 03/6303/2
Dave Borowitz [Fri, 8 Jun 2012 19:13:23 +0000 (12:13 -0700)]
Add MetaFilter.serveRegex(Pattern)

This allows the use of precompiled patterns, such as those compiled with
flags.

Change-Id: I1c87fea98e246004aecbae3aabaf1d21fbf3176e

12 years agoExpand RegexPipeline documentation 98/6298/2
Dave Borowitz [Thu, 7 Jun 2012 19:08:48 +0000 (12:08 -0700)]
Expand RegexPipeline documentation

Include some behaviors that were not clear to me until I had used it a
few times.

Warn about broken behavior for capture groups that do not match. It
would be nice to support these, but even for the cases where it's
clear what the behavior should be, it would be infeasible to
implement.

For example, consider the second group of the regex "(/a)/b(/c)?"
matched against the path "/a/b". We might want getServletPath() to
return "/a/b" and getPathInfo() to return null, but this is hard to
implement: there's no easy way to say "the substring up to the point
where (/c) would have matched if it were in the string even though
it's not." And even if we could, it's not clear there is even a right
answer in the general case.

Moreover, ideally we could warn about such broken patterns at servlet
initialization time, rather than at runtime, but even answering the
question of whether there are capture groups that might not match
requires more customized regular expression parsing than we want to
embark on. Hence, the best we can do is document how it fails.

Change-Id: I7bd5011f5bd387f9345a0e79b22a4d7ed918a190

12 years agoAdd simple tests for RegexPipeline 97/6297/2
Dave Borowitz [Thu, 7 Jun 2012 18:41:25 +0000 (11:41 -0700)]
Add simple tests for RegexPipeline

Change-Id: Ie800c55702ea9724b393be0a8b36e0e4da1a6e0d

12 years agoMerge branch 'stable-2.0' 96/6296/1
Shawn O. Pearce [Thu, 7 Jun 2012 18:37:11 +0000 (11:37 -0700)]
Merge branch 'stable-2.0'

By Robin Rosenberg (6) and others
via Gerrit Code Review @ Eclipse.org (2) and Matthias Sohn (1)
* stable-2.0:
  Prepare next 2.0.0-SNAPSHOT builds
  JGit v2.0.0.201206060730-rc3
  Remove Jetty p2 repository from Maven build
  Get rid of warnings about empty statments
  Removed unused parameters from private methods
  cleanup: Remove unused declarations
  Make FS OS X detection work for OpenJDK
  Use working tree iterator to compare file modes
  Further cleanup of exceptions in Git API
  Update build to use Tycho 0.15.0
  Throw formal CheckoutConflictException on hard reset
  Configure maven-source-plugin execution in parent POM
  Support gitdir: refs in BaseRepositoryBuilder.findGitDir
  Relax RevisionSyntaxException to an IllegalArgumentException

Change-Id: I05727693e0c9e762d4fc220ceadcd5a5bfb11d0d

12 years agoPrepare next 2.0.0-SNAPSHOT builds 80/6280/1
Matthias Sohn [Wed, 6 Jun 2012 11:57:32 +0000 (13:57 +0200)]
Prepare next 2.0.0-SNAPSHOT builds

Change-Id: I0d55b390502b3da139ab0d15a6cf3d05774d8ad9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoJGit v2.0.0.201206060730-rc3 77/6277/1 v2.0.0.201206060730-rc3
Matthias Sohn [Wed, 6 Jun 2012 11:27:54 +0000 (13:27 +0200)]
JGit v2.0.0.201206060730-rc3

Change-Id: I12f8800b74228e71c77f0fb82c250c154d06369f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMake DirCacheCheckout update timestamps in the index. 32/6232/6
Markus Duft [Wed, 6 Jun 2012 11:14:14 +0000 (13:14 +0200)]
Make DirCacheCheckout update timestamps in the index.

This updates the timestamp of files that are not touched during
checkout. Otherwise the timestamp will always be zero, causing the
IndexDiffFilter to always calculate the checksum of file contents.

Change-Id: I18047f5725f22811bb4194ca1d3a3cac56074183

12 years agoMerge "Use working tree iterator to compare file modes" into stable-2.0
Christian Halstrick [Wed, 6 Jun 2012 10:43:20 +0000 (06:43 -0400)]
Merge "Use working tree iterator to compare file modes" into stable-2.0

12 years agoRemove Jetty p2 repository from Maven build 76/6276/1
Matthias Sohn [Wed, 6 Jun 2012 08:29:00 +0000 (10:29 +0200)]
Remove Jetty p2 repository from Maven build

This reference is not required and would force all JGit consumers to
switch to Maven 3 and Tycho which isn't desirable.

Bug: http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg01687.html
Change-Id: Iecf7c5aad46bb05fce0455cc8127aee2f679848c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoGet rid of warnings about empty statments 72/6272/2
Robin Rosenberg [Wed, 6 Jun 2012 00:28:06 +0000 (02:28 +0200)]
Get rid of warnings about empty statments

In HtttpAuthMethod there were comments, but not in a style
that Eclipse recognizes.

Change-Id: I64f55b27143f8badcefbb419d3951f2a26b87d5f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoRemoved unused parameters from private methods 68/6268/4
Robin Rosenberg [Wed, 6 Jun 2012 00:26:53 +0000 (02:26 +0200)]
Removed unused parameters from private methods

Change-Id: I60bc03b9550ccd2350918e6328276ec9839748d5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agocleanup: Remove unused declarations 67/6267/1
Robin Rosenberg [Tue, 5 Jun 2012 23:43:44 +0000 (01:43 +0200)]
cleanup: Remove unused declarations

Change-Id: I3b54cb9f73cb433c71a441a11ddc74cfecdaa1dc

12 years agoMerge changes Iee9af8d5,I8e1674f0,If5a6fcc5,I3bb28e4d
Shawn O. Pearce [Tue, 5 Jun 2012 23:31:57 +0000 (19:31 -0400)]
Merge changes Iee9af8d5,I8e1674f0,If5a6fcc5,I3bb28e4d

* changes:
  Use BatchRefUpdate for tracking refs in FetchProcess
  Batch reference updates together for storage
  Expose ReceiveCommand.updateType to check for UPDATE_NONFASTFORWARD
  Reject non-fast-forwards earlier in BaseReceivePack

12 years agoMake FS OS X detection work for OpenJDK 66/6266/1
Robin Rosenberg [Sun, 20 May 2012 08:45:03 +0000 (10:45 +0200)]
Make FS OS X detection work for OpenJDK

OpenJDK sets the os.name system.property to "Darwin", while Apple's
version says "Mac OS X".

Change-Id: If08f8e7b8ef94ec00023a3f78bbf502ebd9699fb

12 years agoUse working tree iterator to compare file modes 42/6142/6
Kevin Sawicki [Tue, 5 Jun 2012 15:23:04 +0000 (08:23 -0700)]
Use working tree iterator to compare file modes

Add isModeDifferent method to WorkingTreeIterator
that compares mode with consideration of the
core.filemode setting in the config.

Bug: 379004
Change-Id: I07335300d787a69c3d1608242238991d5b5214ac
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>