git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v1 0/1] pack-refs: pack expired loose refs to packed_refs

From
16657101987@163.com <16657101987@163.com>
Date
Jul 21, 2019, 18:17 UTC
Message-ID
<20190721181739.81110-1-16657101987@163.com>
From: Sun Chao <sunchao9@huawei.com>

When a packed ref is deleted, the whole packed-refs file is rewrite and omit the ref that no longer exists. However if another gc command is running and call `pack-refs --all` simultaneously, there is a change that a ref just updated will lost the newly commits.

There are two valid methods to avoid losting commit of ref:
  - force `update-ref -d` to update the snapshot before
    rewrite packed-refs.
  - do not pack a recently updated ref, where *recently*
    could be set by *pack.looserefsexpire* option.

I prefer **do not pack a recently updated ref**, here is the reasons:

  1. It could avoid losting the newly commit of a ref which I
     described upon.
  2. Sometime, the git server will do `pack-refs --all` and
     `update-ref` the same time, and the two commands have
     chances to trying lock the same ref such as master, if
     this happends one command will fail with such error:
     **cannot lock ref 'refs/heads/master'**
     This could happen if a ref is updated frequently, and
     avoid pack the ref which is update recently could avoid
     this error most of the time.
Sun Chao (1):
  pack-refs: pack expired loose refs to packed_refs
 builtin/pack-refs.c       | 13 ++++++++++++-
 refs.c                    |  4 ++--
 refs.h                    |  2 +-
 refs/files-backend.c      | 18 +++++++++++++++++-
 refs/packed-backend.c     |  2 +-
 refs/refs-internal.h      |  2 +-
 t/helper/test-ref-store.c |  2 +-
 7 files changed, 35 insertions(+), 8 deletions(-)
-- 
2.22.0.214.g8dca754b1e
Next: 16657101987@163.com
Message 1 of 8 in “pack-refs: pack expired loose refs to packed_refs”
  1. 0/1 pack-refs: pack expired loose refs to packed_refs16657101987@163.com, Jul 21, 2019
  2. 1/1 pack-refs: pack expired loose refs to packed_refs16657101987@163.com, Jul 21, 2019
  3. Jeff KingJul 30, 2019
  4. 0/1 pack-refs: always refreshing after take the lock file16657101987@163.com, Jul 31, 2019
  5. 1/1 pack-refs: always refreshing after take the lock file16657101987@163.com, Jul 31, 2019
  6. Jeff KingAug 16, 2019
  7. Junio C HamanoAug 19, 2019
  8. 16657101987@163.comAug 20, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.