Skip to content

add a reflog_exists and delete_reflog abstraction

Ronnie Sahlberg git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v11 patch 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2refs.c: add new functions reflog_exists and delete_reflogbuiltin/checkout.c builtin/reflog.c refs.c +1 more+25 -110 replies
2/2checkout.c: use ref_exists instead of file_existbuiltin/checkout.c t/t1410-reflog.sh+9 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] add a reflog_exists and delete_reflog abstraction

This is a series adds two new functions to try to hide the reflog implementation details from the callers in checkout.c and reflog.c. It adds new functions to test if a reflog exists and to delete it, thus allowing checkout.c to perform this if-test-then-delete operation without having to know the internal implementation of reflogs (i.e. that they are files that live under .git/logs)

Additionally we change checkout.c to use ref_exists instead of file_exists when checking for ref existence. This fixes a bug when checkout could delete a valid reflog file if the branch was a packed ref. The tests have been updated to test for this bug.

Version 2:
- Typos and fixes suggested by mhagger.
- Break the checkout-deletes reflog bugfix out into a separate patch.

Ronnie Sahlberg (2):
refs.c: add new functions reflog_exists and delete_reflog checkout.c: use ref_exists instead of file_exist

 builtin/checkout.c |  8 ++------
 builtin/reflog.c   |  2 +-
 refs.c             | 21 +++++++++++++++------
 refs.h             |  6 ++++++
 t/t1410-reflog.sh  |  8 ++++++++
 5 files changed, 32 insertions(+), 13 deletions(-)
Signature · 1 line
2.0.0.rc1.354.g7561c2b.dirty