Commit Graph

1973 Commits

Author SHA1 Message Date
Dave Borowitz 4bf22ff6e8 Execute ReceiveCommands via a method rather than in ReceivePack
This allows a PreReceiveHook to easily "take over" all of the
ReceiveCommands passed to it, preventing any of them from being handled
within the ReceivePack core.

Change-Id: I2a8c1fc44e8dcadf22cd97a8ec4ee79d4d9d08f1
2012-02-29 19:09:22 -08:00
Kevin Sawicki 0fb0e84405 Reuse existing modes and ids
This change replaces calls to getEntryObjectId and getEntryFileMode
with the existing method local variables for the index, merge, and
head tree iterators.

Change-Id: I75d1edfdd192a009fc916102ec052434c6302d00
2012-02-29 15:07:37 -08:00
Kevin Sawicki 4de8a84671 Add command support for applying a stashed commit
Applies the changes in a stashed commit to the local working
directory and index

Bug: 309355
Change-Id: I9fd5ede8affc7f0060ffa7c5cec34573b6fa2b1b
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-02-28 13:53:13 -08:00
Kevin Sawicki 03d4dc597e Add support for creating a stashed commit
Adds a new command to stash the index and working directory
changes in a commit stored in refs/stash

Bug: 309355
Change-Id: I2ce85b1601b74b07e286a3f99feb358dfbdfe29c
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-02-28 13:46:35 -08:00
Kevin Sawicki 10c0b34b88 Add all paths option to CheckoutCommand
This will perform the equivalent  of running a
'git checkout -- .' at the root of a repository

Change-Id: I3e2dd563700999bc063effdd3640499c8ed08136
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-26 16:10:57 +01:00
Daniel Megert 709cd52958 Let the date formatter pick the locale.
Instead of using the locale from the SystemReader we let the
SystemReader create the date formats without passing the locale.

Bug 368756
Change-Id: I6be9e07af804a08f3f3ac2d2d526ef594eed19e3
Signed-off-by: Daniel Megert <daniel_megert@ch.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-25 23:37:02 +01:00
Stefan Lay 54f23873d6 Add support for autosetuprebase to the CloneCommand
Bug: 345536
Change-Id: I93c609235dec4e5e3a2ddc275c28b202bf868d40
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Kevin Sawicki <kevin@github.com>
2012-02-23 09:32:02 -08:00
Matthias Sohn 0211d91001 Merge "Add IGNORE_ERRORS to FileUtils.delete()" 2012-02-21 14:34:42 -05:00
Marc Strapetz 7df17e57d4 EolCanonicalizingInputStream: binary detection should be optional
EolCanonicalizingInputStream may also be used in combination with
.gitattributes. If .gitattributes states that a file is of type text, line
endings have to be canonicalized even if the actual file content seems
to be binary.

Change-Id: Ie4ccdfc5cb91fbd55e06f51146cf5c7c84b8e18b
2012-02-21 15:22:36 +01:00
Christian Halstrick b6d376a177 Add IGNORE_ERRORS to FileUtils.delete()
There are a few situations where you want to delete files or folders but
where you are not interested in getting exceptions if this doesn't
succeed. E.g. if you delete garbage in the GC class you want that if
certain files can't be deleted the command succeeds. Maybe the next
garbage collector run has more luck not to interfere with a virus
scanner run on Windows. Therefore an option is added to
FileUtils.delete() not to report errors in such cases.

Change-Id: I58994d8c481e591dcbb0f2be7dfa562e125f0f08
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2012-02-21 14:23:43 +01:00
Matthias Sohn 755dfdb409 Prepare 2.0.0-SNAPSHOT builds
Change-Id: I946e315af04227727ac937ebe9d70ae1ea4e8936
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-16 00:49:49 +01:00
Matthias Sohn 42b0fb4679 Merge branch 'stable-1.3'
* stable-1.3:
  Prepare post 1.3.0.201202151440-r build
  JGit 1.3.0.201202151440-r
  Generate conflicts and index updates on file mode changes

Change-Id: Ie99780ef5cdea7b3ea1ea076282fe0a25f14f469
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-16 00:44:47 +01:00
Matthias Sohn f70b24a601 Prepare post 1.3.0.201202151440-r build
Change-Id: I4d695273e3151c22f2df9a58725cc7ba21ab6043
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-16 00:42:34 +01:00
Matthias Sohn e4ee677dea JGit 1.3.0.201202151440-r
Change-Id: I663208919f297836a9c16bf458e4a43ffaca4c12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-15 20:56:06 +01:00
Christian Halstrick ed7b322186 Generate conflicts and index updates on file mode changes
Handle more cases for file mode changes. Especially make sure that the
following cases are handled correctly.

Case 1)

  An entry in the working tree, HEAD tree, and merge tree have
  different modes and different content.

  Prior Outcome:
    Dirty working tree content is replaced and file mode
    changes are lost.

  New Outcome:
    Conflict is generated.

Case 2)

  An entry in the index and merge tree have the same content
  but different modes but both modes are file type modes.

  Prior Outcome:
    File mode in working tree is not updated and the working
    directory is dirty.

  New Outcome:
    Index is updated and the working directory is clean.

Bug: 363772
Change-Id: I224602d68228eb419813986807f1eeab77e9c302
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Also-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 09:39:05 +01:00
Matthias Sohn de48250da5 Merge branch 'stable-1.3'
* stable-1.3:
  Prepare post 1.3.0.201202121842-rc4 builds
  JGit 1.3.0.201202121842-rc4
  Support gitdir references in working tree .git file
  Support committing submodule updates
  Update iplog tool's README

Change-Id: Id70f4d4b059b03d4fa6fbd9137b81a337e9c48e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 07:34:18 +01:00
Matthias Sohn 3b358ce514 Prepare post 1.3.0.201202121842-rc4 builds
Change-Id: I50e0e6c2bccab5f3da62cbfe976f065169426906
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 07:30:00 +01:00
Matthias Sohn 53917539f8 JGit 1.3.0.201202121842-rc4
Change-Id: I82c6c0c175ab6fb4e2113101f36c8d2ddf4a13c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-13 00:57:43 +01:00
Robin Rosenberg ad9033e43a Revert non-sense logic in IO.readFully
This was introduced in alleged support for autocrlf, but the
logic makes no sense here.

Change-Id: If37f3b90f21f875cee7165e17a17adfda446384d
2012-02-12 20:42:47 +01:00
Kevin Sawicki 2f79cf9900 Support gitdir references in working tree .git file
A '.git' file in a repository's working tree root is now parsed
as a ref to a folder located elsewhere.  This supports submodules
having their repository location outside of the parent repository's
working directory such as in the parent repository's '.git/modules'
directory.

This adds support to BaseRepositoryBuilder for repositories created
with the '--separate-git-dir' option specified to 'git init'.

Change-Id: I73c538f6d845bdbc0c4e2bce5a77f900cf36e1a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-02-08 23:10:28 +01:00
Tomasz Zarna f1945cac1d Add getters for old and new prefixes in DiffFormatter
Bug: 370318
Change-Id: Iaf9282ba55ee3bb4e2c27fb71c598b308771bf57
2012-02-02 11:59:28 +01:00
Kevin Sawicki 7bde08e1d4 Support committing submodule updates
Use the submodule object id provided by the working
tree iterator

Change-Id: Ibf82f56c04cb9c91b2b309cf0cfa3f638539e23c
2012-01-30 13:37:40 -08:00
Matthias Sohn f54e760232 Update iplog tool's README
Change-Id: I0a6d770b0c4deb11fea23b875ef5449c619c05a1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-27 09:38:17 +01:00
Matthias Sohn e4bfd61c9d Merge "Add developers section to root POM file" 2012-01-26 07:42:55 -05:00
Robin Rosenberg 9673ae18ce Merge "Allow to list tags with org.eclipse.jgit.pgm.Tag" 2012-01-25 13:10:15 -05:00
Kevin Sawicki 11ab19aacd Add developers section to root POM file
This section contains the names of the current committers
and is required for acceptance to the Maven Central repository

Change-Id: Ib758cfe0a574aa3e80af9d289bec1a74d9b78d25
2012-01-25 09:01:55 -08:00
Dariusz Luksza b649eaa9a8 Move writeTrashFile and deleteFile into JGitTestUtil
Moves RepositoryTestCase.writeThashFile, RepositoryTestCase.deleteFile
and dependencies into JGitTestUtil for further reuse.

Required-by-EGit: If8dfa0251797aca56ddc825619500dc21885ba26
Change-Id: I6fc62c8e6626f907e544b5bbe5d64e864a2c323f
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2012-01-25 01:24:41 +01:00
Kevin Sawicki 2fa5bcd6bb Add scm section to root POM file
Change-Id: I23db67685a7b6a481961eb6ed6b4b80b2d0cace8
2012-01-23 09:19:18 -08:00
Robin Rosenberg 96acc4e5cf Really close output stream when core.autocrlf is true
Change-Id: I8a0d91e908145168c32589600bd1598826511ae3
2012-01-23 00:57:39 +01:00
Tomasz Zarna 3fa054bcf7 Workaround incompatible refactoring in Jetty 7.6.0
In Jetty 7.6 package org.eclipse.jetty.http.security was renamed to
org.eclipse.jetty.util.security [1] breaking compatibility.

Compare docs for the package in 7.5.4 [2] and missing part in 7.6.0 [3].
To fix until we switch to Jetty 8, restrict the maximum version to 7.6.0
exclusive.

[1] http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg01175.html
[2] http://download.eclipse.org/jetty/7.5.4.v20111024/apidocs/
[3] http://download.eclipse.org/jetty/7.6.0.RC4/apidocs/

Change-Id: I82b107ec76e66367e55e2cc20233a7924bf7be9f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-21 00:15:03 +01:00
Kevin Sawicki 97210fd6db Add command support for listing stashed commits
Bug: 309355
Change-Id: I34a8c251b89abcdb67565ca49bee02e5e2113593
Signe-off-by: Chris Aniszczyk <zx@twitter.com>
2012-01-20 09:00:13 -08:00
Matthias Sohn ea56a1ddb2 Merge "Support relative submodule URLs on init/add/sync" 2012-01-18 16:26:42 -05:00
Kevin Sawicki b57845c0cc Support relative submodule URLs on init/add/sync
Interpret submodule URLs that start with './' or '../' as
relative to either the configured remote for the HEAD branch,
or 'origin', or the parent repository working directory if no
remote URL is configured

Bug: 368536
Change-Id: Id4985824023b75cd45cd64a4dd9d421166391e10
2012-01-17 09:35:29 -08:00
Robin Stocker 14cc47ea1a Add BranchTrackingStatus for getting remote tracking status
This is used by EGit change I1e1caca561d1b0a0c194bfc42e64b698f42c6e6a to
show branch status in decoration.

It can also be used for providing the same output as C Git in "git
status".

Change-Id: I8d2b108c89905c3f0496f3d517879596740787c0
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-16 22:33:03 +01:00
Robin Stocker c0f4880e61 Add BranchConfig helper for access to branch config section
Getting the name of the remote-tracking branch given a branch is not so
easy to get right. This class provides a way to do that and could be
used for more branch config related things (e.g. in PullCommand).

Change-Id: I896a2384217936c8b672df8b81c9599f5c350458
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-16 22:18:54 +01:00
Robin Stocker 69d7d1b0b6 Add RevWalkUtils with count(start, end) method
It returns the number of commits that are in start and not in end.
Useful for calculating how much a branch is ahead of another one.

Change-Id: I09f7d9b049beea417da7ff32c9f8bf0d4ed46a7f
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-16 22:05:20 +01:00
Christian Halstrick a9892fba46 Merge "Support more of AutoCRLF" 2012-01-16 10:53:13 -05:00
Robin Rosenberg 03b5416a35 Fix resolution of tree when path is empty
Revision strings that end with a ':' with no trailing path
should return the tree associated with the current ref parsed

Bug: 368370
Change-Id: I7c7617a77bd418bad4e570be2d1e9002ad280762
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-01-15 23:56:37 +01:00
Robin Rosenberg e875c905d3 Make sure all bytes are written to files on close, or get an error.
Java's BufferedOutputStream swallows any errors that occur when flushing
the buffer in close().

This class overrides close to make sure an error during the final
flush is reported back to the caller.

Change-Id: I74a82b31505fadf8378069c5f6554f1033c28f9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-15 11:22:52 +01:00
Robin Rosenberg 02729810f9 Merge "Resolve ~ with no trailing number as the first parent commit" 2012-01-14 20:28:52 -05:00
Matthias Sohn b8830d7bbb Throw API exception when LsRemoteCommand fails with TransportException
In many cases applications want to handle TransportException hence
expose it as an API exception.

Change-Id: I64b885ecfb1a35bd93c89026c6298d1820ba69d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-15 01:38:25 +01:00
Kevin Sawicki c963e7aacf Resolve ~ with no trailing number as the first parent commit
This would previously throw a RevisionSyntaxException

Change-Id: I42b4988c7f6c6454e2ebda13914260e25ac1a889
2012-01-14 15:34:18 -08:00
Robin Rosenberg d5c890e0fd Cannot commit -o file with only file permission change
Bug 345076
Change-Id: Ie64039793ab6ba4748731320399f03301b6282ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-01-13 11:24:31 +01:00
Robin Rosenberg 76dd9d1d46 Support more of AutoCRLF
This patch introduces CRLF handling to the DirCacheCheckout and
WorkingTreeIterator supporting the AutoCRLF for add, checkout
reset and status and hopefully some other places that depende
on the underlying logic of the affected API's.

The patch includes test cases for the Status command provided by
Tomasz Zarna for bug 353867.

The core.eol and core.safecrlf options are not yet supported.

Bug: 301775
Bug: 353867
Change-Id: I2280a2dc0698829475de6a662a6c6e80b1df7663
2012-01-10 23:15:52 +01:00
Matthias Sohn 6a582970bf Merge "Provide helper for unlocking a file" 2012-01-10 12:24:49 -05:00
Kevin Sawicki aebfc70cc8 Provide helper for unlocking a file
This will allow recovery from a LockFailedException where
the file associated with an exception is passed to FileUtils.unlock
to attempt an unlock on the file so the operation can be retried

Change-Id: I580166d386126bfb54a318a65253070a6e325936
2012-01-09 08:46:13 -08:00
Tomasz Zarna f78e52b645 Add setter for ProgressMonitor to DiffCommand
Change-Id: I34f8b77a461e165d7d624dbd9a6944feadc57b8e
2012-01-09 15:48:16 +01:00
Stefan Lay 8f742cdd10 Merge "Add options for setting context lines and prefixes to DiffCommand" 2012-01-09 07:06:59 -05:00
Tomasz Zarna 69a5683b82 Add options for setting context lines and prefixes to DiffCommand
Change-Id: I539f3531e94c11c0f0a3e7096c0eb1b1c309898a
2012-01-09 12:13:30 +01:00
Christian Halstrick 885a389832 Merge "Add helper for determining if status is clean" 2012-01-09 06:13:12 -05:00