]> source.dussan.org Git - jgit.git/log
jgit.git
23 months agoMerge branch 'stable-6.1' into stable-6.2 03/197003/1
Matthias Sohn [Wed, 16 Nov 2022 08:55:22 +0000 (09:55 +0100)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: Ie433c46a01a0f33848d54ecf99b30a44ca01e286

23 months agoMerge branch 'stable-6.0' into stable-6.1 02/197002/1
Matthias Sohn [Wed, 16 Nov 2022 08:54:28 +0000 (09:54 +0100)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: I176419026c3f4fdd8ebd34c61468c1ec3482ff45

23 months agoMerge branch 'stable-5.13' into stable-6.0 01/197001/1
Matthias Sohn [Tue, 15 Nov 2022 23:15:17 +0000 (00:15 +0100)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  [benchmarks] Remove profiler configuration
  Add SHA1 benchmark
  [benchmarks] Set version of maven-compiler-plugin to 3.8.1
  Fix running JMH benchmarks
  Add option to allow using JDK's SHA1 implementation
  Ignore IllegalStateException if JVM is already shutting down

Change-Id: I40105336f0b9e593a8a2c242a9557f854c274fdc

23 months ago[benchmarks] Remove profiler configuration 42/196942/7
Matthias Sohn [Mon, 14 Nov 2022 22:23:55 +0000 (23:23 +0100)]
[benchmarks] Remove profiler configuration

Profiler configuration can be added when required. It was commented out
in most benchmarks.

Change-Id: I725f98757f7d4d2ba2589658e34e2fd6fbbbedee

23 months agoAdd SHA1 benchmark 06/196906/13
Matthias Sohn [Tue, 15 Nov 2022 12:22:12 +0000 (13:22 +0100)]
Add SHA1 benchmark

Results on a Mac M1 max:

    size     SHA1Native SHA1Java    SHA1Java
                        without     with
                        collision   collision
                        detection   detection
    [kB]     [us/op]    [us/op]     [us/op]
---------------------------------------------
      1       3.662       4.200       4.707
      2       7.053       7.868       8.928
      4      13.883      15.149      17.608
      8      27.225      30.049      35.237
     16      54.014      59.655      70.867
     32     106.457     118.022     140.403
     64     212.712     237.702     281.522
   1024    3469.519    3868.883    4637.287
 131072  445011.724  501751.992  604061.308
1048576 3581702.104 4008087.854 4831023.563

The last 3 sizes (1, 128, 1024 MB) weren't committed
here to limit the total runtime.

Bug: 580310
Change-Id: I7d0382fd4aa4c4734806b12e96b671bee37d26e3

23 months ago[benchmarks] Set version of maven-compiler-plugin to 3.8.1 41/196941/6
Matthias Sohn [Mon, 14 Nov 2022 21:25:40 +0000 (22:25 +0100)]
[benchmarks] Set version of maven-compiler-plugin to 3.8.1

Change-Id: Ib14db133c76a55358ea79663ef38d9fb47a67f45

23 months agoFix running JMH benchmarks 25/196225/9
Matthias Sohn [Tue, 4 Oct 2022 13:45:01 +0000 (15:45 +0200)]
Fix running JMH benchmarks

Without this I sometimes hit the error:

$ java -jar target/benchmarks.jar
Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to
find the resource: /META-INF/BenchmarkList
at org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:98)
at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:124)
at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:253)
at org.openjdk.jmh.runner.Runner.run(Runner.java:209)
at org.openjdk.jmh.Main.main(Main.java:71)

Change-Id: Iea9431d5f332f799d55a8a2d178c79a2ef0da22b

23 months agoAdd option to allow using JDK's SHA1 implementation 05/196905/9
Matthias Sohn [Fri, 11 Nov 2022 16:54:06 +0000 (17:54 +0100)]
Add option to allow using JDK's SHA1 implementation

The change If6da9833 moved the computation of SHA1 from the JVM's
JCE to a pure Java implementation with collision detection.
The extra security for public sites comes with a cost of slower
SHA1 processing compared to the native implementation in the JDK.

When JGit is used internally and not exposed to any traffic from
external or untrusted users, the extra cost of the pure Java SHA1
implementation can be avoided, falling back to the previous
native MessageDigest implementation.

Bug: 580310
Change-Id: Ic24c0ba1cb0fb6282b8ca3025ffbffa84035565e

23 months agoIgnore IllegalStateException if JVM is already shutting down 40/196540/1
Matthias Sohn [Thu, 27 Oct 2022 18:31:31 +0000 (20:31 +0200)]
Ignore IllegalStateException if JVM is already shutting down

Trying to register/unregister a shutdown hook when the JVM is already in
shutdown throws an IllegalStateException. Ignore this exception since we
can't do anything about it.

Bug: 580953
Change-Id: I8fc6fdd5585837c81ad0ebd6944430856556d90e

2 years agoMerge branch 'stable-6.1' into stable-6.2 96/194596/1
Matthias Sohn [Wed, 6 Jul 2022 15:01:03 +0000 (17:01 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  UploadPack: don't prematurely terminate timer in case of error
  Do not create reflog for remote tracking branches during clone
  UploadPack: do not check reachability of visible SHA1s
  Add missing package import javax.management to org.eclipse.jgit

Change-Id: Ib3ff6a038e1b92a931a7f2624c19bbefd8cb95fd

2 years agoMerge branch 'stable-6.0' into stable-6.1 95/194595/1
Matthias Sohn [Wed, 6 Jul 2022 15:00:09 +0000 (17:00 +0200)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  UploadPack: don't prematurely terminate timer in case of error
  Do not create reflog for remote tracking branches during clone
  UploadPack: do not check reachability of visible SHA1s
  Add missing package import javax.management to org.eclipse.jgit

Change-Id: I08734ee2c8f3296d908da6a29d53ed87c4b48eb2

2 years agoMerge branch 'stable-5.13' into stable-6.0 94/194594/1
Matthias Sohn [Wed, 6 Jul 2022 08:38:30 +0000 (10:38 +0200)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  UploadPack: don't prematurely terminate timer in case of error
  Do not create reflog for remote tracking branches during clone
  UploadPack: do not check reachability of visible SHA1s
  Add missing package import javax.management to org.eclipse.jgit

Change-Id: I6db0a4d74399fde892eeec62efd2946f97547a5d

2 years agoUploadPack: don't prematurely terminate timer in case of error 00/194500/2
Matthias Sohn [Wed, 29 Jun 2022 12:58:17 +0000 (14:58 +0200)]
UploadPack: don't prematurely terminate timer in case of error

In uploadWithExceptionPropagation don't prematurely terminate timer in
case of error to enable reporting it to the client. Expose a close
method so that callers can terminate it at the appropriate time.

If the timer is already terminated when trying to report it to the
client this failed with the error java.lang.IllegalStateException:
"Timer already terminated".

Bug: 579670
Change-Id: I95827442ccb0f9b1ede83630cf7c51cf619c399a

2 years agoMerge "Do not create reflog for remote tracking branches during clone" into stable...
Matthias Sohn [Sun, 26 Jun 2022 19:36:03 +0000 (15:36 -0400)]
Merge "Do not create reflog for remote tracking branches during clone" into stable-5.13

2 years agoDo not create reflog for remote tracking branches during clone 07/193007/24
Luca Milanesio [Fri, 29 Apr 2022 15:45:03 +0000 (16:45 +0100)]
Do not create reflog for remote tracking branches during clone

When using JGit on a non-bare repository, the CloneCommand
it previously created local reflogs for all branches including remote
tracking ones, causing the generation of a potentially large
number of files on the local filesystem.

The creation of the remote-tracking branches (refs/remotes/*) during
clone is not an issue for the local filesystem because all of them are
stored in a single packed-refs file. However, the creation of a large
number of ref logs on a local filesystem IS an issue because it
may not be tuned or initialised in term of inodes to contain a very
large number of files.

When a user (or a CI system) performs the CloneCommand against
a potentially large repository (e.g., millions of branches), it is
interested in working or validating a single branch or tag and is
unlikely to work with all the remote-tracking branches.
The eager creation of a reflogs for all the remote-tracking branches is
not just a performance issue but may also compromise the ability to
use JGit for cloning a large repository.

The behaviour implemented in this change is also consistent with the
optimisation done in the C code-base [1].

We differentiate between clone and fetch commands using --branch
<initialBranch> option, that is only available in clone command,
and is set as HEAD per default.

[1] https://github.com/git/git/commit/58f233ce1ed67bbc31a429fde5c65d5050fdbd7d

Bug: 579805
Change-Id: I58d0d36a8a4ce42e0f59b8bf063747c4b81bd859
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2 years agoUploadPack: do not check reachability of visible SHA1s 96/193496/11
Luca Milanesio [Thu, 19 May 2022 10:12:28 +0000 (11:12 +0100)]
UploadPack: do not check reachability of visible SHA1s

When JGit needs to serve a Git client requesting SHA1s
during the want phase, it needs to make a full reachability
check from the advertised refs to the ones requested to
keep all objects in the correct scope of confidentiality
allowed by the avertised refs.

The check is also performed when the SHA1 corresponds to
one of the tips of the advertised refs which is a waste of
resources.

Example:

fetch> ref-prefix refs/heads/foo
fetch< 900505eb8ce8ced2a1757906da1b25c357b9654e refs/heads/foo
fetch< 0000
fetch> command=fetch
fetch> 0001
fetch> thin-pack
fetch> ofs-delta
fetch> want 900505eb8ce8ced2a1757906da1b25c357b9654e

The SHA1 in the want is the tip of refs/heads/foo and therefore
the full reachability check can be shortened and resolved more
quickly.

Change-Id: I49bd9e2464e0bd3bca2abf14c6e9df550d07383b
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
2 years agoAdd missing package import javax.management to org.eclipse.jgit 34/194234/1
Matthias Sohn [Fri, 17 Jun 2022 11:49:59 +0000 (13:49 +0200)]
Add missing package import javax.management to org.eclipse.jgit

Class org.eclipse.jgit.util.Monitoring uses JMX hence we need this
import otherwise OSGi applications can face ClassNotFoundException.

Bug: 577018
Change-Id: Ifd75337b87c7faec95d333b771bb0a2f3e46a418

2 years agoMerge branch 'stable-6.1' into stable-6.2 94/194194/1
Matthias Sohn [Wed, 15 Jun 2022 15:39:52 +0000 (17:39 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Prepare 5.13.2-SNAPSHOT builds
  JGit v5.13.1.202206130422-r
  AmazonS3: Add support for AWS API signature version 4

Change-Id: Id4965aacd4e2ea1e8575a2c1bd4845729db6049a

2 years agoMerge branch 'stable-6.0' into stable-6.1 93/194193/1
Matthias Sohn [Wed, 15 Jun 2022 14:32:08 +0000 (16:32 +0200)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Prepare 5.13.2-SNAPSHOT builds
  JGit v5.13.1.202206130422-r
  AmazonS3: Add support for AWS API signature version 4

Change-Id: Ie9c38ab8033fe1283e8b444b6acd3f4298062bf3

2 years agoMerge branch 'stable-5.13' into stable-6.0 88/194188/1
Matthias Sohn [Wed, 15 Jun 2022 14:31:38 +0000 (16:31 +0200)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Prepare 5.13.2-SNAPSHOT builds
  JGit v5.13.1.202206130422-r
  AmazonS3: Add support for AWS API signature version 4

Change-Id: Ibd663a1d874d1aac274abc3dd44354fd99f64c39

2 years agoPrepare 5.13.2-SNAPSHOT builds 46/194146/1
Matthias Sohn [Mon, 13 Jun 2022 22:41:18 +0000 (00:41 +0200)]
Prepare 5.13.2-SNAPSHOT builds

Change-Id: I4862e5d80a7d95a1a119d06306e3f6927445d1d3

2 years agoJGit v5.13.1.202206130422-r 19/194119/1 v5.13.1.202206130422-r
Matthias Sohn [Mon, 13 Jun 2022 08:22:43 +0000 (10:22 +0200)]
JGit v5.13.1.202206130422-r

Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: Ife74d64e8171c68dbf08271492c0ac852a6dc51c

2 years agoAmazonS3: Add support for AWS API signature version 4 12/193712/6
eric.steele [Wed, 1 Jun 2022 01:03:17 +0000 (18:03 -0700)]
AmazonS3: Add support for AWS API signature version 4

Updating the AmazonS3 class to support AWS Signature version 4 because
version 2 is no longer supported in all AWS regions. The version can be
selected with the new 'aws.api.signature.version' property (defaults to
2 for backwards compatibility). When set to '4', the user must also
specify the AWS region via the 'region' property. The 'region' property
must match the region that the 'domain' property resolves to.

Bug: 579907
Change-Id: If289dbc6d0f57323cfeaac2624c4eb5028f78d13

2 years agoPrepare 6.2.1-SNAPSHOT builds 15/194015/1
Matthias Sohn [Tue, 7 Jun 2022 20:31:32 +0000 (22:31 +0200)]
Prepare 6.2.1-SNAPSHOT builds

Change-Id: I4a0f3919ff43a3b9fafa85b8ecec2d760b7eb161

2 years agoJGit v6.2.0.202206071550-r 13/194013/1 v6.2.0.202206071550-r
Matthias Sohn [Tue, 7 Jun 2022 19:49:30 +0000 (21:49 +0200)]
JGit v6.2.0.202206071550-r

Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: Ib4ae85a0cabcc9cb867f2c85034d72fb676a500a

2 years agoMerge branch 'stable-6.1' into stable-6.2 73/193973/1
Matthias Sohn [Tue, 7 Jun 2022 09:36:46 +0000 (11:36 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Fix connection leak for smart http connections

Change-Id: I4d38c62fa5416fd40b699de5b0ecfa03d498c21d

2 years agoMerge branch 'stable-6.0' into stable-6.1 72/193972/1
Matthias Sohn [Tue, 7 Jun 2022 09:36:11 +0000 (11:36 +0200)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Fix connection leak for smart http connections

Change-Id: I8b7e643b87c0f788cdafb060a2c9e8b4ef6f7375

2 years agoMerge branch 'stable-5.13' into stable-6.0 71/193971/1
Matthias Sohn [Tue, 7 Jun 2022 09:35:13 +0000 (11:35 +0200)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Fix connection leak for smart http connections

Change-Id: Ic851f2c4660ed761f5527e405b116b54da42fb7c

2 years agoMerge branch 'stable-5.12' into stable-5.13 70/193970/1
Matthias Sohn [Tue, 7 Jun 2022 09:34:25 +0000 (11:34 +0200)]
Merge branch 'stable-5.12' into stable-5.13

* stable-5.12:
  Fix connection leak for smart http connections

Change-Id: Id34f29c1b27a80c2b56c911cad7e3f64ef63af48

2 years agoMerge branch 'stable-5.11' into stable-5.12 69/193969/1
Matthias Sohn [Tue, 7 Jun 2022 09:33:38 +0000 (11:33 +0200)]
Merge branch 'stable-5.11' into stable-5.12

* stable-5.11:
  Fix connection leak for smart http connections

Change-Id: I6caabf4774ccf34706cef846c1087710f67e2ecd

2 years agoMerge branch 'stable-5.10' into stable-5.11 67/193967/2
Matthias Sohn [Tue, 7 Jun 2022 08:50:25 +0000 (10:50 +0200)]
Merge branch 'stable-5.10' into stable-5.11

* stable-5.10:
  Fix connection leak for smart http connections

Change-Id: I3885c6114caed897f762f5ce523d3b27288205b2

2 years agoMerge branch 'stable-5.9' into stable-5.10 66/193966/1
Matthias Sohn [Tue, 7 Jun 2022 08:42:22 +0000 (10:42 +0200)]
Merge branch 'stable-5.9' into stable-5.10

* stable-5.9:
  Fix connection leak for smart http connections

Change-Id: I5e7144b2f5cd850978220c476947001ae2debb8e

2 years agoUpdate DEPENDENCIES for 6.2.0 to be released with 2022-06 59/193959/1
Matthias Sohn [Mon, 6 Jun 2022 21:30:34 +0000 (23:30 +0200)]
Update DEPENDENCIES for 6.2.0 to be released with 2022-06

Change-Id: Ifdead74d1000fb110802eeb421b021ab674a9d59

2 years agoUpdate orbit to R20220531185310 for 2022-06 57/193957/1
Matthias Sohn [Mon, 6 Jun 2022 21:24:23 +0000 (23:24 +0200)]
Update orbit to R20220531185310 for 2022-06

Change-Id: I436ba965e5f6677f7967ee8f4992dfb467054472

2 years agoMerge branch 'master' into stable-6.2 56/193956/1
Matthias Sohn [Mon, 6 Jun 2022 20:52:49 +0000 (22:52 +0200)]
Merge branch 'master' into stable-6.2

* master:
  [releng] Fix MANIFEST.MF of o.e.j.ssh.apache.agent

Change-Id: Ica9069dd97b58aeefc6ac39f2034e513eb58f1e6

2 years agoPrepare 6.2.0-SNAPSHOT builds 54/193954/1
Matthias Sohn [Mon, 6 Jun 2022 20:08:59 +0000 (22:08 +0200)]
Prepare 6.2.0-SNAPSHOT builds

Change-Id: Id2ad8d5b561620723b2c52c86909321d628de12f

2 years ago[releng] Fix MANIFEST.MF of o.e.j.ssh.apache.agent 45/193945/1
Thomas Wolf [Mon, 6 Jun 2022 12:42:25 +0000 (14:42 +0200)]
[releng] Fix MANIFEST.MF of o.e.j.ssh.apache.agent

Add the missing Bundle-Localization header.

Bug: 580081
Change-Id: If21e0778dbb60b49a8f83030461670656eeb0ce4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoFix connection leak for smart http connections 39/193939/3
Saša Živkov [Fri, 3 Jun 2022 14:36:43 +0000 (16:36 +0200)]
Fix connection leak for smart http connections

SmartHttpPushConnection: close InputStream and OutputStream after
processing. Wrap IOExceptions which aren't TransportExceptions already
as a TransportException.

Also-By: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: I8e11d899672fc470c390a455dc86367e92ef9076

2 years agoMerge branch 'master' into stable-6.2 34/193934/1
Andrey Loskutov [Fri, 3 Jun 2022 13:49:45 +0000 (15:49 +0200)]
Merge branch 'master' into stable-6.2

* master:
  Adapt diff- and merge tool code for PGM and EGit usage
  Teach JGit to handle external diff/merge tools defined in
.gitattributes

Change-Id: I3aefc14160caaac859bd3548460dd755ebe42fc5

2 years agoTeach JGit to handle external diff/merge tools defined in .gitattributes 43/166943/21
Andre Bossert [Tue, 21 Jan 2020 09:13:43 +0000 (10:13 +0100)]
Teach JGit to handle external diff/merge tools defined in .gitattributes

Adds API that allows UI to find (and handle) diff/merge tools, specific
for the given path. The assumption is that user can specify file type
specific diff/merge tools via gitattributes.

Bug: 552840
Change-Id: I1daa091e9afa542a9ebb5417853dff0452ed52dd
Signed-off-by: Mykola Zakharchuk <zakharchuk.vn@gmail.com>
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
2 years agoAdapt diff- and merge tool code for PGM and EGit usage 75/140275/45
Andre Bossert [Sun, 19 Jan 2020 19:57:23 +0000 (20:57 +0100)]
Adapt diff- and merge tool code for PGM and EGit usage

see: https://git-scm.com/docs/git-mergetool

* DiffTools and MergeTools
  * store FS, gitDir and workTree for usage without
git repository (for EGit preferences)
  * add getUserDefinedToolNames() and getPredefinedToolNames()
  * replace getToolNames() with getAllToolNames() that combines the two
lists and put default tool name (diff.tool or merge.tool) as first
element (for EGit preferences)
* FileElement: refactoring of getFile() and friends to have midName
(LOCAL, REMOTE etc.) always added to the temp file name (also for EGit)
* FileElement: added directory attribute that is used in getFile() to
return path with workDir as parent
* DiffTool and MergeTool
  * added errw.flush(), because sometimes stderr is not printed in case
of die()
  * print e.getMessage() always to stderr
* Moved toolname and prompt logic into managers
* Exported internal packages required for egit.ui

Bug: 356832
Change-Id: I71e7f4dc362169a7612ca4f6546a021bc4b2b5f4
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
2 years agoJGit v6.2.0.202206011217-rc1 77/193877/1 v6.2.0.202206011217-rc1
Matthias Sohn [Wed, 1 Jun 2022 16:17:31 +0000 (18:17 +0200)]
JGit v6.2.0.202206011217-rc1

Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Change-Id: Id9639b466583d8c373ef700402cb685ce4a8ee15

2 years agoMerge branch 'master' into stable-6.2 76/193876/1
Matthias Sohn [Wed, 1 Jun 2022 16:14:28 +0000 (18:14 +0200)]
Merge branch 'master' into stable-6.2

* master:
  Fixed since tags added for new merge constants
  Add filtering with help of DirCacheCheckout.getContent()
  Avoid warning "no explicit project encoding"
  Add mergetool merge feature (execute external tool)
  Add command line support for "git mergetool"
  Add config reader for user-defined mergetools
  Add difftool compare feature (execute external tool)

Change-Id: Ie215b8205b85cfd9efddb622c90dfad7a5ae0caa

2 years agoAdd availability check of pre-defined tools 45/139545/38
Andre Bossert [Sun, 19 Jan 2020 19:56:28 +0000 (20:56 +0100)]
Add availability check of pre-defined tools

see: https://git-scm.com/docs/git-difftool
see: https://git-scm.com/docs/git-mergetool

* now all available tools are printed with "--tool-help"
* if no diff.tool or merge.tool is defined the first available
pre-defined tool is used

TODO:
- add mergetools to difftools --> extra change or merge to this
- return the exit-code of the tool to jgit / java runtime

Bug: 356832
Change-Id: I20fb04e71ced981f5625020f461bbac24e6cec70
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
2 years agoMerge "Add filtering with help of DirCacheCheckout.getContent()"
Andrey Loskutov [Mon, 30 May 2022 16:42:20 +0000 (12:42 -0400)]
Merge "Add filtering with help of DirCacheCheckout.getContent()"

2 years agoFixed since tags added for new merge constants 13/193813/1
Andrey Loskutov [Mon, 30 May 2022 14:34:07 +0000 (16:34 +0200)]
Fixed since tags added for new merge constants

Bug: 356832
Change-Id: I70197522675de0e9b53399ee3d9ed3f10312ff6b

2 years agoAdd filtering with help of DirCacheCheckout.getContent() 62/139262/42
Andre Bossert [Sun, 19 Jan 2020 19:54:17 +0000 (20:54 +0100)]
Add filtering with help of DirCacheCheckout.getContent()

see: https://git-scm.com/docs/git-mergetool

* refactoring of content (FileElement) handling
* now the temporary files are already filled with filtered content in
the calling classes (PGM), that can be used with EGit content too

TODO:
 * keep the temporaries when no change detected and the user answers no
to the question if the merge was successful

Bug: 356832
Change-Id: I86a0a052d059957d4d152c1bb94c262902c377d2
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
2 years agoMerge branch 'stable-6.1' into stable-6.2 96/193796/1
Matthias Sohn [Sat, 28 May 2022 21:59:50 +0000 (23:59 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Remove stray files (probes or lock files) created by background threads

Change-Id: I1645106e91bc28153ec032ea66ad0f30f47b647e

2 years agoMerge "Merge branch 'stable-6.1' into stable-6.2"
Matthias Sohn [Sat, 28 May 2022 21:49:47 +0000 (17:49 -0400)]
Merge "Merge branch 'stable-6.1' into stable-6.2"

2 years agoMerge branch 'stable-6.1' into stable-6.2 69/193769/1
Matthias Sohn [Fri, 27 May 2022 14:22:59 +0000 (16:22 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  Remove stray files (probes or lock files) created by background threads

Change-Id: I7114d68b059a2549fde69fa1b04e45b7bb876804

2 years agoMerge branch 'stable-6.0' into stable-6.1 68/193768/1
Matthias Sohn [Fri, 27 May 2022 14:22:09 +0000 (16:22 +0200)]
Merge branch 'stable-6.0' into stable-6.1

* stable-6.0:
  Remove stray files (probes or lock files) created by background threads

Change-Id: Iab21b9776c2ebecd4cad5d015028cadd4b6541db

2 years agoMerge branch 'stable-5.13' into stable-6.0 67/193767/1
Matthias Sohn [Fri, 27 May 2022 14:20:28 +0000 (16:20 +0200)]
Merge branch 'stable-5.13' into stable-6.0

* stable-5.13:
  Remove stray files (probes or lock files) created by background threads

Change-Id: I7af1355a77f14995118145162f6bb8a4f1755f2b

2 years agoMerge "Add mergetool merge feature (execute external tool)"
Andrey Loskutov [Fri, 27 May 2022 05:02:15 +0000 (01:02 -0400)]
Merge "Add mergetool merge feature (execute external tool)"

2 years agoMerge "Add command line support for "git mergetool""
Andrey Loskutov [Fri, 27 May 2022 04:59:22 +0000 (00:59 -0400)]
Merge "Add command line support for "git mergetool""

2 years agoMerge "Add config reader for user-defined mergetools"
Andrey Loskutov [Fri, 27 May 2022 04:58:42 +0000 (00:58 -0400)]
Merge "Add config reader for user-defined mergetools"

2 years agoMerge "Add difftool compare feature (execute external tool)"
Andrey Loskutov [Fri, 27 May 2022 04:57:51 +0000 (00:57 -0400)]
Merge "Add difftool compare feature (execute external tool)"

2 years agoRemove stray files (probes or lock files) created by background threads 79/193379/2
James Z.M. Gao [Thu, 7 Apr 2022 16:29:39 +0000 (00:29 +0800)]
Remove stray files (probes or lock files) created by background threads

NOTE: port back from master branch.

On process exit, it was possible that the filesystem timestamp
resolution measurement left behind .probe files or even a lock file
for the jgit.config.

Ensure the SAVE_RUNNER is shut down when the process exits (via
System.exit() or otherwise). Move lf.lock() into the try-finally
block when saving the config file.

Delete .probe files on JVM shutdown -- they are created in daemon
threads that may terminate abruptly, not executing the "finally"
clause that normally removes these files.

Bug: 579445
Change-Id: Iaee2301eb14e6201406398a90228ad10cfea6098

2 years agoPrepare 6.2.0-SNAPSHOT builds 35/193735/1
Matthias Sohn [Thu, 26 May 2022 21:24:41 +0000 (23:24 +0200)]
Prepare 6.2.0-SNAPSHOT builds

Change-Id: I9d6afd80cc024d6e03aa46bbaaaeec10b60fb485

2 years agoAvoid warning "no explicit project encoding" 33/193733/1
Michael Keppler [Thu, 26 May 2022 21:17:44 +0000 (23:17 +0200)]
Avoid warning "no explicit project encoding"

Eclipse 2022-06 raises that warning for each project without explicit
encoding. We can avoid the warning by adding explicit project settings
for the otherwise implicit encoding.

There is no functional change, neither for users of Eclipse nor for
users of other IDEs or build tools.

Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Change-Id: I30a6f1369ef09bd445f5730628d01772db2ee7b3

2 years agoJGit v6.2.0.202205251150-m3 36/193636/1 v6.2.0.202205251150-m3
Matthias Sohn [Wed, 25 May 2022 14:49:01 +0000 (16:49 +0200)]
JGit v6.2.0.202205251150-m3

Change-Id: I48492aef02c2ea39cec171d84e92643859e064a6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2 years agoMerge branch 'master' into stable-6.2 35/193635/1
Matthias Sohn [Wed, 25 May 2022 14:47:37 +0000 (16:47 +0200)]
Merge branch 'master' into stable-6.2

* master:
  RewriteGenerator: Fully buffering of input is no longer necessary
  Update Orbit to S20220517184036
  PackFileSnapshot: Resolve warnings by using "equals" instead of "=="
  Remove stray files (probes or lock files) created by background threads

Change-Id: I1522fcd03fb7ef0d7512b5d0b3bc09271e918c48

2 years agoAdd mergetool merge feature (execute external tool) 10/138410/38
Andre Bossert [Fri, 8 Mar 2019 21:31:34 +0000 (22:31 +0100)]
Add mergetool merge feature (execute external tool)

see: https://git-scm.com/docs/git-mergetool

* implement mergetool merge function (execute external tool)
* add ExecutionResult and commandExecutionError to ToolException
* handle "base not present" case (empty or null base file path)
* handle deleted (rm) and modified (add) conflicts
* handle settings
 * keepBackup
 * keepTemporaries
 * writeToTemp

Bug: 356832
Change-Id: Id323c2fcb1c24d12ceb299801df8bac51a6d463f
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
2 years agoAdd command line support for "git mergetool" 03/138003/42
Andre Bossert [Sun, 19 Jan 2020 19:52:56 +0000 (20:52 +0100)]
Add command line support for "git mergetool"

see: https://git-scm.com/docs/git-mergetool
see: https://git-scm.com/docs/git-config

* add command line support for "git mergetool"
  * add option handling for "--tool-help", "--tool=<mytool>",
"--[no-]prompt",  "--[no-]gui"
  * handle prompt
  * add MergeTools
  * add pre-defined mergetools
  * print merge actions --> no execute, will be done later

Bug: 356832
Change-Id: I6e505ffc3d03f75ecf4bba452a25d25dfcf5793f
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
2 years agoAdd config reader for user-defined mergetools 42/137942/40
Andre Bossert [Fri, 8 Mar 2019 20:32:57 +0000 (21:32 +0100)]
Add config reader for user-defined mergetools

see: https://git-scm.com/docs/git-mergetool
see: https://git-scm.com/docs/git-config

* add config reader for user-defined mergetools
  * merge.tool
  * merge.guitool
  * mergetool.prompt
  * mergetool.keepBackup
  * mergetool.keepTemporaries
  * mergetool.writeToTemp
  * mergetool.<tool>.path
  * mergetool.<tool>.cmd
  * mergetool.<tool>.trustExitCode

Bug: 356832
Change-Id: Ic4f07376630713d8e06cbad284d9c72c9ecc0405
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
2 years agoAdd difftool compare feature (execute external tool) 75/137575/44
Andre Bossert [Sun, 19 Jan 2020 19:50:14 +0000 (20:50 +0100)]
Add difftool compare feature (execute external tool)

see: http://git-scm.com/docs/git-difftool

* add CommandExecutor that handles tool execution with help of "jgit.FS"
  * it handles tool execution with temporary created "command file" -->
for for all "command interpreters" and parameters with spaces etc.
  * using of external bash.exe at Windows (MinGW) if shell-script is
used as difftool command. It can be enabled with parameter
"jgit.usemsys2bash=auto" that checks if command contains ".sh" or
enabled / disabled with "jgit.usemsys2bash=true|false"
* added special handling for empty files (e.g. deleted, added etc.) that
are named "/dev/null"
* added creation and deletion of temporary files needed for compare
* added own Exception class for reporting to pgm / command line / EGit
* added prompt option handling before executing difftool
* reworked trustExitCode option for specific difftool and override for
all difftools from config and command line
* tested with command line options "--[no]-trust-exit-code",
"--tool=<toolname>", "--[no]-gui", --[no]-prompt
* ContentSource
  * added close() methods to close / cleanup used resources
(like ObjectReader TreeWalk etc.)
  * added isWorkingTreeSource() methods to check if file can be used
from working tree instead of copy from "ObjectLoader / ObjectReader" to
temporary file (fixes "difftool <commit> <commit>")

Bug: 356832
Change-Id: I5462fb6dbe4ecfd9da7c74117fce4070bbfd4d7a
Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
2 years agoRewriteGenerator: Fully buffering of input is no longer necessary 01/192501/4
Simon Sohrt [Mon, 4 Apr 2022 08:10:19 +0000 (10:10 +0200)]
RewriteGenerator: Fully buffering of input is no longer necessary

Fully buffering by the previous generator of the input for the RewriteGenerator is no longer necessary.

Bug: 577948
Signed-off-by: Simon Sohrt <sohrt@his.de>
Change-Id: I59c7a7c7f3766e97627764608bc8dc733804274c

2 years agoUpdate Orbit to S20220517184036 12/193612/1
Matthias Sohn [Tue, 24 May 2022 22:10:30 +0000 (00:10 +0200)]
Update Orbit to S20220517184036

and
- net.i2p.crypto.eddsa to 0.3.0.v20220506-1020
- org.bouncycastle.bcpg to 1.70.0.v20220507-1208
- org.bouncycastle.bcprov to 1.70.0.v20220507-1208

Change-Id: Ifc450da0a9b469629b7d3a7e4194a2bc8a2a4403

2 years agoPackFileSnapshot: Resolve warnings by using "equals" instead of "==" 40/192040/5
Fabio Ponciroli [Thu, 17 Mar 2022 21:49:22 +0000 (22:49 +0100)]
PackFileSnapshot: Resolve warnings by using "equals" instead of "=="

Errorprone raises the following warning: "[ReferenceEquality] Comparison
using reference equality instead of value equality"

Added Equality#isSameInstance util method to be reused in similar cases.

Change-Id: Ifc9885c9806dcafa1c5ee1351d3095bf1517dbf5

2 years agoRemove stray files (probes or lock files) created by background threads 63/192563/4
James Z.M. Gao [Thu, 7 Apr 2022 16:29:39 +0000 (00:29 +0800)]
Remove stray files (probes or lock files) created by background threads

On process exit, it was possible that the filesystem timestamp
resolution measurement left behind .probe files or even a lock file
for the jgit.config.

Ensure the SAVE_RUNNER is shut down when the process exits (via
System.exit() or otherwise). Move lf.lock() into the try-finally
block when saving the config file.

Delete .probe files on JVM shutdown -- they are created in daemon
threads that may terminate abruptly, not executing the "finally"
clause that normally removes these files.

Bug: 579445
Change-Id: Ie27aca1fdaddfa487ebe072c3913d78355910df8

2 years agoMerge branch 'stable-6.2' 52/193252/1
Matthias Sohn [Mon, 9 May 2022 20:10:13 +0000 (22:10 +0200)]
Merge branch 'stable-6.2'

* stable-6.2:
  HTTP Smart: set correct HTTP status on error

Change-Id: I7bf99b0c720f9dabb65da5cc777281a1d227f5a8

2 years agoMerge branch 'stable-6.1' into stable-6.2 51/193251/1
Matthias Sohn [Mon, 9 May 2022 20:09:05 +0000 (22:09 +0200)]
Merge branch 'stable-6.1' into stable-6.2

* stable-6.1:
  HTTP Smart: set correct HTTP status on error

Change-Id: I792d6cdfe9e76a3d2e6d1e01ec1dc96805ed2900

2 years agoHTTP Smart: set correct HTTP status on error 77/192677/13
Sven Selberg [Tue, 12 Apr 2022 09:36:58 +0000 (11:36 +0200)]
HTTP Smart: set correct HTTP status on error

Previous behavior was that status code was automatically set to 200
regardless of reported status and according to HTTP Smart protocol[1]:

  If there is no repository at $GIT_URL, or the resource pointed to by
  a location matching $GIT_URL does not exist, the server MUST NOT
  respond with 200 OK response. A server SHOULD respond with
  404 Not Found, 410 Gone, or any other suitable HTTP status code which
  does not imply the resource exists as requested.

Since the jgit HTTP client isn't able to handle reading content from a
response reporting an error (calling HttpURLConnection#getInputStream
on a "failed" connection throws an exception and the internal interface
HttpConnection does not expose HttpURLConnection#getErrorStream) the
SmartClientSmartServerTest needed to be rewritten to expect the generic
response messages.

[1] https://git-scm.com/docs/http-protocol#_general_request_processing

Bug: 579676
Change-Id: Ibb942d02124a0bc279df09600b091354019ce064

2 years agoMerge branch 'stable-6.2' 33/193133/1
Matthias Sohn [Thu, 5 May 2022 11:49:22 +0000 (13:49 +0200)]
Merge branch 'stable-6.2'

* stable-6.2:
  Prepare 6.2.0-SNAPSHOT builds
  JGit v6.2.0.202205041315-m2

Change-Id: Ia5180f086ac07fe6fa0e68d233ddb963010945b6

2 years agoPrepare 6.2.0-SNAPSHOT builds 32/193132/1
Matthias Sohn [Thu, 5 May 2022 11:39:09 +0000 (13:39 +0200)]
Prepare 6.2.0-SNAPSHOT builds

Change-Id: Ic3788b38d6408e83729caa718c128a5632798a60

2 years agoJGit v6.2.0.202205041315-m2 18/193118/1 v6.2.0.202205041315-m2
Matthias Sohn [Wed, 4 May 2022 17:25:04 +0000 (19:25 +0200)]
JGit v6.2.0.202205041315-m2

Change-Id: Ie13beac020e79182a4058ba67550bb78b2008833
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2 years agoUpdate list of 3rd party dependencies 97/193097/1
Matthias Sohn [Tue, 3 May 2022 21:09:22 +0000 (23:09 +0200)]
Update list of 3rd party dependencies

Change-Id: I4f8f8ede8b4c788ce2b4db174df4cc1d35350542

2 years agoAdd target platforms for eclipse 4.23 (2022-03) and 4.24 (2022-06) 63/193063/2
Matthias Sohn [Mon, 2 May 2022 21:12:13 +0000 (23:12 +0200)]
Add target platforms for eclipse 4.23 (2022-03) and 4.24 (2022-06)

Change-Id: I6481a0e6e989b8ceefeecced0d7d8609a24d0c9f

2 years agoUpdate Orbit to I20220502200629 62/193062/1
Matthias Sohn [Mon, 2 May 2022 20:59:51 +0000 (22:59 +0200)]
Update Orbit to I20220502200629

and
- com.jcraft.jzlib to 1.1.3.v20220502-1820

Change-Id: I7694f1b793f598c3adb96b5223a5f7b5783a35ec

2 years ago[sshd] Better user feedback on authentication failure 33/192433/2
Thomas Wolf [Fri, 1 Apr 2022 14:56:05 +0000 (16:56 +0200)]
[sshd] Better user feedback on authentication failure

When authentication fails, JGit produces an exception with an error
message telling the user that it could not log in (including the host
name). The causal chain has an SshException from Apache MINA sshd with
message "No more authentication methods available".

This is not very helpful. The user was left without any indication why
authentication failed.

Include in the exception message a log of all attempted authentications.
That way, the user can see which keys were tried, in which order and
with which signature algorithms. The log also reports authentication
attempts for gssapi-with-mic or password authentication. For
keyboard-interactive Apache MINA sshd is lacking a callback interface.

The way Apache MINA sshd loads keys from files, the file names are lost
in higher layers. Add a mechanism to record on the session for each
key fingerprint the file it was loaded from, if any. That way the
exception message can refer to keys by file name, which is easier to
understand by users than the rather cryptic key fingerprints.

Bug: 571390
Change-Id: Ic4b6ce6b99f307d5e798fcc91b16b9ffd995d224
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoLazy loading of .lfsconfig. 55/192455/3
Matthias Fromme [Mon, 4 Apr 2022 04:45:22 +0000 (06:45 +0200)]
Lazy loading of .lfsconfig.

Load the '.lfsconfig ' on access instead of trying to load it
unconditionally each time an LFS filter is applied.

Bug 578020
Change-Id: I986d4e61a736fc83cf00e62a08d8413c6bb53f78

2 years ago[releng] bump japicmp base version 84/192884/1
Thomas Wolf [Mon, 25 Apr 2022 05:56:52 +0000 (07:56 +0200)]
[releng] bump japicmp base version

Bump the japicmp base version to 6.1.0.202203080745-r.

Change-Id: I54a9ae339fbe2a3a02f438f794caa22c8cbcd02c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoRefSpec: add missing @since 83/192883/1
Thomas Wolf [Mon, 25 Apr 2022 05:45:55 +0000 (07:45 +0200)]
RefSpec: add missing @since

New API needs an @since 6.2 annotation.

Change-Id: I16b01ea820cc651605166acc13591b515541d06b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoDe-couple ServiceLoader calls from class loading 51/192451/2
Thomas Wolf [Sun, 3 Apr 2022 19:06:57 +0000 (21:06 +0200)]
De-couple ServiceLoader calls from class loading

Use the holder pattern to de-couple the loading of super classes from
the ServiceLoader calls to set up global instances. This prevents
potential lock inversions.

Bug: 579550
Change-Id: Ie8284e4d6d680ddd4cc6a486bbefe8ed00266240
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoCommitCommand: call GpgSigner.getDefault() only if indeed signing 50/192450/2
Thomas Wolf [Sun, 3 Apr 2022 18:33:37 +0000 (20:33 +0200)]
CommitCommand: call GpgSigner.getDefault() only if indeed signing

If we're not signing the commit, we don't need the GpgSigner at all.

Change-Id: Ica35651c73d82b7604c8a67487b0d9474c908aae
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoGpgSigner: prevent class lock inversion on the default signer 49/192449/2
Thomas Wolf [Sun, 3 Apr 2022 18:11:29 +0000 (20:11 +0200)]
GpgSigner: prevent class lock inversion on the default signer

Don't store the default signer in a static field of the abstract
superclass GpgSigner. This many lead to a lock inversion on the class
initialization locks if there are concurrent loads of the GpgSigner
class and of one of its subclasses, and that subclass happens to be
the one the ServiceLoader wants to load.

Use the holder pattern to de-couple the loading of class GpgSigner
from the ServiceLoader call.

Bug: 579550
Change-Id: Ifac0ea0c8985a09fe0518d0dabc072fafd6db907
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoFetch: Introduce negative refspecs. 96/192296/23
yunjieli [Mon, 28 Mar 2022 21:47:02 +0000 (14:47 -0700)]
Fetch: Introduce negative refspecs.

Implement negative refspecs in JGit fetch, following C Git. Git
supports negative refspecs in source only while this change supports
them in both source and destination.

If one branch is equal to any branch or matches any pattern in the
negative refspecs collection, the branch will not be fetched even if
it's in the toFetch collection.

With this feature, users can express more complex patterns during fetch.

Change-Id: Iaa1cd4de5c08c273e198b72e12e3dadae7be709f
Sign-off-by: Yunjie Li<yunjieli@google.com>
2 years agoMerge "Add GetRefsBenchmark for testing refs lookups"
Han-Wen NIenhuys [Tue, 5 Apr 2022 11:33:51 +0000 (07:33 -0400)]
Merge "Add GetRefsBenchmark for testing refs lookups"

2 years agoBaseSearch: Suppress ReferenceEquality Warnings 49/191749/5
Fabio Ponciroli [Thu, 10 Mar 2022 19:07:57 +0000 (20:07 +0100)]
BaseSearch: Suppress ReferenceEquality Warnings

Errorprone raises the following warning:
"[ReferenceEquality] Comparison using reference equality
instead of value equality"

Change-Id: Ib7542506dcdf5a0c7775a99a2c0972930d622879

2 years agoRewriteGenerator: Suppress ReferenceEquality Warnings 47/191747/5
Fabio Ponciroli [Thu, 10 Mar 2022 18:58:14 +0000 (19:58 +0100)]
RewriteGenerator: Suppress ReferenceEquality Warnings

Errorprone raises the following warning:
"[ReferenceEquality] Comparison using reference equality
instead of value equality"

Change-Id: Idfe3f044730019fb49dccee25a0563c6fc01fc6a

2 years agoPlotCommit: Suppress ReferenceEquality Warnings 64/191764/5
Fabio Ponciroli [Fri, 11 Mar 2022 09:03:30 +0000 (10:03 +0100)]
PlotCommit: Suppress ReferenceEquality Warnings

Errorprone raises the following warning:
"[ReferenceEquality] Comparison using reference equality
instead of value equality"

Change-Id: Ia0dc2df68c77e40ff509a2c39568abce92525ee9

2 years agoPlotCommitList: Suppress ReferenceEquality Warnings 34/191734/7
Fabio Ponciroli [Thu, 10 Mar 2022 16:37:37 +0000 (17:37 +0100)]
PlotCommitList: Suppress ReferenceEquality Warnings

Errorprone raises the following warning:
"[ReferenceEquality] Comparison using reference equality
instead of value equality"

A single pointer comparison is fine here.
A comparison with 'equals' would complicate the code and
also impact performance.

Change-Id: I6677dfc483acb95a64afbf433fd2b9460e408264

2 years agoAdd GetRefsBenchmark for testing refs lookups 83/185683/17
Luca Milanesio [Tue, 21 Sep 2021 23:38:24 +0000 (00:38 +0100)]
Add GetRefsBenchmark for testing refs lookups

Introduce a new benchmark that shows a typical use-case
of opening a cached repository and fetching one ref from
a repository with a high number of refs.

This specific benchmark is tailored to the Gerrit use-case
of reading frequently individual refs SHA1s and by ref-name
prefix from the All-Users repository.

Include the following variables for the benchmark:
- numBranches (from 100 up to 50000)
- trustFolderStat (true or false)
- useRefTable (true or false)

The benchmark needs to be evaluated on a local high-perf SSD
and on a slower NFS network disk.

Bug: 576165
Change-Id: Ie59a87ca9f0191ff30229688e3430332e2f59a4f

2 years ago[pgm tests] Relax version constraints for hamcrest 01/192201/2
Matthias Sohn [Wed, 16 Mar 2022 15:32:06 +0000 (16:32 +0100)]
[pgm tests] Relax version constraints for hamcrest

We updated hamcrest to 2.2. but there is no need to prevent that
older versions of hamcrest can be used. Hence relax the lower bound
to 1.1 like in other bundles.

Change-Id: I3f2f270d2aabc7d742a585d2fc7f0bce283e2a64

2 years agoUse git config core.commentChar 64/192064/2
Thomas Wolf [Sun, 23 Jan 2022 14:43:24 +0000 (15:43 +0100)]
Use git config core.commentChar

This concerns committing, creating merge conflict messages and creating
and editing squash messages. In a squash message, once the comment
character has been determined initially is always the first character.
Note that if core.commentChar=auto and there is a sequence of squashes,
it may be necessary to change the comment character when a new message
is added.

Bug: 579325
Change-Id: Idca19284a0240cd322e7512ea299a03658e1b2c1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoCommitConfig: add support for core.commentChar 63/192063/2
Thomas Wolf [Sat, 22 Jan 2022 16:00:32 +0000 (17:00 +0100)]
CommitConfig: add support for core.commentChar

Provide  access to the core.commentChar git config, and provide a
utility method to determine an unused comment character if the setting
is "auto".

Bug: 579325
Change-Id: I1ec7e4deffea6ac5929a8538a624d73bb59e4ecc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years ago[push, lfs] Tell the pre-push hook whether the push is a dry run 30/191930/3
Thomas Wolf [Sun, 20 Feb 2022 23:20:52 +0000 (00:20 +0100)]
[push, lfs] Tell the pre-push hook whether the push is a dry run

This is a feature that does not exist in C git: an external pre-push
hook doesn't know whether the push is run as a dry run. But for
internal hooks written in Java it is entirely possible to give a hook
this information.

In JGit with its internal LFS implementation, this enables us to not
perform LFS uploads in a dry run. This is kind of important because
EGit frequently does a dry-run before doing the actual push to give the
user a way to review what would be pushed before it actually happens.

Doing an LFS upload of potentially huge files during a dry-run is
wasteful, makes the dry run not actually a dry run, and leads to
uploading the same file twice if followed by a real push.

Use the information in the LfsPrePushHook to only do the initial call
to the LFS server, but then skipping the actual upload if the push is
a dry run. That way, a failure to contact the LFS server leads to an
error in the dry run, as it should.

Bug: 546567
Change-Id: I155430f27c4979d91096ba72fd95c3775dd3f28b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoMerge changes I5df54a92,Iecc61d1c
Matthias Sohn [Tue, 22 Mar 2022 16:15:33 +0000 (12:15 -0400)]
Merge changes I5df54a92,Iecc61d1c

* changes:
  LsRemoteCommand: apply url.*.insteadOf
  Factor out URL replacement from RemoteConfig

2 years agoLFS: clean up messages 31/191931/2
Thomas Wolf [Tue, 15 Mar 2022 21:29:05 +0000 (22:29 +0100)]
LFS: clean up messages

Remove an unused message, and remove unnecessary quotes.

Change-Id: I9da3eeb3db33324fa07bebd434bca3c0a4da27ab
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoDirCacheCheckout: use a LinkedHashMap instead of HashMap 32/191932/2
Thomas Wolf [Tue, 15 Mar 2022 21:48:48 +0000 (22:48 +0100)]
DirCacheCheckout: use a LinkedHashMap instead of HashMap

This guarantees that updates are checked out in git order, which
is important for LFS if a .lfsconfig file is used. That file comes
early in git order, and the LFS smudge filter will consider the
working tree version. To ensure that on branch switches the correct
version of that file is used, the checkout order must be stable and
should be the git order.

Change-Id: I20f6d11bf08558f9d5adfd2be71e36321460038c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2 years agoRe-try reading a file when there are concurrent writes 24/191924/4
Thomas Wolf [Tue, 15 Mar 2022 18:12:46 +0000 (19:12 +0100)]
Re-try reading a file when there are concurrent writes

Git and JGit are very careful to replace git files atomically when
writing. The normal mechanism for this is to write to a temporary
file and then to rename it atomically to the final destination. This
works fine on POSIX-compliant systems, but on systems where renaming
may not be atomic, exceptions may be thrown if code tries to read
the file while the rename is still ongoing. This happens in particular
on Windows, where the typical symptom is that a FileNotFoundException
with message "The process cannot access the file because it is being
used by another process" is thrown, but file.isFile() == true at the
same time.

In FileBasedConfig, a re-try was already implemented for this case.
But the same problem can also occur in other places, for instance
in RefDirectory when reading loose or packed refs. Additionally,
JGit has similar re-tries when a stale NFS file handle is detected,
but that mechanism wasn't used consistently (only for git configs
and packed refs, but not for loose refs).

Factor out the general re-try mechanism for reading into a new method
FileUtils.readWithRetry() and use that in all three places. The
re-try parameters are hardcoded: at most 5 times for stale NFS handles,
and at most 5 times with increasing backoff delays (50, 100, 200, 400,
and 800ms) for the above concurrent write case.

Bug: 579116
Change-Id: If0c2ad367446d3c0f32b509274cf8e814aca12cf
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>