Merge branch 'ps/remote-rename-fix'
"git remote rename origin upstream" failed to move origin/HEAD to upstream/HEAD when origin/HEAD is unborn and performed other renames extremely inefficiently, which has been corrected. * ps/remote-rename-fix: builtin/remote: only iterate through refs that are to be renamed builtin/remote: rework how remote refs get renamed builtin/remote: determine whether refs need renaming early on builtin/remote: fix sign comparison warnings refs: simplify logic when migrating reflog entries refs: pass refname when invoking reflog entry callback
This commit is contained in:
@@ -277,7 +277,8 @@ struct debug_reflog {
|
||||
void *cb_data;
|
||||
};
|
||||
|
||||
static int debug_print_reflog_ent(struct object_id *old_oid,
|
||||
static int debug_print_reflog_ent(const char *refname,
|
||||
struct object_id *old_oid,
|
||||
struct object_id *new_oid,
|
||||
const char *committer, timestamp_t timestamp,
|
||||
int tz, const char *msg, void *cb_data)
|
||||
@@ -292,7 +293,7 @@ static int debug_print_reflog_ent(struct object_id *old_oid,
|
||||
if (new_oid)
|
||||
oid_to_hex_r(n, new_oid);
|
||||
|
||||
ret = dbg->fn(old_oid, new_oid, committer, timestamp, tz, msg,
|
||||
ret = dbg->fn(refname, old_oid, new_oid, committer, timestamp, tz, msg,
|
||||
dbg->cb_data);
|
||||
trace_printf_key(&trace_refs,
|
||||
"reflog_ent %s (ret %d): %s -> %s, %s %ld \"%.*s\"\n",
|
||||
|
||||
@@ -2115,7 +2115,9 @@ static int files_delete_reflog(struct ref_store *ref_store,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int show_one_reflog_ent(struct files_ref_store *refs, struct strbuf *sb,
|
||||
static int show_one_reflog_ent(struct files_ref_store *refs,
|
||||
const char *refname,
|
||||
struct strbuf *sb,
|
||||
each_reflog_ent_fn fn, void *cb_data)
|
||||
{
|
||||
struct object_id ooid, noid;
|
||||
@@ -2142,7 +2144,7 @@ static int show_one_reflog_ent(struct files_ref_store *refs, struct strbuf *sb,
|
||||
message += 6;
|
||||
else
|
||||
message += 7;
|
||||
return fn(&ooid, &noid, p, timestamp, tz, message, cb_data);
|
||||
return fn(refname, &ooid, &noid, p, timestamp, tz, message, cb_data);
|
||||
}
|
||||
|
||||
static char *find_beginning_of_line(char *bob, char *scan)
|
||||
@@ -2226,7 +2228,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
|
||||
strbuf_splice(&sb, 0, 0, bp + 1, endp - (bp + 1));
|
||||
scanp = bp;
|
||||
endp = bp + 1;
|
||||
ret = show_one_reflog_ent(refs, &sb, fn, cb_data);
|
||||
ret = show_one_reflog_ent(refs, refname, &sb, fn, cb_data);
|
||||
strbuf_reset(&sb);
|
||||
if (ret)
|
||||
break;
|
||||
@@ -2238,7 +2240,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
|
||||
* Process it, and we can end the loop.
|
||||
*/
|
||||
strbuf_splice(&sb, 0, 0, buf, endp - buf);
|
||||
ret = show_one_reflog_ent(refs, &sb, fn, cb_data);
|
||||
ret = show_one_reflog_ent(refs, refname, &sb, fn, cb_data);
|
||||
strbuf_reset(&sb);
|
||||
break;
|
||||
}
|
||||
@@ -2288,7 +2290,7 @@ static int files_for_each_reflog_ent(struct ref_store *ref_store,
|
||||
return -1;
|
||||
|
||||
while (!ret && !strbuf_getwholeline(&sb, logfp, '\n'))
|
||||
ret = show_one_reflog_ent(refs, &sb, fn, cb_data);
|
||||
ret = show_one_reflog_ent(refs, refname, &sb, fn, cb_data);
|
||||
fclose(logfp);
|
||||
strbuf_release(&sb);
|
||||
return ret;
|
||||
@@ -3360,7 +3362,8 @@ struct expire_reflog_cb {
|
||||
dry_run:1;
|
||||
};
|
||||
|
||||
static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
|
||||
static int expire_reflog_ent(const char *refname UNUSED,
|
||||
struct object_id *ooid, struct object_id *noid,
|
||||
const char *email, timestamp_t timestamp, int tz,
|
||||
const char *message, void *cb_data)
|
||||
{
|
||||
|
||||
@@ -2155,7 +2155,7 @@ static int yield_log_record(struct reftable_ref_store *refs,
|
||||
|
||||
full_committer = fmt_ident(log->value.update.name, log->value.update.email,
|
||||
WANT_COMMITTER_IDENT, NULL, IDENT_NO_DATE);
|
||||
return fn(&old_oid, &new_oid, full_committer,
|
||||
return fn(log->refname, &old_oid, &new_oid, full_committer,
|
||||
log->value.update.time, log->value.update.tz_offset,
|
||||
log->value.update.message, cb_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user