]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit.h
Merge branch 'cm/rebase-i-updates'
[thirdparty/git.git] / commit.h
index 1b2dea5d85ebe52c8e5f32f1e5e26ff33e0c566c..49c0f503964ec3bb0e682390b0b409b6a76b0924 100644 (file)
--- a/commit.h
+++ b/commit.h
 #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;
@@ -36,8 +37,6 @@ struct commit {
         * or get_commit_tree_oid().
         */
        struct tree *maybe_tree;
-       uint32_t graph_pos;
-       uint32_t generation;
        unsigned int index;
 };
 
@@ -90,14 +89,14 @@ 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
 #define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use)
-#define parse_commit_gently(item, quiet) repo_parse_commit_gently(the_repository, item, quiet)
 #define parse_commit(item) repo_parse_commit(the_repository, item)
 #endif
 
@@ -170,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);
@@ -180,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 */
@@ -237,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);
@@ -251,7 +255,7 @@ struct oid_array;
 struct ref;
 int for_each_commit_graft(each_commit_graft_fn, void *);
 
-int interactive_add(int argc, const char **argv, const char *prefix, int patch);
+int interactive_add(const char **argv, const char *prefix, int patch);
 int run_add_interactive(const char *revision, const char *patch_mode,
                        const struct pathspec *pathspec);
 
@@ -272,10 +276,9 @@ int commit_tree(const char *msg, size_t msg_len,
 
 int commit_tree_extended(const char *msg, size_t msg_len,
                         const struct object_id *tree,
-                        struct commit_list *parents,
-                        struct object_id *ret, const char *author,
-                        const char *sign_commit,
-                        struct commit_extra_header *);
+                        struct commit_list *parents, struct object_id *ret,
+                        const char *author, const char *committer,
+                        const char *sign_commit, struct commit_extra_header *);
 
 struct commit_extra_header *read_commit_extra_headers(struct commit *, const char **);
 
@@ -316,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);
 
 /*
@@ -358,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 */