git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add a reflog_exists and delete_reflog abstraction
@ 2014-05-05 22:57 Ronnie Sahlberg
  2014-05-05 22:57 ` [PATCH] refs.c: add new functions reflog_exists and delete_reflog Ronnie Sahlberg
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ronnie Sahlberg @ 2014-05-05 22:57 UTC (permalink / raw)
  To: git; +Cc: mhagger, Ronnie Sahlberg

This is a single patch that 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 unde r.git/logs)

It also changes checkout.c to use ref_exists when checking for whether a ref
exists or not instead of checking if the loose ref file exists or not.
Using ref_exists instead both hides the reflog implementation details from
checkout.c as well as making the code more robust against future changes.
It currently has a hard assumption that the loose ref file must exist at this
stage or else it would end up deleting the reflog which is true today, as far
as I can tell, but would break if git would change such that we could have
a branch checked out without having a loose ref file for that branch.


Ronnie Sahlberg (1):
  refs.c: add new functions reflog_exists and delete_reflog

 builtin/checkout.c |  8 ++------
 builtin/reflog.c   |  2 +-
 refs.c             | 20 ++++++++++++++------
 refs.h             |  6 ++++++
 4 files changed, 23 insertions(+), 13 deletions(-)

-- 
2.0.0.rc1.351.gd2b7e18.dirty

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-05-07 20:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 22:57 [PATCH] add a reflog_exists and delete_reflog abstraction Ronnie Sahlberg
2014-05-05 22:57 ` [PATCH] refs.c: add new functions reflog_exists and delete_reflog Ronnie Sahlberg
2014-05-06 15:55   ` Michael Haggerty
2014-05-06 18:21     ` Ronnie Sahlberg
2014-05-06 15:23 ` [PATCH] add a reflog_exists and delete_reflog abstraction Michael Haggerty
2014-05-07 20:47   ` Ronnie Sahlberg
2014-05-06 19:15 ` Junio C Hamano
2014-05-06 19:29   ` Ronnie Sahlberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).