summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/commit.h b/commit.h
index 5467786c7b..49c0f50396 100644
--- a/commit.h
+++ b/commit.h
@@ -11,9 +11,10 @@
#include "commit-slab.h"
#define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF
-#define GENERATION_NUMBER_INFINITY 0xFFFFFFFF
-#define GENERATION_NUMBER_MAX 0x3FFFFFFF
+#define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1)
+#define GENERATION_NUMBER_V1_MAX 0x3FFFFFFF
#define GENERATION_NUMBER_ZERO 0
+#define GENERATION_NUMBER_V2_OFFSET_MAX ((1ULL << 31) - 1)
struct commit_list {
struct commit *item;
@@ -88,9 +89,10 @@ static inline int repo_parse_commit(struct repository *r, struct commit *item)
return repo_parse_commit_gently(r, item, 0);
}
-static inline int parse_commit_no_graph(struct commit *commit)
+static inline int repo_parse_commit_no_graph(struct repository *r,
+ struct commit *commit)
{
- return repo_parse_commit_internal(the_repository, commit, 0, 0);
+ return repo_parse_commit_internal(r, commit, 0, 0);
}
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
@@ -167,6 +169,8 @@ int find_commit_subject(const char *commit_buffer, const char **subject);
struct commit_list *commit_list_insert(struct commit *item,
struct commit_list **list);
+int commit_list_contains(struct commit *item,
+ struct commit_list *list);
struct commit_list **commit_list_append(struct commit *commit,
struct commit_list **next);
unsigned commit_list_count(const struct commit_list *l);
@@ -177,6 +181,9 @@ void commit_list_sort_by_date(struct commit_list **list);
/* Shallow copy of the input list */
struct commit_list *copy_commit_list(struct commit_list *list);
+/* Modify list in-place to reverse it, returning new head; list will be tail */
+struct commit_list *reverse_commit_list(struct commit_list *list);
+
void free_commit_list(struct commit_list *list);
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
@@ -234,7 +241,7 @@ typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
struct commit_graft *read_graft_line(struct strbuf *line);
/* commit_graft_pos returns an index into r->parsed_objects->grafts. */
-int commit_graft_pos(struct repository *r, const unsigned char *sha1);
+int commit_graft_pos(struct repository *r, const struct object_id *oid);
int register_commit_graft(struct repository *r, struct commit_graft *, int);
void prepare_commit_graft(struct repository *r);
struct commit_graft *lookup_commit_graft(struct repository *r, const struct object_id *oid);
@@ -312,7 +319,8 @@ void set_merge_remote_desc(struct commit *commit,
struct commit *get_merge_parent(const char *name);
int parse_signed_commit(const struct commit *commit,
- struct strbuf *message, struct strbuf *signature);
+ struct strbuf *message, struct strbuf *signature,
+ const struct git_hash_algo *algop);
int remove_signature(struct strbuf *buf);
/*
@@ -354,4 +362,13 @@ int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void
LAST_ARG_MUST_BE_NULL
int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...);
+/* Sign a commit or tag buffer, storing the result in a header. */
+int sign_with_header(struct strbuf *buf, const char *keyid);
+/* Parse the signature out of a header. */
+int parse_buffer_signed_by_header(const char *buffer,
+ unsigned long size,
+ struct strbuf *payload,
+ struct strbuf *signature,
+ const struct git_hash_algo *algop);
+
#endif /* COMMIT_H */