Commit Graph

152 Commits

Author SHA1 Message Date
Philipp Thun a490afedba Add -o option to commit command
This change adds the --only/ -o option to the commit command.

Change-Id: I44352d56877f8204d985cb7a35a2e0faffb7d341
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
2011-03-11 14:25:46 +01:00
Matthias Sohn d353107729 Improve readability of timestamps shown by debug-show-dir-cache
The old format is hard to read.

Change-Id: I27f3a7dbd92b26256993d27d5223b743fef70902
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-03-03 16:19:47 +01:00
Matthias Sohn 3de0df93d4 Enhance debug-show-dir-cache command to show stage
Change-Id: I6fb17ec7f04f8bfaf1253b2ff08200ef9fc51898
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-03-03 10:56:38 +01:00
Shawn O. Pearce 1b2062fe37 PackWriter: Avoid CRC-32 validation when feeding IndexPack
There is no need to validate the object contents during
copyObjectAsIs if the result is going to be parsed by unpack-objects
or index-pack.  Both programs will compute the SHA-1 of the object,
and also validate most of the pack structure.  For git daemon
like servers, this work is already done on the client end of the
connection, so the server doesn't need to repeat that work itself.

Disable object validation for the 3 transport cases where we know
the remote side will handle object validation for us (push, bundle
creation, and upload pack).  This improves performance on the server
side by reducing the work that must be done.

Change-Id: Iabb78eec45898e4a17f7aab3fb94c004d8d69af6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-03-02 12:23:58 -08:00
Chris Aniszczyk 268ccbebe3 Merge "ProgressMonitor: Refactor to use background alarms" 2011-03-01 12:05:59 -05:00
Sasa Zivkov 3e1a5081d6 Show notes in Log CLI command - Part 2
This change fixes issues identified in the commit
5f3d577e5a.

Change-Id: Idbd935f5f60ad043faa0d4982b3e101ef7c07d60
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2011-03-01 09:29:35 +01:00
Shawn O. Pearce 68ab451d39 ProgressMonitor: Refactor to use background alarms
Instead of polling the system clock on every update(1) method call,
use a scheduled executor to toggle a volatile once per second until
the task is done.  Check the volatile on each update(int), looking
to see if output should occur.

This limits progress output to either once per 1% complete, or once
per second.  To save time during update calls the timer isn't reset
during each 1% of output, which means we may see one unnecessary
output trigger if at least 1% completed during the one second of the
alarm time.

Change-Id: I8fdd7e31c37bef39a5d1b3da7105da0ef879eb84
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-28 19:36:56 -08:00
Sasa Zivkov 5f3d577e5a Show notes in Log CLI command
Support for --no-standard-notes and --show-notes=REF options is added
to the Log command. The --show-notes option can be specified more than
once if more than one notes branch should be used for showing notes.

The notes are displayed from note branches in the order how the note
branches are specified in the command line. However, the standard note,
from the refs/notes/commits, is always displayed as first unless
the --no-standard-notes options is given.

Change-Id: I4e7940804ed9d388b625b8e8a8e25bfcf5ee15a6
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-23 09:32:23 -06:00
Chris Aniszczyk bd8944d671 Add Reset to the JGit CLI
Change-Id: I85368c849c0964b9a539fa1991920adb2ace94df
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-17 14:06:28 -06:00
Shawn O. Pearce 6490090f14 pgm: Make --git-dir a string
DHT based repository types don't use a java.io.File to name the
repository.  Moving the type to a string starts to open up more types
of repository names, making the standard pgm package easier to reuse
on other storage systems.

Change-Id: I262ccc8c01cd6db88f832ef317b0e1e5db2d016a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-02-15 13:36:22 -06:00
Shawn O. Pearce 1b7a5a2960 daemon: Use HTTP's resolver and factory pattern
Using a resolver and factory pattern for the anonymous git:// Daemon
class makes transport.Daemon more useful on non-file storage systems,
or in embedded applications where the caller wants more precise
control over the work tasks constructed within the daemon.

Rather than defining new interfaces, move the existing HTTP ones
into transport.resolver and make them generic on the connection
handle type.  For HTTP, continue to use HttpServletRequest, and
for transport.Daemon use DaemonClient.

To remain compatible with transport.Daemon, FileResolver needs to
learn how to use multiple base directories, and how to export any
Repository instance at a fixed name.

Change-Id: I1efa6b2bd7c6567e983fbbf346947238ea2e847e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-02-14 18:28:21 -08:00
Matthias Sohn f2c8eec57b Qualify post 0.11 builds
Change-Id: Ibcef4fc4c986c2cda01e943d16aa1c53eff99f25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-12 03:30:05 +01:00
Matthias Sohn 857d151198 JGit 0.11.1
Change-Id: I9ac2fdfb4326536502964ba614d37d0bd103f524
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-02-11 23:25:34 +01:00
Matthias Sohn 38eec8f4a2 [findbugs] Do not ignore exceptional return value of mkdir
java.io.File.mkdir() and mkdirs() report failure as an exceptional
return value false. Fix the code which silently ignored this
exceptional return value.

Change-Id: I41244f4b9d66176e68e2c07e2329cf08492f8619
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-01-28 01:11:12 +01:00
Sasa Zivkov 65680da3ee Fixed several NPEs in the Fetch CLI
The Fetch command line was failing with NPE in case some options were omitted.
Additionally, it was setting a negative timeout when no timeout option was used
which caused HttpURLConnection to throw an IllegalArgumentException.

Change-Id: I2c67e2e1a03044284d183d73f0b82bb7ff79de95
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-01-26 11:38:59 -06:00
Sasa Zivkov 990498b75d Fixed NLS in JGit command line interface
There was one place where the parameter substitution wasn't done which caused
text fragments like "{0}" to appear in JGits output.

Bug: 325025
Change-Id: I89b881a8b5ef39f609437546310463ed4f6e1fb5
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-01-26 11:33:52 -06:00
Shawn O. Pearce 1bf0c3cdb1 Refactor IndexPack to not require local filesystem
By moving the logic that parses a pack stream from the network (or
a bundle) into a type that can be constructed by an ObjectInserter,
repository implementations have a chance to inject their own logic
for storing object data received into the destination repository.

The API isn't completely generic yet, there are still quite a few
assumptions that the PackParser subclass is storing the data onto
the local filesystem as a single file.  But its about the simplest
split of IndexPack I can come up with without completely ripping
the code apart.

Change-Id: I5b167c9cc6d7a7c56d0197c62c0fd0036a83ec6c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-01-25 16:43:06 -06:00
Shawn O. Pearce 0c22243c4a clone: Use DirCacheCheckout
This simple change lets us get rid of WorkDirCheckout from JGit,
and all of its supporting code.

Change-Id: I1a5aabe9ab4a2b156fd37cc7e9ededb4ed70f53a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-20 09:28:29 -06:00
Matthias Sohn 485917598e Qualify post 0.10 builds
Change-Id: Ifcb8fdea95286779c8aea6bf4d7647e8c1c98d63
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-17 15:49:30 +01:00
Matthias Sohn 67d8f3a338 Merge branch 'stable-0.10' 2010-12-17 15:41:27 +01:00
Matthias Sohn 51d1af9489 Qualify post 0.10.1 builds
Change-Id: I320f1f739f3689daf11d532a55ae1133785aec8e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-17 15:23:14 +01:00
Matthias Sohn 1fdc17bfe4 JGit 0.10.1
Change-Id: I4a46d35d354193e5d4f28ef7dfae75944be8ffcf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-12-17 03:10:07 +01:00
Shawn O. Pearce 013cb8de38 Reduce calls to Repository.getConfig
Each time getConfig() is called on FileRepository, it checks the
last modified time of both ~/.gitconfig and $GIT_DIR?config.  If
$GIT_DIR/config appears to have been modified, it is read back in
from disk and the current config is wiped out.

When mutating a configuration file, this may cause in-memory edits
to disappear.  To avoid that callers need to avoid calling getConfig
until after the configuration has been saved to disk.

Unfortunately the API is still horribly broken.  Configuration should
be modified only while a lock is held on the configuration file, very
similar to the way a ref is updated via its locking protocol.  But our
existing API is really broken for that so we'll have to defer cleaning
up the edit path for a future change.

Change-Id: I5888dd97bac20ddf60456c81ffc1eb8df04ef410
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-15 15:14:05 -08:00
Shawn O. Pearce 11fd0fe03a Clarify WorkingTreeOptions and filemode usage
To improve runtime performance, caching the WorkingTreeOptions inside
of the Config object using the Config.SectionParser API allows
the WorkingTreeOptions to be accessed more efficiently whenever a
FileTreeIterator is constructed for the Repository.

Instead of passing the filemode handling option into isModified(),
the WorkingTreeIterator should always honor whatever setting has
been configured in this repository, as defined by its own copy of
the WorkingTreeOptions.  This simplifies all of the callers as they
no longer need to lookup core.filemode on their own.

A few locations were changed from always using a hardcoded "true"
on the file mode to passing what is actually configured in the
repository.  This is a behavior change, but corrects what should be
considered to be bugs as the core.filemode variable wasn't always
being used.

Change-Id: Idb176736fa0dc97af372f1d652a94ecc72fb457c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-08 10:03:19 -08:00
Shawn O. Pearce a02be9725c Remove empty iterator from TreeWalk
Its confusing that a new TreeWalk() needs to have reset() invoked
on it before addTree().  This is a historical accident caused by
how TreeWalk was abused within ObjectWalk.

Drop the initial empty tree from the TreeWalk and thus remove a
number of pointless reset() operations from unit tests and some of
the internal JGit code.

Existing application code which is still calling reset() will simply
be incurring a few unnecessary field assignments, but they should
consider cleaning up their code in the future.

Change-Id: I434e94ffa43491019e7dff52ca420a4d2245f48b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-12-07 16:49:51 -08:00
Chris Aniszczyk 8bbd4f1bad Avoid NPE in Init
We should grab the repository directory from the command to
avoid an NPE if no git directory is passed in via the CLI.

Change-Id: I649467c6d84bbc0d26a070d0d4ff1e6f81fd5bad
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-07 09:10:07 -06:00
Chris Aniszczyk 8f6c8818dc Update Init to use InitCommand
Change-Id: I3ff700a87dfa6ac255c1aaf3fe11a07264594aab
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-12-05 19:03:34 -06:00
Christian Halstrick 049827d708 Make diff algorithm configurable
The diff algorithm which is used by Merge, Cherry-Pick, Rebase
should be configurable. A new configuration parameter "diff.algorithm"
is introduced which currently accepts the values "myers" or
"histogram". Based on this parameter for example the ResolveMerger
will choose a diff algorithm. The reason for this is bug 331078.
This bug shows that JGit is more compatible with C Git when
histogram diff is in place. But since histogram diff is quite new we
need an easy way to fall back to Myers diff.

Bug: 331078
Change-Id: I2549c992e478d991c61c9508ad826d1a9e539ae3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Philipp Thun <philipp.thun@sap.com>
2010-11-26 00:30:08 +01:00
Chris Aniszczyk c441380f9c Add the Checkout command to the Git CLI
The implementation delegates to the CheckoutCommand and
therefore only supports some of the options supported by
the CheckoutCommand.

Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-23 13:07:46 -06:00
Chris Aniszczyk a7f6764e01 Update Rm in the JGit CLI
Since we have the RmCommand API now, update Rm to use it.

Change-Id: I6e2cb37573cc8a29846f01e09e8c07e0dc279dbe
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-11-22 11:19:51 -06:00
Shawn O. Pearce 17d9c68636 Implement command line support for CredentialsProvider
Instead of configuring the JSch session factory, configure a more
generic CredentialsProvider, which will work for other transport
types such as http, in addition to the existing ssh.

Change-Id: I22b13303c17e654ba6720edf4be2ef15fe29537a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-11-10 15:12:47 -08:00
Shawn Pearce 09555c9853 Merge "Make Repository.shortenRefName static" 2010-11-08 17:42:21 -05:00
Christian Halstrick a28f33fa8c Fixed help of Diff and ShowCommands commands
jgit.sh <command> --help was not working for the commands Diff
and ShowCommands because of missing metaVar information. Missing
information is added here.

Change-Id: I0ab7e35006b6aa7d4326a634309dddfcdb78f2a6
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-11-08 13:56:07 -08:00
Chris Aniszczyk df037eb230 Merge "Implemented the git add commandline command." 2010-11-07 16:05:24 -05:00
Sasa Zivkov 1a7c918b66 Implemented the git add commandline command.
Implementation delegates all work to the AddCommand class and,
therefore, supports only those options currently supported by the
AddCommand which means: --update and the filepattern... arguments.

Change-Id: I4827d37e08b4c988c2458d9ba60a61b6ad414d10
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2010-11-07 21:30:56 +01:00
Robin Stocker 2fb0f5cfc0 Make Repository.shortenRefName static
The method has no reason to be non-static.

Change-Id: I1c09e074395d49cee0e6e53679b499d1f0c351ea
2010-11-06 13:41:06 +01:00
Sasa Zivkov af4f6c5125 Fixed the git init to properly set bare=true
When --git-dir=X is given JGit creates a bare repository in the
directory X. However, when the --bare option is not explicitly
given, this is not properly reflected in the X/config file i.e.
the bare=true is missing.  This change fixes this minor issue.

Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2010-11-05 16:06:14 +01:00
Christian Halstrick e10808e658 Add option to select diff algorithm for diff command
The diff command in the pgm package was enhanced to allow
choosing the diff algorithm (currently myers or histogram)

Change-Id: I72083e78fb5c92868eb5d8ec512277d212a39349
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-10-26 18:07:49 +02:00
Shawn O. Pearce 0b51a45688 Allow pgm Main to be extended
3rd party packages that use repository types other than FileRepository
may wish to extend our pgm package and implement their own resolution
scheme for repository "names" that are passed in by the --git-dir
command line option.  Make that possible by allowing the package to
extend the Main class and override the lookup.

This is primarily useful when developing new storage implementations
and trying to experiment with the results, without linking all of it
into the core JGit package.

Change-Id: Id30e168da16341e5da43365688a63aa30c7b7e2c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-10-16 21:47:10 -07:00
Shawn O. Pearce 529b2017df Fix three-word command names
Command names like MakeCacheTree weren't coming up with hyphens between
every word, so they read "debug-make-cachetree" rather than the
expected "debug-make-cache-tree".  On each lowercase character reset
the lastWasDash flag so the next uppercase will insert a hyphen before
the next word.

Change-Id: I539fabb339e60896165619c307dec71e3317b0d8
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-10-14 00:14:14 +02:00
Shawn Pearce 4ac3d9814c Merge "Update Tag to use TagCommand API" 2010-10-12 15:05:55 -04:00
Shawn O. Pearce e82cadc0dc Delete PatienceDiff
HistogramDiff outperforms it for any case where PatienceDiff needs to
fallback to another algorithm.  Consequently it's not worth keeping
around, because we would always want a fallback enabled.

Change-Id: I39b99cb1db4b3be74a764dd3d68cd4c9ecd91481
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-10-11 17:05:18 -05:00
Shawn O. Pearce 14da6e0b9d debug-diff-algorithms: Real world performance test implementations
When working on a difference algorithm's implementation, its generally
more important to care about how it behaves on real-world inputs than
it does on fake inputs created for unit test cases.  Run each
implementation against a number of real-world repositories, looking at
changes between files in each commit.  This gives a better picture of
how a particular algorithm performs.

This test suite run against JGit and linux-2.6 with the current
available algorithms shows HistogramDiff always out-performs
MyersDiff, and by a wide margin on the linux-2.6 sources.  As
HistogramDiff has similar output properties as PatienceDiff, the
resulting edits are probably also more human-readable.  These test
results show that HistogramDiff is a good choice for the default
implementation, and also show that PatienceDiff isn't worth keeping.

  jgit: start at baa83ae
            2686 files,          760 commits
    N=         3 min lines,     3016 max lines
  Algorithm                     Time(ns) (  Time(ns) on   Time(ns) on )
                                         (          N=3        N=3016 )
  ---------------------------------------------------------------------
  histogram_myers              314652100 (         3900        298100 )
  histogram                    315973000 (         3800        302100 )
  patience                     774724900 (         4500        347900 )
  patience_histogram_myers     786332800 (         3700        351200 )
  myers                        819359300 (         4100        379100 )
  patience_myers               843416700 (         3800        348000 )

  linux-2.6.git: start at 85a3318
            4001 files,         2680 commits
    N=         2 min lines,    39098 max lines
  Algorithm                     Time(ns) (  Time(ns) on   Time(ns) on )
                                         (          N=2       N=39098 )
  ---------------------------------------------------------------------
  histogram_myers             1229870000 (         5900       2642700 )
  histogram                   1235654100 (         6000       2695400 )
  patience                    3856546000 (         5900       2627700 )
  patience_histogram_myers    3866728100 (         7000       2624000 )
  patience_myers              4004875300 (         8000       2651700 )
  myers                       9794679000 (         7200       2716200 )

Change-Id: I2502684d31f7851e720356820d04d8cf767f7229
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-10-11 16:20:00 -05:00
Chris Aniszczyk 782dbfc60f Update Push to use latest API
Change-Id: I57ea8634a46472f40046f4ec69de505abbf5f6cf
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-10-10 15:55:03 -05:00
Chris Aniszczyk 6b6c8dd01b Update Fetch to use FetchCommand API
Change-Id: I06ddc74f1ef658f4876e2bbcc3eaad3475a5371e
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-09-27 10:16:22 -05:00
Shawn O. Pearce af3fbb13f6 debug-text-hashfunctions: Test suite for content hashes
This is the test suite I was using to help understand why we had
such a high collision rate with RawTextComparator, and to select
a replacement function.

Since its not something we will run very often, lets make it a
program in the debug package rather than a JUnit test.  This way
we can run it on demand against any corpus of files we choose,
but we aren't bottlenecking our daily builds running tests with
no assertions.

Adding a new hash function to this suite is simple, just define
a new instance member of type "Hash" with the logic applied to
the region passed in.

Change-Id: Iec0b176adb464cf95b06cda157932b79c0b59886
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-24 12:49:29 -07:00
Chris Aniszczyk b3446bf387 Update Tag to use TagCommand API
Change-Id: I4f7f8e29c47980536398d73f2a71ed2b2c00f4f2
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-09-22 11:02:50 -05:00
Shawn O. Pearce 4b5d3d291b Qualify builds as 0.10.0
Change-Id: I54815c85b32b9492c059064b39f48677e68c5e90
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-16 17:26:53 -07:00
Shawn O. Pearce 5deb5b9a4a Merge branch 'stable-0.9'
* stable-0.9:
  Qualify post-0.9.3 builds
  JGit 0.9.3
  clone: Correct formatting of init message
  Fix cloning of repositories with big objects
  Qualify post-0.9.1 builds
  JGit 0.9.1
  Fix PlotCommitList to set lanes on child-less commits
2010-09-16 17:22:37 -07:00
Christian Halstrick 55714f6e73 Add --all option to RevWalkTextBuiltin
Allow our command line commands like Glog, Log to accept the
--all option to walk all known refs.

Change-Id: I6a0c84fc19e7fa80ddaa2315851c58ba89d43ca5
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2010-09-16 10:36:43 +02:00