Merge branch 'jk/push-force-with-lease-creation'
"git push --force-with-lease" already had enough logic to allow ensuring that such a push results in creation of a ref (i.e. the receiving end did not have another push from sideways that would be discarded by our force-pushing), but didn't expose this possibility to the users. It does so now. * jk/push-force-with-lease-creation: t5533: make it pass on case-sensitive filesystems push: allow pushing new branches with --force-with-lease push: add shorthand for --force-with-lease branch creation Documentation/git-push: fix placeholder formatting
This commit is contained in:
9
remote.c
9
remote.c
@ -1544,8 +1544,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
|
||||
* branch.
|
||||
*/
|
||||
if (ref->expect_old_sha1) {
|
||||
if (ref->expect_old_no_trackback ||
|
||||
oidcmp(&ref->old_oid, &ref->old_oid_expect))
|
||||
if (oidcmp(&ref->old_oid, &ref->old_oid_expect))
|
||||
reject_reason = REF_STATUS_REJECT_STALE;
|
||||
else
|
||||
/* If the ref isn't stale then force the update. */
|
||||
@ -2294,6 +2293,8 @@ int parse_push_cas_option(struct push_cas_option *cas, const char *arg, int unse
|
||||
entry = add_cas_entry(cas, arg, colon - arg);
|
||||
if (!*colon)
|
||||
entry->use_tracking = 1;
|
||||
else if (!colon[1])
|
||||
hashclr(entry->expect);
|
||||
else if (get_sha1(colon + 1, entry->expect))
|
||||
return error("cannot parse expected object name '%s'", colon + 1);
|
||||
return 0;
|
||||
@ -2343,7 +2344,7 @@ static void apply_cas(struct push_cas_option *cas,
|
||||
if (!entry->use_tracking)
|
||||
hashcpy(ref->old_oid_expect.hash, cas->entry[i].expect);
|
||||
else if (remote_tracking(remote, ref->name, &ref->old_oid_expect))
|
||||
ref->expect_old_no_trackback = 1;
|
||||
oidclr(&ref->old_oid_expect);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2353,7 +2354,7 @@ static void apply_cas(struct push_cas_option *cas,
|
||||
|
||||
ref->expect_old_sha1 = 1;
|
||||
if (remote_tracking(remote, ref->name, &ref->old_oid_expect))
|
||||
ref->expect_old_no_trackback = 1;
|
||||
oidclr(&ref->old_oid_expect);
|
||||
}
|
||||
|
||||
void apply_push_cas(struct push_cas_option *cas,
|
||||
|
Reference in New Issue
Block a user