Several problems:
* The command didn't specify whether it expected short or full names.
* For the new name, it expected a short name, but then got confused
if tags or both local and remote branches with the same name existed.
* For the old name, it accepted either a short or a full name, but
again got confused if a short name was given and a tag with the
same name existed.
With such an interface, one cannot use Repository.findRef() to
reliably find the branch to rename. Use exactRef() for the new
name as by the time the Ref is needed its full name is known.
For determining the old Ref from the name, do the resolution
explicitly: first try exactRef (assuming the old name is a full
name); if that doesn't find anything, try "refs/heads/<old>" and
"refs/remotes/<old>" explicitly. Throw an exception if the name
is ambiguous, or if exactRef returned something that is not a
branch (refs/tags/... or also refs/notes/...).
Document in the javadoc what kind of names are valid, and add tests.
A user can still shoot himself in the foot if he chooses exceptionally
stupid branch names. For instance, it is still possible to rename a
branch to "refs/heads/foo" (full name "refs/heads/refs/heads/foo"),
but it cannot be renamed further using the new short name if a branch
with the full name "refs/heads/foo" exists. Similar edge cases exist
for other dumb branch names, like a branch with the short name
"refs/tags/foo". Renaming using the full name is always possible.
Bug: 542446
Change-Id: I34ac91c80c0a00c79a384d16ce1e727c550d54e9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Provide a mechanism for a subclass to provide its own set
of default identities from anywhere as an Iterable<KeyPair>.
The default implementation is functionally unchanged and uses
the known default identity files in the ~/.ssh directory. A subclass
can override the getDefaultKeys() function and return whatever keys
are appropriate.
Bug: 543152
Change-Id: I500d63146bc67e20e051f617790eb87c7cb500b6
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
The new API is intended for UIs to check if signing will be possible or
would fail
Bug: 543579
Change-Id: I6ce1fd4210e46d49dcdf420c99d08c93e022136c
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
BundleFetchConnection.readLine() must abort on EOF, otherwise
it gets stuck in an endless loop.
Bug: 543390
Change-Id: I4cb3428560277888af114b928950d620bb6564f9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I37e6e3aaba411858042afac02098ce9eaa06f258
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Ife1d8e88387a32de63b0ef31f45499babdbdde3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I16b528fad74d0c5346d054b3c29070331d60db7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I662a343fbb46c35090bd6f840e5a35a88036a65a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: If18a5d8013f1cb393af3a5e5a1ec9613ac2151bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I1c6cc5ecdc44b81e5f3f9b7dc64c3653de5475ba
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I55c15a35369e790a3ca946d6db0097a57ac6fae5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Iae510d8c6af9acd587822a28ad48eab0b2a96ccd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I70dce366081cd1fc4539cf195d6310fef1080eb3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I1a636478bfae8cc0635a3e57be252126e69c19cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Ie1985c2570213217c2ea0f376ff99d19bfed4e0c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Id25eb523c12c07cbd14e31edfb8b5d7ec9b3ccf3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I9cecd236a8df8a2c2972d5da6031a121f25b1daa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Since 52923e9 ("LocalDiskRepositoryTestCase#createRepository: Default
auto-close to false", Jan 20, 2019) the createBareRepository method
creates repositories that do not get automatically closed in #tearDown.
Convert invocations of createBareRepository to use try-with-resource.
Change-Id: I320030c5d4438713971bee33316bff408bac47fc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Except the cases where the warning was suppressed in bf757cd because
they are explicitly testing functionality that is not possible in t-w-r.
Change-Id: I6c66eb31a2314028e09a9213dc695cd163f907e9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
The tests were written for Java 7 which did not have AutoCloseable
and the try-with-resource concept. When the project was updated to
build with Java 8, the warnings were suppressed.
Remove the suppressions and convert to use try-with-resource.
Change-Id: Ic805bd571c4a2e4376ce5e7c34ca7ac86cbf5104
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Instead of using the literal string, take the name from the RECURSIVE
enum value.
Change-Id: I9d8f289232dfc8f784287029c41714ddbdee232b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I7a5dc6b1ebaad6f7b8baa35ce68760b79bab8acd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I5f198f71adfbb43ec1af26285658a5d5bdfa1904
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I7afd038d8def9d2f409c0ed297b9db8ea2fc75c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Ib3ae59eeb90143eca1a0b515c59457a0eb2cc383
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: If7dd168f3e8d2b729f1eab48d4e95fe837bb7a33
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: I7d71e194f0a7e4180094a9b36dbb55dd90c9722e
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Ibca80cf2195db01298f2b95f507cfa3de2f403e7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.
Change-Id: Ib8b26a6a02903de63ef58687a4a0820649d59f99
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>