[PATCH 2/7] http-push: allow stderr messages to appear alongside helper_status ones
- From
Tay Ray Chuan <rctay89@gmail.com>
- Date
- Oct 25, 2009, 15:19 UTC
- Message-ID
- <20091025231932.be9a6dfa.rctay89@gmail.com>
- In-Reply-To
- <20091025231651.18c75559.rctay89@gmail.com>
These messages notifies user over pushing progress (or the lack thereof). It is safe for them to appear alongside status reports ('ok|error <dst>'), since the reports go to stdout, while the notifications go to stderr.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> --- http-push.c | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/http-push.c b/http-push.c index 24eec73..b97ea1f 100644 --- a/http-push.c +++ b/http-push.c @@ -1946,10 +1946,9 @@ 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; } else if (helper_status) @@ -1980,15 +1979,14 @@ 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; } @@ -2011,11 +2009,10 @@ 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; } -- 1.6.4.4