reflog-expire: brown paper bag fix.
When --stale-fix is not passed, the code did not initialize the two commit objects properly. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
ba70de01bb
commit
9bbaa6cc68
@ -173,7 +173,6 @@ static int keep_entry(struct commit **it, unsigned char *sha1)
|
|||||||
{
|
{
|
||||||
struct commit *commit;
|
struct commit *commit;
|
||||||
|
|
||||||
*it = NULL;
|
|
||||||
if (is_null_sha1(sha1))
|
if (is_null_sha1(sha1))
|
||||||
return 1;
|
return 1;
|
||||||
commit = lookup_commit_reference_gently(sha1, 1);
|
commit = lookup_commit_reference_gently(sha1, 1);
|
||||||
@ -204,15 +203,22 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
|
|||||||
if (timestamp < cb->cmd->expire_total)
|
if (timestamp < cb->cmd->expire_total)
|
||||||
goto prune;
|
goto prune;
|
||||||
|
|
||||||
|
old = new = NULL;
|
||||||
if (cb->cmd->stalefix &&
|
if (cb->cmd->stalefix &&
|
||||||
(!keep_entry(&old, osha1) || !keep_entry(&new, nsha1)))
|
(!keep_entry(&old, osha1) || !keep_entry(&new, nsha1)))
|
||||||
goto prune;
|
goto prune;
|
||||||
|
|
||||||
if ((timestamp < cb->cmd->expire_unreachable) &&
|
if (timestamp < cb->cmd->expire_unreachable) {
|
||||||
(!cb->ref_commit ||
|
if (!cb->ref_commit)
|
||||||
(old && !in_merge_bases(old, cb->ref_commit)) ||
|
|
||||||
(new && !in_merge_bases(new, cb->ref_commit))))
|
|
||||||
goto prune;
|
goto prune;
|
||||||
|
if (!old && !is_null_sha1(osha1))
|
||||||
|
old = lookup_commit_reference_gently(osha1, 1);
|
||||||
|
if (!new && !is_null_sha1(nsha1))
|
||||||
|
new = lookup_commit_reference_gently(nsha1, 1);
|
||||||
|
if ((old && !in_merge_bases(old, cb->ref_commit)) ||
|
||||||
|
(new && !in_merge_bases(new, cb->ref_commit)))
|
||||||
|
goto prune;
|
||||||
|
}
|
||||||
|
|
||||||
if (cb->newlog) {
|
if (cb->newlog) {
|
||||||
char sign = (tz < 0) ? '-' : '+';
|
char sign = (tz < 0) ? '-' : '+';
|
||||||
|
Loading…
Reference in New Issue
Block a user