/*
- * Copyright (C) 2017, Markus Duft <markus.duft@ssi-schaefer.com> and others
+ * Copyright (C) 2017, 2022 Markus Duft <markus.duft@ssi-schaefer.com> and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
}
HttpConnection api = LfsConnectionFactory.getLfsConnection(
getRepository(), METHOD_POST, OPERATION_UPLOAD);
- Map<String, LfsPointer> oid2ptr = requestBatchUpload(api, toPush);
- uploadContents(api, oid2ptr);
+ if (!isDryRun()) {
+ Map<String, LfsPointer> oid2ptr = requestBatchUpload(api, toPush);
+ uploadContents(api, oid2ptr);
+ }
return EMPTY;
}
/*
- * Copyright (C) 2015 Obeo. and others
+ * Copyright (C) 2015, 2022 Obeo and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
private String refs;
+ private boolean dryRun;
+
/**
* Constructor for PrePushHook
* <p>
remoteLocation = location;
}
+ /**
+ * Sets whether the push is a dry run.
+ *
+ * @param dryRun
+ * {@code true} if the push is a dry run, {@code false} otherwise
+ * @since 6.2
+ */
+ public void setDryRun(boolean dryRun) {
+ this.dryRun = dryRun;
+ }
+
+ /**
+ * Tells whether the push is a dry run.
+ *
+ * @return {@code true} if the push is a dry run, {@code false} otherwise
+ * @since 6.2
+ */
+ protected boolean isDryRun() {
+ return dryRun;
+ }
+
/**
* Set Refs
*
/*
- * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com> and others
+ * Copyright (C) 2008, 2022 Marek Zawirski <marek.zawirski@gmail.com> and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
if (prePush != null) {
try {
prePush.setRefs(willBeAttempted);
+ prePush.setDryRun(transport.isDryRun());
prePush.call();
} catch (AbortedByHookException | IOException e) {
throw new TransportException(e.getMessage(), e);