зеркало из https://github.com/microsoft/git.git
reflog: honor gc.reflogexpire=never
Previously, if gc.reflogexpire or gc.reflogexpire were set to "never" or "false", the builtin default values were used instead. Signed-off-by: Adam Simpkins <simpkins@facebook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
cbf731ed4e
Коммит
4a9f439415
|
@ -530,16 +530,14 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
|
||||||
int i, status, do_all;
|
int i, status, do_all;
|
||||||
int explicit_expiry = 0;
|
int explicit_expiry = 0;
|
||||||
|
|
||||||
|
default_reflog_expire_unreachable = now - 30 * 24 * 3600;
|
||||||
|
default_reflog_expire = now - 90 * 24 * 3600;
|
||||||
git_config(reflog_expire_config, NULL);
|
git_config(reflog_expire_config, NULL);
|
||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
do_all = status = 0;
|
do_all = status = 0;
|
||||||
memset(&cb, 0, sizeof(cb));
|
memset(&cb, 0, sizeof(cb));
|
||||||
|
|
||||||
if (!default_reflog_expire_unreachable)
|
|
||||||
default_reflog_expire_unreachable = now - 30 * 24 * 3600;
|
|
||||||
if (!default_reflog_expire)
|
|
||||||
default_reflog_expire = now - 90 * 24 * 3600;
|
|
||||||
cb.expire_total = default_reflog_expire;
|
cb.expire_total = default_reflog_expire;
|
||||||
cb.expire_unreachable = default_reflog_expire_unreachable;
|
cb.expire_unreachable = default_reflog_expire_unreachable;
|
||||||
|
|
||||||
|
|
|
@ -214,4 +214,45 @@ test_expect_success 'delete' '
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'rewind2' '
|
||||||
|
|
||||||
|
test_tick && git reset --hard HEAD~2 &&
|
||||||
|
loglen=$(wc -l <.git/logs/refs/heads/master) &&
|
||||||
|
test $loglen = 4
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success '--expire=never' '
|
||||||
|
|
||||||
|
git reflog expire --verbose \
|
||||||
|
--expire=never \
|
||||||
|
--expire-unreachable=never \
|
||||||
|
--all &&
|
||||||
|
loglen=$(wc -l <.git/logs/refs/heads/master) &&
|
||||||
|
test $loglen = 4
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'gc.reflogexpire=never' '
|
||||||
|
|
||||||
|
git config gc.reflogexpire never &&
|
||||||
|
git config gc.reflogexpireunreachable never &&
|
||||||
|
git reflog expire --verbose --all &&
|
||||||
|
loglen=$(wc -l <.git/logs/refs/heads/master) &&
|
||||||
|
test $loglen = 4
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'gc.reflogexpire=false' '
|
||||||
|
|
||||||
|
git config gc.reflogexpire false &&
|
||||||
|
git config gc.reflogexpireunreachable false &&
|
||||||
|
git reflog expire --verbose --all &&
|
||||||
|
loglen=$(wc -l <.git/logs/refs/heads/master) &&
|
||||||
|
test $loglen = 4 &&
|
||||||
|
|
||||||
|
git config --unset gc.reflogexpire &&
|
||||||
|
git config --unset gc.reflogexpireunreachable
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Загрузка…
Ссылка в новой задаче