Thread (8 messages) 8 messages, 1 author, 2016-06-15

[PATCH 7/7] push: clarify rejection of update to non-commit-ish

flat view
DORMANTno replies SUPERSEDED

From: Chris Rorvick <hidden>
Date: 2016-06-15 22:55:23
Subsystem: the rest · Maintainer: Linus Torvalds

Status: Superseded by v6 (posted 2016-06-15). [go to v6]

Revision v5 (2 revisions archived).

Revisions (2)
  1. v5 current
  2. v6 [diff against previous]
Pushes must already (by default) update to a commit-ish due the fast-
forward check in set_ref_status_for_push().  But rejecting for not being
a fast-forward suggests the situation can be resolved with a merge.
Flag these updates (i.e., to a blob or a tree) as not forwardable so the
user is presented with more appropriate advice.

Signed-off-by: Chris Rorvick <redacted>
---
 remote.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/remote.c b/remote.c
index f5bc4e7..ee0c1e5 100644
--- a/remote.c
+++ b/remote.c
@@ -1291,6 +1291,11 @@ static inline int is_forwardable(struct ref* ref)
 	if (!o || o->type != OBJ_COMMIT)
 		return 0;
 
+	/* new object must be commit-ish */
+	o = deref_tag(parse_object(ref->new_sha1), NULL, 0);
+	if (!o || o->type != OBJ_COMMIT)
+		return 0;
+
 	return 1;
 }
 
-- 
1.8.0.209.gf3828dc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help