Skip to content
Newer
Older
100644 224 lines (185 sloc) 7.32 KB
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
1 #ifndef COMMIT_H
2 #define COMMIT_H
3
4 #include "object.h"
5 #include "tree.h"
674d172 Rework pretty_print_commit to use strbufs instead of custom buffers.
Pierre Habouzit authored Sep 10, 2007
6 #include "strbuf.h"
ca135e7 @torvalds Add support for "commit name decorations" to log family of commands
torvalds authored Apr 16, 2007
7 #include "decorate.h"
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
8
9 struct commit_list {
10 struct commit *item;
11 struct commit_list *next;
12 };
13
14 struct commit {
15 struct object object;
d3ff6f5 Move "void *util" from "struct object" into "struct commit"
Linus Torvalds authored Jun 17, 2006
16 void *util;
23c17d4 @torvalds Simplify topo-sort logic
torvalds authored Nov 2, 2007
17 unsigned int indegree;
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
18 unsigned long date;
19 struct commit_list *parents;
20 struct tree *tree;
bd1e17e Make "parse_object()" also fill in commit message buffer data.
Linus Torvalds authored May 25, 2005
21 char *buffer;
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
22 };
23
60ab26d [PATCH] Avoid wasting memory in git-rev-list
Linus Torvalds authored Sep 15, 2005
24 extern int save_commit_buffer;
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
25 extern const char *commit_type;
26
ca135e7 @torvalds Add support for "commit name decorations" to log family of commands
torvalds authored Apr 16, 2007
27 /* While we can decorate any object with a name, it's only used for commits.. */
28 extern struct decoration name_decoration;
29 struct name_decoration {
30 struct name_decoration *next;
eb3005e @nazri commit.h: add 'type' to struct name_decoration
nazri authored Jun 19, 2010
31 int type;
ca135e7 @torvalds Add support for "commit name decorations" to log family of commands
torvalds authored Apr 16, 2007
32 char name[1];
33 };
34
5d6ccf5 [PATCH] Anal retentive 'const unsigned char *sha1'
Jason McMullan authored Jun 3, 2005
35 struct commit *lookup_commit(const unsigned char *sha1);
36 struct commit *lookup_commit_reference(const unsigned char *sha1);
f76412e [PATCH] Add 'git show-branch'.
Junio C Hamano authored Aug 21, 2005
37 struct commit *lookup_commit_reference_gently(const unsigned char *sha1,
38 int quiet);
a6fa599 @patnotz commit: helper methods to reduce redundant blocks of code
patnotz authored Nov 2, 2010
39 struct commit *lookup_commit_reference_by_name(const char *name);
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
40
baf18fc @pclouds Accept tags in HEAD or MERGE_HEAD
pclouds authored Sep 17, 2011
41 /*
42 * Look up object named by "sha1", dereference tag as necessary,
43 * get a commit and return it. If "sha1" does not dereference to
44 * a commit, use ref_name to report an error and die.
45 */
46 struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_name);
47
cf7b1ca @pclouds Add const to parse_{commit,tag}_buffer()
pclouds authored Feb 5, 2011
48 int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size);
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
49 int parse_commit(struct commit *item);
50
11af2aa @chriscool revert: refactor code to find commit subject in find_commit_subject()
chriscool authored Jul 22, 2010
51 /* Find beginning and length of commit subject. */
52 int find_commit_subject(const char *commit_buffer, const char **subject);
53
47e44ed commit: Add commit_list prefix in two function names.
Thiago Farina authored Nov 26, 2010
54 struct commit_list *commit_list_insert(struct commit *item,
55 struct commit_list **list);
6531947 Move commit_list_count() to commit.c
Miklos Vajna authored Jun 27, 2008
56 unsigned commit_list_count(const struct commit_list *l);
47e44ed commit: Add commit_list prefix in two function names.
Thiago Farina authored Nov 27, 2010
57 struct commit_list *commit_list_insert_by_date(struct commit *item,
58 struct commit_list **list);
59 void commit_list_sort_by_date(struct commit_list **list);
dd97f85 [PATCH] Add some functions for commit lists
Daniel Barkalow authored Apr 23, 2005
60
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
61 void free_commit_list(struct commit_list *list);
62
000182e pretty_print_commit: add different formats
Linus Torvalds authored Jun 5, 2005
63 /* Commit formats */
64 enum cmit_fmt {
65 CMIT_FMT_RAW,
66 CMIT_FMT_MEDIUM,
67 CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM,
9b66ec0 Add "--pretty=full" format that also shows committer.
Linus Torvalds authored Jun 26, 2005
68 CMIT_FMT_SHORT,
69 CMIT_FMT_FULL,
ff56fe1 Add --pretty=fuller
Junio C Hamano authored Nov 9, 2005
70 CMIT_FMT_FULLER,
d87449c Introduce --pretty=oneline format.
Junio C Hamano authored Aug 8, 2005
71 CMIT_FMT_ONELINE,
3eefc18 Tentative built-in format-patch.
Junio C Hamano authored Apr 18, 2006
72 CMIT_FMT_EMAIL,
e52a5de @dscho pretty-formats: add 'format:<string>'
dscho authored Feb 23, 2007
73 CMIT_FMT_USERFORMAT,
6b9c58f Split init_revisions() out of setup_revisions()
Junio C Hamano authored Apr 15, 2006
74
4b05548 enums: omit trailing comma for portability
Gary V. Vaughan authored May 14, 2010
75 CMIT_FMT_UNSPECIFIED
000182e pretty_print_commit: add different formats
Linus Torvalds authored Jun 5, 2005
76 };
77
9cba13c @jrn standardize brace placement in struct definitions
jrn authored Mar 16, 2011
78 struct pretty_print_context {
6bf1394 @peff clean up calling conventions for pretty.c functions
peff authored May 26, 2011
79 enum cmit_fmt fmt;
dd2e794 @trast Refactor pretty_print_commit arguments into a struct
trast authored Oct 19, 2009
80 int abbrev;
81 const char *subject;
82 const char *after_subject;
9553d2b @peff format-patch: preserve subject newlines with -k
peff authored May 26, 2011
83 int preserve_subject;
dd2e794 @trast Refactor pretty_print_commit arguments into a struct
trast authored Oct 19, 2009
84 enum date_mode date_mode;
85 int need_8bit_cte;
66b2ed0 @gitster Fix "log" family not to be too agressive about showing notes
gitster authored Jan 20, 2010
86 int show_notes;
8f8f547 @trast Introduce new pretty formats %g[sdD] for reflog information
trast authored Oct 19, 2009
87 struct reflog_walk_info *reflog_info;
177b29d @patnotz pretty.c: teach format_commit_message() to reencode the output
patnotz authored Nov 2, 2010
88 const char *output_encoding;
dd2e794 @trast Refactor pretty_print_commit arguments into a struct
trast authored Oct 19, 2009
89 };
90
5b16360 @heipei pretty: Initialize notes if %N is used
heipei authored Apr 13, 2010
91 struct userformat_want {
92 unsigned notes:1;
93 };
94
28e9cf6 @dscho Expose the has_non_ascii() function
dscho authored Aug 10, 2009
95 extern int has_non_ascii(const char *text);
4da45be @gitster log: teach "terminator" vs "separator" mode to "--pretty=format"
gitster authored Apr 7, 2008
96 struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
177b29d @patnotz pretty.c: teach format_commit_message() to reencode the output
patnotz authored Nov 2, 2010
97 extern char *logmsg_reencode(const struct commit *commit,
98 const char *output_encoding);
69cd8f6 @angavrilov builtin-blame: Reencode commit messages according to git-log rules.
angavrilov authored Oct 22, 2008
99 extern char *reencode_commit_message(const struct commit *commit,
100 const char **encoding_p);
4da45be @gitster log: teach "terminator" vs "separator" mode to "--pretty=format"
gitster authored Apr 8, 2008
101 extern void get_commit_format(const char *arg, struct rev_info *);
c8f1444 sparse: Fix an "symbol 'format_subject' not declared" warning
Ramsay Jones authored Apr 7, 2011
102 extern const char *format_subject(struct strbuf *sb, const char *msg,
103 const char *line_separator);
5b16360 @heipei pretty: Initialize notes if %N is used
heipei authored Apr 13, 2010
104 extern void userformat_find_requirements(const char *fmt, struct userformat_want *w);
674d172 Rework pretty_print_commit to use strbufs instead of custom buffers.
Pierre Habouzit authored Sep 10, 2007
105 extern void format_commit_message(const struct commit *commit,
7f98ebc @gitster format_commit_message(): fix function signature
gitster authored Oct 15, 2009
106 const char *format, struct strbuf *sb,
dd2e794 @trast Refactor pretty_print_commit arguments into a struct
trast authored Oct 19, 2009
107 const struct pretty_print_context *context);
6bf1394 @peff clean up calling conventions for pretty.c functions
peff authored May 26, 2011
108 extern void pretty_print_commit(const struct pretty_print_context *pp,
109 const struct commit *commit,
110 struct strbuf *sb);
8b8a537 @peff pretty: add pp_commit_easy function for simple callers
peff authored May 26, 2011
111 extern void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,
112 struct strbuf *sb);
6bf1394 @peff clean up calling conventions for pretty.c functions
peff authored May 26, 2011
113 void pp_user_info(const struct pretty_print_context *pp,
114 const char *what, struct strbuf *sb,
115 const char *line, const char *encoding);
116 void pp_title_line(const struct pretty_print_context *pp,
b02bd65 Export some email and pretty-printing functions
Daniel Barkalow authored Feb 18, 2008
117 const char **msg_p,
118 struct strbuf *sb,
119 const char *encoding,
267123b @gitster Merge branch 'maint'
gitster authored Mar 15, 2008
120 int need_8bit_cte);
6bf1394 @peff clean up calling conventions for pretty.c functions
peff authored May 26, 2011
121 void pp_remainder(const struct pretty_print_context *pp,
b02bd65 Export some email and pretty-printing functions
Daniel Barkalow authored Feb 19, 2008
122 const char **msg_p,
123 struct strbuf *sb,
124 int indent);
125
e3bc7a3 Add generic commit "pretty print" function.
Linus Torvalds authored Jun 1, 2005
126
dd97f85 [PATCH] Add some functions for commit lists
Daniel Barkalow authored Apr 24, 2005
127 /** Removes the first commit from a list sorted by date, and adds all
128 * of its parents.
129 **/
a6080a0 @gitster War on whitespace
gitster authored Jun 7, 2007
130 struct commit *pop_most_recent_commit(struct commit_list **list,
58e28af [PATCH] Allow multiple date-ordered lists
Daniel Barkalow authored Apr 23, 2005
131 unsigned int mark);
dd97f85 [PATCH] Add some functions for commit lists
Daniel Barkalow authored Apr 24, 2005
132
a3437b8 [PATCH] Modify git-rev-list to linearise the commit history in merge …
jon@blackcubes.dyndns.org authored Jun 6, 2005
133 struct commit *pop_commit(struct commit_list **stack);
134
f8f9c73 describe: allow more than one revs to be named.
Junio C Hamano authored Jan 7, 2006
135 void clear_commit_marks(struct commit *commit, unsigned int mark);
86a0a40 commit: factor out clear_commit_marks_for_object_array
René Scharfe authored Oct 1, 2011
136 void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark);
f8f9c73 describe: allow more than one revs to be named.
Junio C Hamano authored Jan 8, 2006
137
ab580ac @jonseymour [PATCH] Add a topological sort procedure to commit.c
jonseymour authored Jul 7, 2005
138 /*
139 * Performs an in-place topological sort of list supplied.
140 *
141 * invariant of resulting list is:
142 * a reachable from b => ord(b) < ord(a)
4c8725f topo-order: make --date-order optional.
Junio C Hamano authored Feb 15, 2006
143 * in addition, when lifo == 0, commits on parallel tracks are
144 * sorted in the dates order.
ab580ac @jonseymour [PATCH] Add a topological sort procedure to commit.c
jonseymour authored Jul 6, 2005
145 */
4c8725f topo-order: make --date-order optional.
Junio C Hamano authored Feb 16, 2006
146 void sort_in_topological_order(struct commit_list ** list, int lifo);
5040f17 blame -S <ancestry-file>
Junio C Hamano authored Apr 6, 2006
147
148 struct commit_graft {
149 unsigned char sha1[20];
ed09aef @dscho support fetching into a shallow repository
dscho authored Oct 30, 2006
150 int nr_parent; /* < 0 if shallow commit */
5040f17 blame -S <ancestry-file>
Junio C Hamano authored Apr 7, 2006
151 unsigned char parent[FLEX_ARRAY][20]; /* more */
152 };
09d4664 @pclouds Add for_each_commit_graft() to iterate all grafts
pclouds authored Aug 18, 2011
153 typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
5040f17 blame -S <ancestry-file>
Junio C Hamano authored Apr 7, 2006
154
155 struct commit_graft *read_graft_line(char *buf, int len);
156 int register_commit_graft(struct commit_graft *, int);
4516338 builtin-fsck: reports missing parent commits
Martin Koegler authored Feb 25, 2008
157 struct commit_graft *lookup_commit_graft(const unsigned char *sha1);
5040f17 blame -S <ancestry-file>
Junio C Hamano authored Apr 7, 2006
158
c0fa825 Fold get_merge_bases_clean() into get_merge_bases()
Rene Scharfe authored Jul 2, 2006
159 extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *rev2, int cleanup);
53eda89 @chriscool merge-base: teach "git merge-base" to drive underlying merge_bases_ma…
chriscool authored Jul 30, 2008
160 extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos, int cleanup);
5240c9d Introduce get_octopus_merge_bases() in commit.c
Miklos Vajna authored Jun 27, 2008
161 extern struct commit_list *get_octopus_merge_bases(struct commit_list *in);
7c6f8aa @dscho move get_merge_bases() to core lib.
dscho authored Jun 29, 2006
162
ed09aef @dscho support fetching into a shallow repository
dscho authored Oct 30, 2006
163 extern int register_shallow(const unsigned char *sha1);
f53514b @dscho allow deepening of a shallow repository
dscho authored Oct 30, 2006
164 extern int unregister_shallow(const unsigned char *sha1);
09d4664 @pclouds Add for_each_commit_graft() to iterate all grafts
pclouds authored Aug 18, 2011
165 extern int for_each_commit_graft(each_commit_graft_fn, void *);
f43117a is_repository_shallow(): prototype fix.
Junio C Hamano authored Jan 21, 2007
166 extern int is_repository_shallow(void);
ed09aef @dscho support fetching into a shallow repository
dscho authored Oct 30, 2006
167 extern struct commit_list *get_shallow_commits(struct object_array *heads,
f53514b @dscho allow deepening of a shallow repository
dscho authored Oct 30, 2006
168 int depth, int shallow_flag, int not_shallow_flag);
ed09aef @dscho support fetching into a shallow repository
dscho authored Oct 30, 2006
169
7fcdb36 Make has_commit() non-static
Jake Goulding authored Jan 26, 2009
170 int is_descendant_of(struct commit *, struct commit_list *);
03840fc Allow in_merge_bases() to take more than one reference commits.
Junio C Hamano authored Jan 8, 2007
171 int in_merge_bases(struct commit *, struct commit **, int);
5868016 Introduce entry point add_interactive and add_files_to_cache
Kristian Høgsberg authored Sep 17, 2007
172
b4bd466 @ConradIrwin Add support for -p/--patch to git-commit
ConradIrwin authored May 7, 2011
173 extern int interactive_add(int argc, const char **argv, const char *prefix, int patch);
46b5139 @trast builtin-add: refactor the meat of interactive_add()
trast authored Aug 13, 2009
174 extern int run_add_interactive(const char *revision, const char *patch_mode,
175 const char **pathspec);
5868016 Introduce entry point add_interactive and add_files_to_cache
Kristian Høgsberg authored Sep 18, 2007
176
53b2c82 @torvalds revision walker: mini clean-up
torvalds authored Nov 5, 2007
177 static inline int single_parent(struct commit *commit)
178 {
179 return commit->parents && !commit->parents->next;
180 }
181
98cf9c3 @gitster Introduce reduce_heads()
gitster authored Jun 27, 2008
182 struct commit_list *reduce_heads(struct commit_list *heads);
183
5231c63 @gitster commit: copy merged signed tags to headers of merge commit
gitster authored Nov 7, 2011
184 struct commit_extra_header {
185 struct commit_extra_header *next;
186 char *key;
187 char *value;
188 size_t len;
189 };
190
191 extern void append_merge_tag_headers(struct commit_list *parents,
192 struct commit_extra_header ***tail);
193
13f8b72 @pclouds Convert commit_tree() to take strbuf as message
pclouds authored Dec 15, 2011
194 extern int commit_tree(const struct strbuf *msg, unsigned char *tree,
5231c63 @gitster commit: copy merged signed tags to headers of merge commit
gitster authored Nov 8, 2011
195 struct commit_list *parents, unsigned char *ret,
ba3c69a @gitster commit: teach --gpg-sign option
gitster authored Oct 5, 2011
196 const char *author, const char *sign_commit);
5231c63 @gitster commit: copy merged signed tags to headers of merge commit
gitster authored Nov 8, 2011
197
f35ccd9 @gitster Merge branch 'nd/war-on-nul-in-commit'
gitster authored Dec 22, 2011
198 extern int commit_tree_extended(const struct strbuf *msg, unsigned char *tree,
5231c63 @gitster commit: copy merged signed tags to headers of merge commit
gitster authored Nov 8, 2011
199 struct commit_list *parents, unsigned char *ret,
ba3c69a @gitster commit: teach --gpg-sign option
gitster authored Oct 6, 2011
200 const char *author, const char *sign_commit,
5231c63 @gitster commit: copy merged signed tags to headers of merge commit
gitster authored Nov 8, 2011
201 struct commit_extra_header *);
202
c871a1d @gitster commit --amend -S: strip existing gpgsig headers
gitster authored Jan 5, 2012
203 extern struct commit_extra_header *read_commit_extra_headers(struct commit *, const char **);
204 extern struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
ed7a42a @gitster commit: teach --amend to carry forward extra headers
gitster authored Nov 8, 2011
205
5231c63 @gitster commit: copy merged signed tags to headers of merge commit
gitster authored Nov 8, 2011
206 extern void free_commit_extra_headers(struct commit_extra_header *extra);
40d52ff @peff make commit_tree a library function
peff authored Apr 1, 2010
207
ae8e4c9 @gitster merge: make usage of commit->util more extensible
gitster authored Nov 7, 2011
208 struct merge_remote_desc {
209 struct object *obj; /* the named object, could be a tag */
210 const char *name;
211 };
212 #define merge_remote_util(commit) ((struct merge_remote_desc *)((commit)->util))
213
214 /*
215 * Given "name" from the command line to merge, find the commit object
216 * and return it, while storing merge_remote_desc in its ->util field,
217 * to allow callers to tell if we are told to merge a tag.
218 */
219 struct commit *get_merge_parent(const char *name);
220
0c37f1f @gitster log: --show-signature
gitster authored Oct 18, 2011
221 extern int parse_signed_commit(const unsigned char *sha1,
222 struct strbuf *message, struct strbuf *signature);
6eb8ae0 [PATCH] Header files for object parsing
Daniel Barkalow authored Apr 18, 2005
223 #endif /* COMMIT_H */
Something went wrong with that request. Please try again.