diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-05-15 10:29:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-15 14:12:27 -0700 |
commit | 9c9d20f0c2c34ed286ef30cde30c813c485d19e6 (patch) | |
tree | 0c3880accea56aeadec1554128ceda166f940b61 | |
parent | 4406c6141960f9d017961b3ceb87621c268c8fd4 (diff) | |
download | git-9c9d20f0c2c34ed286ef30cde30c813c485d19e6.tar.gz |
refs.c: pack all refs before we start to rename a ref
This means that most loose refs will no longer be present after the rename
which triggered a test failure since it assumes the file for an unrelated
ref would still be present after the rename.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 3 | ||||
-rwxr-xr-x | t/t3200-branch.sh | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -2607,6 +2607,9 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms return error("unable to move logfile logs/%s to "TMP_RENAMED_LOG": %s", oldrefname, strerror(errno)); + if (pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)) + return error("unable to pack refs"); + if (delete_ref(oldrefname, orig_sha1, REF_NODEREF)) { error("unable to delete old %s", oldrefname); goto rollback; diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index ac31b711f2..fafd38a13c 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -289,7 +289,7 @@ test_expect_success 'renaming a symref is not allowed' ' git symbolic-ref refs/heads/master2 refs/heads/master && test_must_fail git branch -m master2 master3 && git symbolic-ref refs/heads/master2 && - test_path_is_file .git/refs/heads/master && + test_path_is_missing .git/refs/heads/master && test_path_is_missing .git/refs/heads/master3 ' |