summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 20e8b46)
raw | patch | inline | side by side (parent: 20e8b46)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Fri, 8 Jan 2010 02:12:43 +0000 (10:12 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 Jan 2010 07:34:10 +0000 (23:34 -0800) |
Use push_had_errors() to check the refs for errors and modify the
return value.
Mark the non-fast-forward push tests to succeed.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
return value.
Mark the non-fast-forward push tests to succeed.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5541-http-push.sh | patch | blob | history | |
transport.c | patch | blob | history |
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index 6d92196d24a5553b746618b8f5e24ef2ac36096d..979624d0dc7a2973919b55ba6fe462dde34f3952 100755 (executable)
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
test_cmp exp act
'
-test_expect_failure 'non-fast-forward push fails' '
+test_expect_success 'non-fast-forward push fails' '
cd "$ROOT_PATH"/test_repo_clone &&
git checkout master &&
echo "changed" > path2 &&
grep "^ ! \[rejected\][ ]*master -> master (non-fast-forward)$" output
'
-test_expect_failure 'non-fast-forward push shows help message' '
+test_expect_success 'non-fast-forward push shows help message' '
grep \
"To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
diff --git a/transport.c b/transport.c
index 12c4423f79f251a93675af7cadfc3bd1f38c6967..9b23989117da9d538b8221b02963bbcd17784d6c 100644 (file)
--- a/transport.c
+++ b/transport.c
int verbose = flags & TRANSPORT_PUSH_VERBOSE;
int quiet = flags & TRANSPORT_PUSH_QUIET;
int porcelain = flags & TRANSPORT_PUSH_PORCELAIN;
- int ret;
+ int ret, err;
if (flags & TRANSPORT_PUSH_ALL)
match_flags |= MATCH_REFS_ALL;
flags & TRANSPORT_PUSH_FORCE);
ret = transport->push_refs(transport, remote_refs, flags);
+ err = push_had_errors(remote_refs);
- if (!quiet || push_had_errors(remote_refs))
+ ret |= err;
+
+ if (!quiet || err)
print_push_status(transport->url, remote_refs,
verbose | porcelain, porcelain,
nonfastforward);