Commit Graph

6559 Commits

Author SHA1 Message Date
Ivan Frade e64ce267f8 RepoCommand: Preserve executable bit in <copyfile>
The copyfile entry in the manifest file copies the contents of the file
but doesn't keep the executable flag. This is inconsistent with repo
tool behaviour, plus is natural to expect that the copy of a executable
file is executable.

Transfer the executable bit when copying the file, aligning the
RepoCommand with repo tool and user expectations.

Change-Id: I01b24f482d5939e01d496f032388b3a5c02a912a
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-31 16:40:12 -07:00
Ivan Frade f648a3bd81 RepoCommand.RemoteReader: Add method to read contents and mode of file
The RepoCommand.RemoteReader interface doesn't offer access to the mode
of a file. Caller can only default to mark the copied objects as regular
files, losing e.g. the executable bit (if set).

Add a new method readFileWithMode that returns the contents and mode of
the remote file. It supersedes the readFile method, that is marked as
deprecated.

Now callers can set correctly the file mode of the copied file.

Change-Id: I8fce01e4bc5707434c0cbc4aebbae1b6b64756f0
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-31 16:40:06 -07:00
Matthias Sohn de37eb3a9d Update 2018-12 Orbit repository to S20181031145145
Add the following new bundles needed for new ssh implementation:
- net.i2p.crypto.eddsa 0.3.0
- net.i2p.crypto.eddsa.source 0.3.0
- org.apache.sshd.core 2.0.0
- org.apache.sshd.core.source 2.0.0
- org.apache.sshd.sftp 2.0.0
- org.apache.sshd.sftp.source 2.0.0

Change-Id: I336166dd71522cc382df2e3efc00e7126d2c0874
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-31 22:48:45 +01:00
Ivan Frade 17dbaa4fdd RepoCommandTest: Extract method to assert file contents
Many tests verify the contents of files in a try-with-resources
incantation that clutters the code.

Extract that verification to an "assertContents" method, that is easier
to read.

Change-Id: If430eac6f5b9ae352e42b2d43867ceb6cd618fbb
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-30 13:08:16 -07:00
David Pursehouse d0f44d4396 Merge changes Ice585525,I73474dea
* changes:
  Update staging target platform for eclipse platform 4.10
  New target platform for 4.9
2018-10-29 23:21:07 -04:00
Matthias Sohn a91e934d05 Update staging target platform for eclipse platform 4.10
Change-Id: Ice585525209e20e7d675f24cb751315e18eb375d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-30 00:29:19 +01:00
Matthias Sohn 7c03521f1a New target platform for 4.9
Change-Id: I73474deaecda4e594e5604213d3ae30c499a2ca7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-30 00:29:15 +01:00
David Pursehouse a98a6044cf CLIText: Fix typo: remotes's -> remote's
Change-Id: I28494ffff6cd8042ef5f3de7da976d4a1569fe10
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-29 17:02:41 +09:00
David Pursehouse 9185ad8d5c CLIText: Fix typo: 'amd' -> 'and'
Change-Id: Ifa48c35f413bd1a92946ea54c1c7adc0d53ebc78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-29 16:56:04 +09:00
Matthias Sohn 6f359c1709 Silence API errors for new methods added to DepthWalk
237abe6a added method getDeepenNots() with a default implementation and
method getDeepenNotFlag() to the interface DepthWalk. This affects
implementers which is ok in minor release following OSGi semantic
versioning.

Change-Id: I1c872da261fc6825e1e310127761b8b8a6d397d4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-29 00:43:48 +01:00
Matthias Sohn 06bce43338 Remove unused text "symlinkCannotBeWrittenAsTheLinkTarget"
The only reference to this externalized text was deleted in c88d34b0.

Change-Id: Iecc7cc89192d69431dddb6550a02f66f0b09accc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-28 14:43:38 +01:00
Michael Keppler d9e67c8d8f Fix typos
s/occured/occurred/
s/stablished/established/

Change-Id: Ib052bef60bd18043001a30ed43754ee1a5182016
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-28 14:41:22 +01:00
Matthias Sohn f9a142939d Update eclipse compiler org.eclipse.jdt:ecj to 3.15.0
Change-Id: Iabca86db71e166e6ce73db2f8ddc5058e58da11a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-28 01:50:46 +02:00
Marc Strapetz aaf71bfbcc gitignore/gitattributes: fix matching of \r
Patterns should treat \r in file names as normal characters

Change-Id: Ica3e0fa4a58acf5326db46bb28571fe5f20f6cd2
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
2018-10-27 04:24:05 -04:00
David Pursehouse bcf7eb02c2 Upgrade maven-pmd-plugin to 3.11.0
Change-Id: I145272faa1f4cdead4706d71299ce6a0b27902cf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-26 18:47:26 +09:00
Dave Borowitz 0e5cc09afe Merge "InternalPushConnection: don't swallow RuntimeException" 2018-10-25 10:35:43 -04:00
Ivan Frade 6e3c9347bc Add test for protocol v0 parser
ProtocolV2Parser has unit tests but protocol v0/v1 is not covered.

Change-Id: I96022e8f8eb60d4da748d1042474fd1efd67e882
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-24 14:54:43 -07:00
Ivan Frade d40835a801 ObjectIdMatcher: Custom matcher for sets of ObjectIds
Parsed requests represent object ids (SHA1) in ObjectId instances but tests
use strings for those ids because they are easier to define.

Create a custom matcher that hides the conversion from string to
ObjectId. Note that this reverses the existing code conversion (it was
transforming ObjectIds into string).

This produces more readable code, consistent with the other hamcrest
assertions.

Change-Id: I47ba1d25557d791fe74fb93c740ff7de9923cc00
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-24 14:54:23 -07:00
Jonathan Tan 237abe6ab5 UploadPack: Implement deepen-not for protocol v2
This allows clients to use the --shallow-exclude parameter (producing a
"deepen-not <ref>" line when communicating with the server) in their fetch
commands when fetching against a JGit server using protocol v2.

Note that the implementation in this commit is somewhat inefficient, as
described in the TODO comment in DepthGenerator.

Change-Id: I9fad3ed9276b624d8f668356ffd99a067dc67ef7
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-10-23 17:13:09 -07:00
Jonathan Tan f5fa1eaf39 Throw error when deepen-since excludes all commits
In C Git, when a client fetches with "git fetch --shallow-since=<date>
origin <ref>", and all commits reachable from <ref> are older than
<date>, the server dies with a message "no commits selected for shallow
requests". That is, (1) the --shallow-since filter applies to the commit
pointed to by the ref itself, and (2) there is a check that at least one
commit is not filtered out. (The pack-protocol.txt documentation does
not describe this, but the C implementation does this.)

The implementation in commit 1bb430dc21 ("UploadPack: support
deepen-since in protocol v2", 2018-09-27) does neither (1) nor (2), so
do both of these.

Change-Id: I9946327a71627626ecce34ca2d017d2add8867fc
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2018-10-23 11:10:07 -07:00
Jonathan Nieder a579a56e3a Merge changes from topic 'moving-to-request-2'
* changes:
  UploadPack v0: Extract "agent" client capability at parse time
  UploadPack: Return correct peer user agent on v2 requests
2018-10-22 13:49:38 -04:00
Ivan Frade 94a3d8bae9 UploadPack v0: Extract "agent" client capability at parse time
The request receives a list of capabilities and takes out the "agent" to
offer it on its own setter (getAgent).

Do this at parse time: when reading the line if the capability is
"agent" set it directly in the builder.

This makes the treatment of "agent" consistent in v0/v1 and v2.

Change-Id: Ie4f9f2cad8639adeeaef4921df49a30a8ce5b42f
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-22 10:23:15 -07:00
Markus Keller 8420c729a0 Make PrePushHook properly terminate ref lines
All of the input lines passed to pre-push hook scripts must be properly
terminated by '\n', so that normal shell scripts like the git-supplied
pre-push.sample work properly, even when pushing just a single branch.

With the old code, hook scripts that use the following pattern didn't
process the last line, because 'read' has a non-zero exit status when
EOF is encountered:
  while read local_ref local_sha remote_ref remote_sha; do ... done

Change-Id: Id899662ed3fedef6c314fc4b2ddf91a6dcb98cbb
Signed-off-by: Markus Keller <markus.kell.r@gmail.com>
2018-10-21 17:07:58 -04:00
David Pursehouse e4fdc571c9 RemoteRefUpdate#toString: Fix indentation
Change-Id: Ide2a7e914ab0ff50cf34ff5bc6df3219efe4ba96
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-21 20:05:56 +09:00
Michael Keppler f2db2a1f65 [releng] Fix boxing warning
Use Integer.valueOf() to avoid the warning by implicit conversion due to
usage as argument object in String.format().

Change-Id: Ib314f629d54ae1ce9729c3837d66ce8982a1898a
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-10-20 15:20:51 +02:00
Ned Twigg d056a54384 CheckoutCommand: force flag now allows overwrite
Before this commit, a force checkout would fail if there
were any conflicting files. After this commit, a force
checkout will overwrite the conflicting files, as expected.

Making this work required fixing a bug in DirCacheCheckout.
Before this commit, when DirCacheCheckout had
failOnConflict=false, it would delete all conflicting files
from the working copy and just leave them missing. After
this commit, DirCacheCheckout overwrites conflicting files
with the merge tree.

This change in DirCacheCheckout causes "reset --hard" and
"revert --abort" to behave as expected (previously they
would simply delete conflicting files, now they will be
overwritten from the merge tree).

Change-Id: If7e328ee792ef6511ab7d9c26d8d77c39210ec9f
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
2018-10-20 06:53:23 -04:00
David Pursehouse 36432ac4e3 Merge branch 'stable-5.1'
* stable-5.1:
  Prepare 5.1.4-SNAPSHOT builds
  JGit v5.1.3.201810200350-r
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ic8b2189fdd8403294327a17cc0c1f6a6e2f78cb8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-20 18:06:27 +09:00
Matthias Sohn b65e247568 Prepare 5.1.4-SNAPSHOT builds
Change-Id: Iee86860f3b4eb9f4af818c60342fd29465c0474c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 10:39:16 +02:00
Matthias Sohn cf24983b23 JGit v5.1.3.201810200350-r
Change-Id: Ib2c5a79d4fdf77680b7b65652fc3659527df27ad
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 09:50:16 +02:00
David Pursehouse 8fc3903989 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:

All commits from stable-5.0 are already in stable-5.1 due to an
accidental merge of stable-4.11 into stable-5.1 by I3ec3c9af4.

Change-Id: I8a89d103be2b2cb7657e82a124e7db41239a2447
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-20 14:47:49 +09:00
David Pursehouse 4728a32699 Merge "Merge branch 'stable-4.11' into stable-5.0" into stable-5.1 2018-10-20 01:39:43 -04:00
David Pursehouse f40a5a12e4 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ib6493d2b6270fe4f237ea52d97848239c16c1d9d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-20 14:29:12 +09:00
Matthias Sohn 647ad2f0f2 Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.6-SNAPSHOT builds
  JGit v4.11.5.201810191925-r
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I3ec3c9af49b11979a551a9749d5a8ba5ef2ef726
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 02:12:24 +02:00
Matthias Sohn 9b6d30f2c1 Prepare 4.11.6-SNAPSHOT builds
Change-Id: Ic823775aad59530f516602e7e848474d65763314
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 02:08:35 +02:00
Ivan Frade 8d4f8d55d3 UploadPack: Return correct peer user agent on v2 requests
UploadPack.getPeerUserAgent() doesn't produce the expected results for
protocol v2 requests. In v2, the agent reported in the request (in an
"agent=" line) is not in the clientCapabilities but in a field on its
own. This makes getPeerUserAgent default to the transport user agent.

Making "agent" a shared property between protocol v0/v1 and v2 fixes the
problem, simplifies the function and harmonizes the implementation
between protocol versions.

In a follow up commit the "agent" will be identified on parsing time,
instead of taking it from the client capabilities.

Change-Id: Idf9825ec4e0b81a1458c8e3701f3e28aafd8a32a
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 16:55:56 -07:00
Matthias Sohn 92aca6195d JGit v4.11.5.201810191925-r
Change-Id: I9d11536062de74775ca545c26f341610d0ddaeb2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:27:52 +02:00
Matthias Sohn 976a8e369d Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I5698fde41417c4ce9e813c683c84978f303b76fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 01:23:27 +02:00
Matthias Sohn 019f1b2d4c Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  Prepare 4.9.8-SNAPSHOT builds
  JGit v4.9.7.201810191756-r
  Update API problem filter
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I6f07ea02491ba3a32f30ee2408e1153241cc8a07
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:16:21 +02:00
Matthias Sohn 7ae004509c Prepare 4.9.8-SNAPSHOT builds
Change-Id: Iab7b0f2a21a76f801a83fbeb54f09d1525878f4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20 00:10:02 +02:00
Matthias Sohn 97534056fc JGit v4.9.7.201810191756-r
Change-Id: Ib980731eb9ec7f4c92deac9b4cf2f7a994d670c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:58:47 +02:00
Matthias Sohn 97b62cf9dd Update API problem filter
Change-Id: Iba8650900d3936edccbe30de9d3eafd4f9e0dba6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:54:38 +02:00
Matthias Sohn cee3ef1a0e Merge branch 'stable-4.8' into stable-4.9
* stable-4.8:
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: Ic18af2ddcba8f7a53eb27a33ea9f637adb941993
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 23:30:20 +02:00
Ivan Frade 40f5b28545 Accept protocol v2 server options on fetch and ls-refs requests
In protocol v2, a command request can be followed by server options
(lines like "agent=<>" and "server-option=<>"), but current code
doesn't accept those lines.

Advertise the "server-option" capability, parse the lines and add
them to the request objects.

Other code in JGit can see this options and act accordingly via the
protocol v2 hooks.

This should not require any change in the client side.

Change-Id: If3946390f9cc02d29644b6ca52534b6f757bda9f
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 14:04:02 -07:00
Matthias Sohn 566a5dcc21 Merge branch 'stable-4.7' into stable-4.8
* stable-4.7:
  Prepare 4.7.7-SNAPSHOT builds
  JGit v4.7.6.201810191618-r
  Update API problem filter
  Fix file handle leak in ObjectDownloadListener.onWritePossible
  Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
  Replace FindBugs with SpotBugs
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I783a083c0092a400f28f7977fbc4e556af88c8de
2018-10-19 22:36:31 +02:00
Matthias Sohn d6c587faef Prepare 4.7.7-SNAPSHOT builds
Change-Id: I131e40cbbf32bc75d2ed24ca31ba3613a3bbca25
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:27:47 +02:00
Matthias Sohn b811e4fc51 JGit v4.7.6.201810191618-r
Change-Id: Iaee27d5e2de016240f1a0940653fef82c6044a1d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:18:38 +02:00
Matthias Sohn 2674bec32b Update API problem filter
Change-Id: I66c0c490bb66adafac5d670d2d9571f1674a281e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-19 22:15:39 +02:00
Ivan Frade 0691c4b94b UploadPack: Use request instead of field for client capabilities
Change-Id: Idc21e2b3fd145d2a4b15c1cea5ec1956541e3b40
Signed-off-by: Ivan Frade <ifrade@google.com>
2018-10-19 11:01:28 -07:00
David Pursehouse ffaada75e4 Merge branch 'stable-4.6' into stable-4.7
* stable-4.6:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I3e1a870a225447e761368298ce9b65dbec2c2a82
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 18:43:49 +09:00
David Pursehouse 926a126f72 Merge branch 'stable-4.5' into stable-4.6
* stable-4.5:
  Prepare 4.4.2-SNAPSHOT builds
  JGit v4.0.3.201509231615-r

Change-Id: I9c925a65d42559443ade9ac8291ffe00f4a1dda1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2018-10-19 18:43:09 +09:00