git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tay Ray Chuan <rctay89@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org, Daniel Barkalow <barkalow@iabervon.org>,
	Mike Hommey <mh@glandium.org>
Subject: Re: [RFC PATCH v3 10/17] Move WebDAV HTTP push under remote-curl
Date: Mon, 19 Oct 2009 10:59:21 +0800	[thread overview]
Message-ID: <20091019105921.d58c2728.rctay89@gmail.com> (raw)
In-Reply-To: <1255577814-14745-11-git-send-email-spearce@spearce.org>

Hi,

On Thu, Oct 15, 2009 at 11:36 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
> diff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt
> @@ -34,6 +34,10 @@ Commands are given by the caller on the helper's standard input, one per line.
>        value of the ref. A space-separated list of attributes follows
>        the name; unrecognized attributes are ignored. After the
>        complete list, outputs a blank line.
> ++
> +If 'push' is supported this may be called as 'list for-push'
> +to obtain the current refs prior to sending one or more 'push'
> +commands to the helper.

The new paragraph should have the same indentation as 'list'.

It would have been great if you implemented this as a filter, such that
'list <attr>' lists the refs with the specified attribute <attr>,
rather than hardcoding it.

> @@ -59,6 +63,22 @@ suitably updated.
> +When the push is complete, outputs one or more 'ok <dst>' or
> +'error <dst> <why>?' lines to indicate success or failure of
> +each pushed ref.  The status report output is terminated by
> +a blank line.  The option field <why> may be quoted in a C
> +style string if it contains an LF.

You should mention that this behaviour only occurs when the
--helper-status option is used.

> @@ -106,6 +132,11 @@ OPTIONS
> +'option dry-run' \{'true'|'false'\}:
> +       If true, pretend like the operation completed successfully,
> +       but don't actually change any repository data.  For most
> +       helpers this only applies to the 'push', if supported.
> +

The 'like' after 'pretend' can be, like, removed. :)

> diff --git a/http-push.c b/http-push.c
> @@ -1941,9 +1946,14 @@ int main(int argc, char **argv)
>
>                if (is_null_sha1(ref->peer_ref->new_sha1)) {
>                        if (delete_remote_branch(ref->name, 1) == -1) {
> -                               error("Could not remove %s", ref->name);
> +                               if (helper_status)
> +                                       printf("error %s cannot remove\n", ref->name);
> +                               else
> +                                       error("Could not remove %s", ref->name);
>                                rc = -4;
>                        }

I think error() calls should be left intact (as indicators to the
user), even when --helper-status is specified. It wouldn't affect
transport-helper.c's parsing of '(ok|error) <ref>' lines, since it
reads stdout only.

In other words, the above would read:

>                                error("Could not remove %s", ref->name);
> +                               if (helper_status)
> +                                       printf("error %s cannot remove\n", ref->name);
>                                rc = -4;
>                        }

> @@ -1968,12 +1980,15 @@ int main(int argc, char **argv)
>                                 * commits at the remote end and likely
>                                 * we were not up to date to begin with.
>                                 */
> -                               error("remote '%s' is not an ancestor of\n"
> -                                     "local '%s'.\n"
> -                                     "Maybe you are not up-to-date and "
> -                                     "need to pull first?",
> -                                     ref->name,
> -                                     ref->peer_ref->name);
> +                               if (helper_status)
> +                                       printf("error %s non-fast forward\n", ref->name);
> +                               else
> +                                       error("remote '%s' is not an ancestor of\n"
> +                                                 "local '%s'.\n"
> +                                                 "Maybe you are not up-to-date and "
> +                                                 "need to pull first?",
> +                                                 ref->name,
> +                                                 ref->peer_ref->name);
>                                rc = -2;
>                                continue;
>                        }

Same here.

> @@ -1987,14 +2002,20 @@ int main(int argc, char **argv)
>                /* Lock remote branch ref */
>                ref_lock = lock_remote(ref->name, LOCK_TIME);
>                if (ref_lock == NULL) {
> -                       fprintf(stderr, "Unable to lock remote branch %s\n",
> -                               ref->name);
> +                       if (helper_status)
> +                               printf("error %s lock error\n", ref->name);
> +                       else
> +                               fprintf(stderr, "Unable to lock remote branch %s\n",
> +                                       ref->name);
>                        rc = 1;
>                        continue;
>                }

Same here.

Two more areas in http-push.c that should have status messages
(generated on top of pu):

(I'm not sure what ref should read when there's no match, but
transport-helper.c should have no problems parsing it with 'null'.)

-->8--

diff --git a/http-push.c b/http-push.c
index 9010ccc..e979feb 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1916,9 +1916,12 @@ int main(int argc, char **argv)

 	/* Remove a remote branch if -d or -D was specified */
 	if (delete_branch) {
-		if (delete_remote_branch(refspec[0], force_delete) == -1)
+		if (delete_remote_branch(refspec[0], force_delete) == -1) {
 			fprintf(stderr, "Unable to delete remote branch %s\n",
 				refspec[0]);
+			if (helper_status)
+				printf("error %s cannot remove\n", refspec[0]);
+		}
 		goto cleanup;
 	}

@@ -1930,6 +1933,8 @@ int main(int argc, char **argv)
 	}
 	if (!remote_refs) {
 		fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
+		if (helper_status)
+			printf("error null no match\n");
 		rc = 0;
 		goto cleanup;
 	}

--
Cheers,
Ray Chuan

  reply	other threads:[~2009-10-19  2:59 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15  3:36 [RFC PATCH v3 00/17] Return of smart HTTP Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 01/17] pkt-line: Add strbuf based functions Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 02/17] pkt-line: Make packet_read_line easier to debug Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 03/17] fetch-pack: Use a strbuf to compose the want list Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 04/17] Move "get_ack()" back to fetch-pack Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 05/17] Add multi_ack_detailed capability to fetch-pack/upload-pack Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 06/17] remote-curl: Refactor walker initialization Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 07/17] fetch: Allow transport -v -v -v to set verbosity to 3 Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 08/17] remote-helpers: Fetch more than one ref in a batch Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 09/17] remote-helpers: Support custom transport options Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 10/17] Move WebDAV HTTP push under remote-curl Shawn O. Pearce
2009-10-19  2:59   ` Tay Ray Chuan [this message]
2009-10-28  1:08     ` Shawn O. Pearce
2009-10-28 11:01       ` Tay Ray Chuan
2009-10-25 15:19   ` [PATCH 2/7] http-push: allow stderr messages to appear alongside helper_status ones Tay Ray Chuan
2009-10-15  3:36 ` [RFC PATCH v3 11/17] Git-aware CGI to provide dumb HTTP transport Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 12/17] Add stateless RPC options to upload-pack, receive-pack Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 13/17] Smart fetch and push over HTTP: server side Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 14/17] Discover refs via smart HTTP server when available Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 15/17] Smart push over HTTP: client side Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 16/17] Smart fetch " Shawn O. Pearce
2009-10-15  3:36 ` [RFC PATCH v3 17/17] Smart HTTP fetch: gzip requests Shawn O. Pearce
2009-10-15  7:39 ` [RFC PATCH v3 00/17] Return of smart HTTP Junio C Hamano
2009-10-15  9:52   ` Nanako Shiraishi
2009-10-15 14:33     ` Shawn O. Pearce
2009-10-15 15:21       ` Johan Herland
2009-10-15 15:41         ` Shawn O. Pearce
2009-10-15 20:27           ` Junio C Hamano
2009-10-15 20:45             ` Shawn O. Pearce
2009-10-22 10:21               ` Nanako Shiraishi
2009-10-22 14:46                 ` Daniel Barkalow
2009-10-27  4:55               ` [PATCH] Fix memory leak in transport-helper Daniel Barkalow
2009-10-27 14:11                 ` Johannes Schindelin
2009-10-27 17:37                   ` Daniel Barkalow
2009-10-27 18:31                     ` Jeff King
2009-10-27 18:54                     ` Johannes Schindelin
2009-10-27 19:05                       ` Daniel Barkalow
2009-10-28  7:18                         ` Junio C Hamano
2009-10-16  4:20 ` [RFC PATCH v3 00/17] Return of smart HTTP Mark Lodato
2009-10-16 14:31   ` Shawn O. Pearce
2009-10-16 23:04     ` Mark Lodato
2009-10-16 23:16       ` Shawn O. Pearce
2009-10-22 19:48       ` Marcus Camen
2009-10-25 15:16 ` [PATCH 0/6] http: push and test fixes Tay Ray Chuan
2009-10-25 15:18   ` [PATCH 1/7] http-push: fix check condition on http.c::finish_http_pack_request() Tay Ray Chuan
2009-10-25 15:20   ` [PATCH 3/7] http-push: add more 'error <dst> <why>' status reports Tay Ray Chuan
2009-10-25 15:21   ` [PATCH 4/7] t5540-http-push: expect success when pushing without arguments Tay Ray Chuan
2009-10-25 16:16     ` Clemens Buchacher
2009-10-25 15:22   ` [PATCH 5/7] t5540-http-push: check existence of fetched files Tay Ray Chuan
2009-10-25 16:49     ` Clemens Buchacher
2009-10-25 15:23   ` [PATCH 6/7] t5540-http-push: when deleting remote refs, don't need to branch -d -r Tay Ray Chuan
2009-10-25 15:24   ` [PATCH 7/7] t5540-http-push: remove redundant fetches Tay Ray Chuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091019105921.d58c2728.rctay89@gmail.com \
    --to=rctay89@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=mh@glandium.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).