reset: add test cases for "--keep" option
[gitweb.git] / transport.c
index 8cc287d4429212c385b1359943ba41deb8a0460d..7714fdb6c6578c711dc0b98a2086669a6a797257 100644 (file)
@@ -191,7 +191,7 @@ static const char *rsync_url(const char *url)
 static struct ref *get_refs_via_rsync(struct transport *transport, int for_push)
 {
        struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
-       struct ref dummy, *tail = &dummy;
+       struct ref dummy = {0}, *tail = &dummy;
        struct child_process rsync;
        const char *args[5];
        int temp_dir_len;
@@ -526,7 +526,7 @@ static int fetch_refs_via_pack(struct transport *transport,
        args.include_tag = data->options.followtags;
        args.verbose = (transport->verbose > 0);
        args.quiet = (transport->verbose < 0);
-       args.no_progress = args.quiet || (!transport->progress && !isatty(1));
+       args.no_progress = args.quiet || (!transport->progress && !isatty(2));
        args.depth = data->options.depth;
 
        for (i = 0; i < nr_heads; i++)
@@ -1036,7 +1036,7 @@ int transport_push(struct transport *transport,
                int quiet = flags & TRANSPORT_PUSH_QUIET;
                int porcelain = flags & TRANSPORT_PUSH_PORCELAIN;
                int pretend = flags & TRANSPORT_PUSH_DRY_RUN;
-               int ret;
+               int ret, err;
 
                if (flags & TRANSPORT_PUSH_ALL)
                        match_flags |= MATCH_REFS_ALL;
@@ -1048,9 +1048,16 @@ int transport_push(struct transport *transport,
                        return -1;
                }
 
+               set_ref_status_for_push(remote_refs,
+                       flags & TRANSPORT_PUSH_MIRROR,
+                       flags & TRANSPORT_PUSH_FORCE);
+
                ret = transport->push_refs(transport, remote_refs, flags);
+               err = push_had_errors(remote_refs);
+
+               ret |= err;
 
-               if (!quiet || push_had_errors(remote_refs))
+               if (!quiet || err)
                        print_push_status(transport->url, remote_refs,
                                        verbose | porcelain, porcelain,
                                        nonfastforward);