Commit Graph

5678 Commits

Author SHA1 Message Date
Matthias Sohn 9b414ffd3c Update orbit to S20180302171354 (photon) and R20180206163158 (oxygen)
Change-Id: I5b5e59581bfa00bb16e3b8e0af6e154ad6583bb9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-04 00:53:19 +01:00
David Pursehouse bc9e3a31b2 Add|RemoveNoteComand: Reduce duplicated code
The private method commitNoteMap is in both classes with the same
implementation.

Make it static in AddNoteCommand and reuse it from RemoveNoteCommand.

Change-Id: Ia037bf9efdd94ee7b8d33b41321e9cfd6ea4a6a5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:50 +01:00
David Pursehouse 2d178f5f14 LFSPointerTest: Open ByteArrayOutputStream in try-with-resource
Change-Id: Ib15a838e735f8b960e0ed635d6d9b0caf97f4791
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:49 +01:00
David Pursehouse 91a2be13e5 AbbreviationTest: Open FileOutputStream in try-with-resource
Change-Id: Id1d48da466251f9e4186f4674afba4b5901a4388
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:49 +01:00
David Pursehouse cf489d36b9 TagBuilder: Open OutputStreamWriter in try-with-resource
Change-Id: Ic0e23039b0aec6171f192234c6b1474cd32eadff
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:49 +01:00
David Pursehouse a73f6c6009 DaemonService: Open Repository in try-with-resource
Change-Id: I8deec91d91e82c7cb186cfa9507eb443dd87aad3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:49 +01:00
David Pursehouse 63be96f488 RefDirectory: Open BufferedReader in try-with-resource
Change-Id: I9239df3e381b141b48ad7ea1b706e5b5927946cd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:48 +01:00
David Pursehouse db0b7911fe ObjectDirectory: Open BufferedReader in try-with-resource
Change-Id: I4a44954c61647af1e48eade19112697e79297f2e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:48 +01:00
David Pursehouse 86330ca2ad Patch: Open TemporaryBuffer in try-with-resource
Change-Id: I90bff8d49ecc37b8c10ce909cd3ac563205b641c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:48 +01:00
David Pursehouse a573dfc658 Enable warning for resources not managed by try-with-resource
Change-Id: Iefe97de6bdb62af558f1b0e77c9205a9186f9b4c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-03-03 23:58:47 +01:00
Markus Duft c0103bc59d LFS: Enable LFS support for the CLI, better error handling
Enable LFS support for the CLI by registering the according filters.

Errors during filter creation must be propagated up the call stack, as a
failure to create a filter should be treated as fatal if the filter is
required.

Change-Id: I3833757839bdda97cd01b6c21c1613d199e2692d
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-03-03 11:44:01 +01:00
Markus Duft a3f8edbf6a Cleanup stream usage WRT filters
As it is right now some streams leak out of the filter construct. This
change clarifies responsibilities and fixes stream leaks

Change-Id: Ib9717d43a701a06a502434d64214d13a392de5ab
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-03 11:40:55 +01:00
Markus Duft d3ed64bcd4 LFS: support merge/rebase/cherry-pick/diff/compare with LFS files
Respect merge=lfs and diff=lfs attributes where required to replace (in
memory) the content of LFS pointers with the actual blob content from
the LFS storage (and vice versa when staging/merging).

Does not implement general support for merge/diff attributes for any
other use case apart from LFS.

Change-Id: Ibad8875de1e0bee8fe3a1dffb1add93111534cae
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-03-03 11:39:43 +01:00
Matthias Sohn 169de08a78 Merge "LFS: Dramatically improve checkout speed with SSH authentication" 2018-03-01 09:16:55 -05:00
Markus Duft ea2f7e93c7 LFS: Dramatically improve checkout speed with SSH authentication
SSH Authentication is quite expensive (~120ms on localhost against
Gerrit with LFS plugin). The SSH authentication typically also sends a
validity time of the returned token, which allows to re-use it for a
certain time, avoiding the expensive authentication on every download
request. This improves checkout times by large factors depending on the
LFS object amount/sizes.

Also make sure that all instances of Gson used by LFS are configured in
the same way.

Change-Id: I422c94c37021b4322789b3829fa0185e25d683f2
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-03-01 13:29:17 +01:00
Terry Parker 5a74b586b3 Correctly exit fetch negotiation for stateless RPC connections
Commit 9530c10192 (2018-02-11)
"Add a minimum negotiation feature for fetch" made fetch
negotiation cheaper for repos with huge numbers of
references (we are seeing a 15x reduction in maximum fetch
times for chromium/chromium/src on trans-Pacific links).
But it inadvertently broke the handling of stateless RPC
connections, so fix that here.

Change-Id: I0090aa76ffecc55801ebb833ac2e0c933a4a7c54
Signed-off-by: Terry Parker <tparker@google.com>
2018-02-28 15:32:57 -08:00
Markus Duft c0bb992845 LFS: pre-push upload support
If JGit built in LFS support is enabled for the current repository (or
user/system), any existing pre-push hook will cause an exception for the
time beeing, as only a single pre-push hook is supported.

Thus either native pre-push hooks OR JGit built-in LFS support may be
enabled currently, but not both.

Change-Id: Ie7d2b90e26e948d9cca3d05a7a19489488c75895
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-27 18:32:45 +01:00
David Pursehouse 12a589fb57 AmazonS3: Open OutputStream in try-with-resource
Change-Id: I0685a298a0f9fec465973cc718ae3bff373318a4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-26 20:38:12 +09:00
David Pursehouse c2ff87e786 MergeGitAttributeTest: Open FileInputStream in try-with-resource
Change-Id: Iec85eea044c46a199b5b6f6bdbb3191d817dd441
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-26 17:48:42 +09:00
David Pursehouse 8212924ede PullCommandWithRebaseTest: Open File{Input|Output}Stream in try-with-resource
Change-Id: I1ff707ab7bab676603907f4c0bb1bc495503055b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-26 17:45:11 +09:00
David Pursehouse ca7d3e2734 RecursiveMergerTest: Open FileOutputStream in try-with-resource
Change-Id: I158333d6393fb807bc21fba23fec7ad474384471
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-26 17:39:57 +09:00
David Pursehouse 4651d01e29 PullCommandTest: Use try-with-resources for File{Input,Output}Stream
Change-Id: I09242eb289655c7554aefa9e0817d9b881db656b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-26 08:58:48 +09:00
David Pursehouse f0b46e1db4 Add ObjectIdSerializer
This is based on the ObjectIdSerialization class written by Shawn Pearce
for the Gerrit Code Review project in 2009 [1]. As mentioned in the
commit message there, it should be part of core JGit.

This implementation is slightly different to Shawn's version. Rather
than having separate methods for null/non-null ids, single methods are
implemented with @Nullable annotations.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/9792

Change-Id: I7599cf8bd1ecd546e2252783d6d672eb76804060
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-25 23:15:01 +01:00
David Pursehouse eba04da7be CheckoutCommandTest: Fix name of created temp file
Change-Id: I29048f83aee3848679bbc6ded09dd3dd4a2ea35b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-25 17:47:43 +09:00
David Pursehouse 5ef028ff4a IgnoreNodeTest: Suppress deprecation warnings in testEmptyIgnoreNode
Change-Id: I930c9408cc702af911419f2a7b3d03f652a2d4e3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-25 17:36:38 +09:00
David Pursehouse c9e3921fbb Fix warnings about boxing/unboxing Boolean
Change-Id: I9d81d510282e9181267750fe3f9c571c35b61407
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-25 17:35:12 +09:00
David Pursehouse e8c69fa5fd WorkingTreeIterator: Fix warnings about variable hiding
Change-Id: I78ed3ae7aa30a7e7f146d0bd2e9feff74554da78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-25 17:32:33 +09:00
David Pursehouse 6ea21b454c WorkingTreeIterator: Add NON-NLS suppressions
Change-Id: I369b8f68912134fc3880c162e9a2c5a1669bb4ac
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-25 17:30:16 +09:00
Matthias Sohn 3e3554c9eb Merge "Fix processing of gitignore negations" 2018-02-23 19:42:03 -05:00
Marc Strapetz 78420b7d0a Fix processing of gitignore negations
Processing of negated rules, like !bin/ was not working correctly: they
were interpreted too broad, resulting in unexpected untracked files
which should actually be ignored

Bug: 409664
Change-Id: I0a422fd6607941461bf2175c9105a0311612efa0
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2018-02-23 13:36:48 +01:00
Michael Keppler beacbe3eee Update tycho to 1.1.0
The upgrade was already done 3 weeks ago, this version number was
missing, however.

Change-Id: Ibc794ba8035c46ea2160925b344ded5714b7c987
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-02-23 09:14:05 +01:00
Matthias Sohn 152d5e2a14 Configure Semaphore used in TestRequestLog to be fair
Bug: 528187
Change-Id: I26c94ad7f802fc1dbe72d63a7ea346dc6e19ff94
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-22 23:16:42 +01:00
Matthias Sohn 520f3af7b4 Fix indentation in TestRequestLog
We use tabs to indent.

Change-Id: I19b00e06becfb92fbabb99b5699385506fd85214
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-22 23:16:42 +01:00
Dave Borowitz 879372eb72 DfsReaderIoStats: Clarify that "blocks" are really cache misses
The previous wording was ambiguous as to whether these were blocks
requested from the cache (hits + misses) or read from underlying storage
(misses only).

They are in fact recording only misses:
Accumulator#{readBlock,readBlockBytes,readBlockMicros} are only
incremented from BlockBasedFile#readOneBlock, which is only called from
the cache miss path in DfsBlockCache#getOrLoad (line 391).

Change-Id: I0135cd1e76d09c1e28e0f1833b34c312511c66ce
2018-02-22 16:27:09 +09:00
Marc Strapetz 49cb6ba5dd PathMatcher: fix handling of **/
**/ should match only directories, but not files

Change-Id: I885c83e5912cac5bff338ba657faf6bb9ec94064
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2018-02-22 14:39:23 +09:00
David Pursehouse 0e20df710a Merge changes Id616611e,Ib6509e81,I52f5d3f2
* changes:
  RepoCommand: generate relative submodule URLs from absolute URLs.
  RepoCommand: don't record new commit if tree did not change
  RepoCommand: persist unreadable submodules in .gitmodules
2018-02-22 00:37:48 -05:00
Marc Strapetz 372e04dcf3 CGitIgnoreTest: also test untracked files
Change-Id: I21a4ebd63eaaa85aa2e68f99ef58c141189bdab4
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2018-02-21 14:50:50 -05:00
Shawn Pearce d0fbaf502e dfs: Try to avoid searching UNREACHABLE_GARBAGE during packing
If an object can be found in a non-garbage pack, favor that pack over
paging in the garbage pack's idx and pack content.

Only fall back to garbage packs if an object cannot be found and there
are garbage packs present in the repository.  This fallback is
required to correct race conditions during GC.

Change-Id: Ia7c123975bc069b8e6e713eda2d357303b71e329
2018-02-21 14:46:57 -05:00
Han-Wen Nienhuys 6a420613f7 RepoCommand: generate relative submodule URLs from absolute URLs.
If a manifest file specifies an absolute URL on the same host on which
the superproject resides, rewrite the URLs to be relative.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: Id616611e5195998fb665c8e7806539a3a02e219a
2018-02-21 13:41:50 +01:00
Han-Wen Nienhuys 3214171dec RepoCommand: don't record new commit if tree did not change
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: Ib6509e816684256d723558d5e8f3c37de58a2ff8
2018-02-19 20:24:07 +09:00
Han-Wen Nienhuys 446a7096ef RepoCommand: persist unreadable submodules in .gitmodules
In cases where a manifest file mixes different remotes, a Gerrit
server process may not have access to all remotes, and won't be able
to produce a full submodule tree.

Preserving this information in .gitmodules will let downstream clients
reconstruct the full tree.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I52f5d3f288e771dca0af2b4dd3f3fa0f940dcf15
2018-02-19 20:24:07 +09:00
Han-Wen Nienhuys 35bb7ccc4c Declare LFS dependency on GSON for Bazel build
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: Ia017dd5651756c3b80f18b908fb28ba56b6cbf14
2018-02-19 19:06:38 +09:00
Matthias Sohn 44f0a01f24 Silence API error for new constant in ConfigConstants
Change-Id: Ic4bd10b67caf6b2a2cc0c23bb4e7c717e4ccd6d5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-18 22:23:00 +01:00
Matthias Sohn 33d5c0fe4a Silence API errors raised for new public fields in PackStatistics
Change-Id: I8e118282a833361b676aa3cc90cbe774ccd42ed0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-18 22:08:47 +01:00
Markus Duft 94bcde663c LFS: Add remote download to SmudgeFilter
Transfer data in chunks of 8k Transferring data byte per byte is slow,
running checkout with CleanFilter on a 2.9MB file takes 20 seconds.
Using a buffer of 8k shrinks this time to 70ms.

Also register the filter commands in a way that the native GIT LFS can
be used alongside with JGit.

Implements auto-discovery of LFS server URL when cloning from a Gerrit
LFS server.

Change-Id: I452a5aa177dcb346d92af08b27c2e35200f246fd
Also-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
2018-02-16 18:27:25 +01:00
David Pursehouse 9bebb1eae7 RepoCommand: Don't leave Git open
When the command is run on a non-bare repository, an instance of
Git is created to execute the commit, and is left open when the
command has finished.

Refactor to not use a class scope Git instance, and make sure it
gets closed before returning.

Change-Id: Ic623ae0fd8b9e264b5dfd434da0de6bb4f910984
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-02-15 16:59:42 +09:00
Matthias Sohn 282dc592da Merge "Merge branch 'stable-4.10'" 2018-02-14 18:18:43 -05:00
David Pursehouse 184ddc5afa Merge "InitCommand: Don't leave Repository open after Git is closed" 2018-02-14 18:18:35 -05:00
Matthias Sohn d2d22e1471 Merge branch 'stable-4.10'
* stable-4.10:
  Fix ssh host name handling for Jsch
  Jsch overrides the port in the URI with the one in ~/.ssh/config

Change-Id: I860fc61ceb12ae792b1ee7421046ecd32373b9f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-14 23:28:28 +01:00
Matthias Sohn 6e0f8bacd4 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Fix ssh host name handling for Jsch
  Jsch overrides the port in the URI with the one in ~/.ssh/config

Change-Id: Iff9076f65e767bbe8df016337b631bdaeb40ad98
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-02-14 21:25:16 +01:00