Merge branch 'stable-4.9'

* stable-4.9:
  Fix NPE in TransportGitSsh.ExtSession.exec()
  Add missing help text for rev-parse's --verify option
  Remove final modifier on args4j argument field in RevParse

Change-Id: I5ac9e2f185f2210ee76970501710b99b12e93e75
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2017-11-20 15:38:43 +09:00
commit 3efea067a3
3 changed files with 16 additions and 9 deletions

View File

@ -265,6 +265,9 @@ usage_RepositoryToReceiveInto=Repository to receive into
usage_RevList=List commit objects in reverse chronological order
usage_RevParse=Pick out and massage parameters
usage_RevParseAll=Show all refs found in refs/
usage_RevParseVerify=Verify that exactly one parameter is provided, and that it can be turned into \
a raw 20-byte SHA-1 that can be used to access the object database. If so, emit it to the standard \
output; otherwise, error out.
usage_S3Bucket=S3 bucket name
usage_S3Expiration=Authorization validity in seconds, default 60 sec
usage_S3Region=S3 region (us-east-1 | us-west-1 | us-west-2 | eu-west-1 |\

View File

@ -68,7 +68,7 @@ class RevParse extends TextBuiltin {
boolean verify;
@Argument(index = 0, metaVar = "metaVar_commitish")
private final List<ObjectId> commits = new ArrayList<>();
private List<ObjectId> commits = new ArrayList<>();
@Override
protected void run() throws Exception {

View File

@ -242,14 +242,7 @@ public Process exec(String command, int timeout)
args.add(getURI().getHost());
args.add(command);
ProcessBuilder pb = new ProcessBuilder();
pb.command(args);
File directory = local.getDirectory();
if (directory != null)
pb.environment().put(Constants.GIT_DIR_KEY,
directory.getPath());
ProcessBuilder pb = createProcess(args);
try {
return pb.start();
} catch (IOException err) {
@ -257,6 +250,17 @@ public Process exec(String command, int timeout)
}
}
private ProcessBuilder createProcess(List<String> args) {
ProcessBuilder pb = new ProcessBuilder();
pb.command(args);
File directory = local != null ? local.getDirectory() : null;
if (directory != null) {
pb.environment().put(Constants.GIT_DIR_KEY,
directory.getPath());
}
return pb;
}
@Override
public void disconnect() {
// Nothing to do