summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee020f3)
raw | patch | inline | side by side (parent: ee020f3)
author | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Oct 2007 04:35:22 +0000 (00:35 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Oct 2007 04:36:35 +0000 (00:36 -0400) |
If the end-user requested a dry-run push we need to pass that flag
over to http-push and additionally make sure it does not actually
upload any changes to the remote server.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
over to http-push and additionally make sure it does not actually
upload any changes to the remote server.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Documentation/git-http-push.txt | patch | blob | history | |
http-push.c | patch | blob | history | |
transport.c | patch | blob | history |
index 9afb860381369767a0a3f5295f588b75f559ff22..3a69b719b5cdddc9f48cdbfefe358783e12f396d 100644 (file)
SYNOPSIS
--------
-'git-http-push' [--all] [--force] [--verbose] <url> <ref> [<ref>...]
+'git-http-push' [--all] [--dry-run] [--force] [--verbose] <url> <ref> [<ref>...]
DESCRIPTION
-----------
the remote repository can lose commits; use it with
care.
+--dry-run::
+ Do everything except actually send the updates.
+
--verbose::
Report the list of objects being walked locally and the
list of objects successfully sent to the remote repository.
diff --git a/http-push.c b/http-push.c
index a035919764ae4eb020dbeba9f1f7126a0c66e3be..c02a3af63450fd7cf22118b481b4f0d9dd35b156 100644 (file)
--- a/http-push.c
+++ b/http-push.c
#include <expat.h>
static const char http_push_usage[] =
-"git-http-push [--all] [--force] [--verbose] <remote> [<head>...]\n";
+"git-http-push [--all] [--dry-run] [--force] [--verbose] <remote> [<head>...]\n";
#ifndef XML_STATUS_OK
enum XML_Status {
static int push_verbosely;
static int push_all;
static int force_all;
+static int dry_run;
static struct object_list *objects;
force_all = 1;
continue;
}
+ if (!strcmp(arg, "--dry-run")) {
+ dry_run = 1;
+ continue;
+ }
if (!strcmp(arg, "--verbose")) {
push_verbosely = 1;
continue;
if (strcmp(ref->name, ref->peer_ref->name))
fprintf(stderr, " using '%s'", ref->peer_ref->name);
fprintf(stderr, "\n from %s\n to %s\n", old_hex, new_hex);
-
+ if (dry_run)
+ continue;
/* Lock remote branch ref */
ref_lock = lock_remote(ref->name, LOCK_TIME);
if (remote->has_info_refs && new_refs) {
if (info_ref_lock && remote->can_update_info_refs) {
fprintf(stderr, "Updating remote server info\n");
- update_remote_info_refs(info_ref_lock);
+ if (!dry_run)
+ update_remote_info_refs(info_ref_lock);
} else {
fprintf(stderr, "Unable to update server info\n");
}
diff --git a/transport.c b/transport.c
index f34d19750f97ede55d316d82ce82fd263bc47734..400af71c76d8cf699778f98b1b07ea7f719701a3 100644 (file)
--- a/transport.c
+++ b/transport.c
@@ -392,6 +392,8 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
argv[argc++] = "--all";
if (flags & TRANSPORT_PUSH_FORCE)
argv[argc++] = "--force";
+ if (flags & TRANSPORT_PUSH_DRY_RUN)
+ argv[argc++] = "--dry-run";
argv[argc++] = transport->url;
while (refspec_nr--)
argv[argc++] = *refspec++;