summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-07-06 22:09:17 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-07-06 22:09:17 -0700
commit67d99b82de27e98bfec7d174ef4b6369d5b85d7a (patch)
tree862766ca5a1a3dde7b68f1492b4a533bbfef126d
parentMerge branch 'js/pu-to-seen' (diff)
parenthttp-push: ensure unforced pushes fail when data would be lost (diff)
downloadtgif-67d99b82de27e98bfec7d174ef4b6369d5b85d7a.tar.xz
Merge branch 'bc/http-push-flagsfix'
The code to push changes over "dumb" HTTP had a bad interaction with the commit reachability code due to incorrect allocation of object flag bits, which has been corrected. * bc/http-push-flagsfix: http-push: ensure unforced pushes fail when data would be lost
-rw-r--r--http-push.c8
-rw-r--r--object.h2
-rwxr-xr-xt/t5540-http-push-webdav.sh16
3 files changed, 21 insertions, 5 deletions
diff --git a/http-push.c b/http-push.c
index ac7868ffee..1ff1883cdd 100644
--- a/http-push.c
+++ b/http-push.c
@@ -70,10 +70,10 @@ enum XML_Status {
#define LOCK_REFRESH 30
/* Remember to update object flag allocation in object.h */
-#define LOCAL (1u<<16)
-#define REMOTE (1u<<17)
-#define FETCHING (1u<<18)
-#define PUSHING (1u<<19)
+#define LOCAL (1u<<11)
+#define REMOTE (1u<<12)
+#define FETCHING (1u<<13)
+#define PUSHING (1u<<14)
/* We allow "recursive" symbolic refs. Only within reason, though */
#define MAXDEPTH 5
diff --git a/object.h b/object.h
index 532d7d7f28..1bcf4f3be8 100644
--- a/object.h
+++ b/object.h
@@ -66,7 +66,7 @@ struct object_array {
* builtin/blame.c: 12-13
* bisect.c: 16
* bundle.c: 16
- * http-push.c: 16-----19
+ * http-push.c: 11-----14
* commit-graph.c: 15
* commit-reach.c: 16-----19
* sha1-name.c: 20
diff --git a/t/t5540-http-push-webdav.sh b/t/t5540-http-push-webdav.sh
index d476c33509..450321fddb 100755
--- a/t/t5540-http-push-webdav.sh
+++ b/t/t5540-http-push-webdav.sh
@@ -126,6 +126,22 @@ test_expect_success 'create and delete remote branch' '
test_must_fail git show-ref --verify refs/remotes/origin/dev
'
+test_expect_success 'non-force push fails if not up to date' '
+ git init --bare "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_conflict.git &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_conflict.git update-server-info &&
+ git clone $HTTPD_URL/dumb/test_repo_conflict.git "$ROOT_PATH"/c1 &&
+ git clone $HTTPD_URL/dumb/test_repo_conflict.git "$ROOT_PATH"/c2 &&
+ test_commit -C "$ROOT_PATH/c1" path1 &&
+ git -C "$ROOT_PATH/c1" push origin HEAD &&
+ git -C "$ROOT_PATH/c2" pull &&
+ test_commit -C "$ROOT_PATH/c1" path2 &&
+ git -C "$ROOT_PATH/c1" push origin HEAD &&
+ test_commit -C "$ROOT_PATH/c2" path3 &&
+ git -C "$ROOT_PATH/c1" log --graph --all &&
+ git -C "$ROOT_PATH/c2" log --graph --all &&
+ test_must_fail git -C "$ROOT_PATH/c2" push origin HEAD
+'
+
test_expect_success 'MKCOL sends directory names with trailing slashes' '
! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log