summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-11-03 08:55:57 -0800
committerJunio C Hamano <gitster@pobox.com>2014-11-03 11:18:35 -0800
commit986781fccb2eba058d11b432e5c5c6259989981d (patch)
tree6043e6d0f478d13650f54b81b01d213ddf9972fe /refs.h
parent6a0103dc112c3f8c0d3e3f401fbd33ea6e273b31 (diff)
downloadgit-rs/ref-transaction-reflog.tar.gz
refs.c: allow deleting refs with a broken sha1rs/ref-transaction-reflog
Add back support to make it possible to delete refs that have a broken sha1. Add new internal flags REF_ALLOW_BROKEN and RESOLVE_REF_ALLOW_BAD_SHA1 to pass intent from branch.c that we are willing to allow resolve_ref_unsafe and lock_ref_sha1_basic to allow broken refs. Since these refs can not actually be resolved to a sha1, they instead resolve to null_sha1 when these flags are used. For example, the ref: echo "Broken ref" > .git/refs/heads/foo-broken-1 can now be deleted using git branch -d foo-broken-1 Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/refs.h b/refs.h
index 721e21f02d..2e97f4fb45 100644
--- a/refs.h
+++ b/refs.h
@@ -185,11 +185,13 @@ extern int peel_ref(const char *refname, unsigned char *sha1);
* REF_NODEREF: act on the ref directly, instead of dereferencing
* symbolic references.
* REF_DELETING: tolerate broken refs
+ * REF_ALLOW_BROKEN: allow locking refs that are broken.
*
* Flags >= 0x100 are reserved for internal use.
*/
-#define REF_NODEREF 0x01
-#define REF_DELETING 0x02
+#define REF_NODEREF 0x01
+#define REF_DELETING 0x02
+#define REF_ALLOW_BROKEN 0x04
/** Reads log for the value of ref during at_time. **/
extern int read_ref_at(const char *refname, unsigned int flags,