diff options
author | Junio C Hamano <junkio@cox.net> | 2007-01-11 19:56:43 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-11 19:56:43 -0800 |
commit | 9bbaa6cc6848b68b8bef681c2a22b57bbec3e914 (patch) | |
tree | 2d0fff564be28c9f0ea85e6b6c3797c4c5faea33 /builtin-reflog.c | |
parent | ba70de01bb0c8a08135b63ace183bd3f4b149d9e (diff) | |
download | git-9bbaa6cc6848b68b8bef681c2a22b57bbec3e914.tar.gz |
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>
Diffstat (limited to 'builtin-reflog.c')
-rw-r--r-- | builtin-reflog.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/builtin-reflog.c b/builtin-reflog.c index ca22452e64..7206b7a013 100644 --- a/builtin-reflog.c +++ b/builtin-reflog.c @@ -173,7 +173,6 @@ static int keep_entry(struct commit **it, unsigned char *sha1) { struct commit *commit; - *it = NULL; if (is_null_sha1(sha1)) return 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) goto prune; + old = new = NULL; if (cb->cmd->stalefix && (!keep_entry(&old, osha1) || !keep_entry(&new, nsha1))) goto prune; - if ((timestamp < cb->cmd->expire_unreachable) && - (!cb->ref_commit || - (old && !in_merge_bases(old, cb->ref_commit)) || - (new && !in_merge_bases(new, cb->ref_commit)))) - goto prune; + if (timestamp < cb->cmd->expire_unreachable) { + if (!cb->ref_commit) + 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) { char sign = (tz < 0) ? '-' : '+'; |