aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2006-12-18 07:07:28 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2006-12-18 07:07:28 (JST)
commit6cb326c83b3c0b35d472305294afee3105b3088d (patch)
treefcceeec36ae6f1b3b8e9f861064e2d6ba962a6e0
parent9c5229ea394808f90433ee84439503bee124e1de (diff)
downloadcgit-6cb326c83b3c0b35d472305294afee3105b3088d.zip
cgit-6cb326c83b3c0b35d472305294afee3105b3088d.tar.gz
Show list of modified files in ui-commit.c
Compare current commit with 1.parent, and for each affected file display current filemode, old filemode if changed, current filename and source filename if it was a copy/rename. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r--cgit.css51
-rw-r--r--cgit.h1
-rw-r--r--git.h106
-rw-r--r--html.c20
-rw-r--r--ui-commit.c111
5 files changed, 281 insertions, 8 deletions
diff --git a/cgit.css b/cgit.css
index 94372d6..ae304fa 100644
--- a/cgit.css
+++ b/cgit.css
@@ -3,7 +3,7 @@ body {
3 font-size: normal; 3 font-size: normal;
4 background: white; 4 background: white;
5 padding: 0em; 5 padding: 0em;
6 margin: 0.5em; 6 margin: 0.5em 1em;
7} 7}
8 8
9 9
@@ -50,16 +50,19 @@ img {
50 50
51 51
52div#header { 52div#header {
53 background-color: #ddd; 53 background-color: #eee;
54 padding: 0.25em 0.25em 0.25em 0.5em; 54 padding: 0.25em 0.25em 0.25em 0.5em;
55 font-size: 150%; 55 font-size: 150%;
56 font-weight: bold; 56 font-weight: bold;
57 border: solid 1px #aaa; 57 border: solid 1px #ccc;
58 vertical-align: middle; 58 vertical-align: middle;
59} 59}
60div#header img#logo { 60div#header img#logo {
61 float: right; 61 float: right;
62} 62}
63div#header a {
64 color: black;
65}
63 66
64div#content { 67div#content {
65 margin: 0.5em 0.5em; 68 margin: 0.5em 0.5em;
@@ -97,8 +100,7 @@ table.log td {
97 100
98table.commit-info { 101table.commit-info {
99 border-collapse: collapse; 102 border-collapse: collapse;
100 margin-top: 1em; 103 margin-top: 1.5em;
101
102} 104}
103table.commit-info th { 105table.commit-info th {
104 text-align: left; 106 text-align: left;
@@ -111,14 +113,47 @@ table.commit-info td {
111} 113}
112div.commit-subject { 114div.commit-subject {
113 font-weight: bold; 115 font-weight: bold;
114 font-size: 110%; 116 font-size: 125%;
115 margin: 1em 0em 1em; 117 margin: 1.5em 0em 0.5em 0em;
118 padding: 0em;
116} 119}
117div.commit-msg { 120div.commit-msg {
118 white-space: pre; 121 white-space: pre;
119 font-family: courier; 122 font-family: monospace;
123}
124table.diffstat {
125 border-collapse: collapse;
126 margin-top: 1.5em;
127}
128table.diffstat th {
129 font-weight: normal;
130 text-align: left;
131 text-decoration: underline;
132 padding: 0.1em 1em 0.1em 0.1em;
120 font-size: 100%; 133 font-size: 100%;
121} 134}
135table.diffstat td {
136 padding: 0.1em 1em 0.1em 0.1em;
137 font-size: 100%;
138}
139table.diffstat td span.modechange {
140 padding-left: 1em;
141 color: red;
142}
143table.diffstat td.add a {
144 color: green;
145}
146table.diffstat td.del a {
147 color: red;
148}
149table.diffstat td.upd a {
150 color: blue;
151}
152table.diffstat td.summary {
153 /* border-top: solid 1px black; */
154 color: #888;
155 padding-top: 0.5em;
156}
122.sha1 { 157.sha1 {
123 font-family: courier; 158 font-family: courier;
124 font-size: 90%; 159 font-size: 90%;
diff --git a/cgit.h b/cgit.h
index 02cc26a..37584d6 100644
--- a/cgit.h
+++ b/cgit.h
@@ -75,6 +75,7 @@ extern void html_txt(char *txt);
75extern void html_attr(char *txt); 75extern void html_attr(char *txt);
76extern void html_link_open(char *url, char *title, char *class); 76extern void html_link_open(char *url, char *title, char *class);
77extern void html_link_close(void); 77extern void html_link_close(void);
78extern void html_filemode(unsigned short mode);
78 79
79extern int cgit_read_config(const char *filename, configfn fn); 80extern int cgit_read_config(const char *filename, configfn fn);
80extern int cgit_parse_query(char *txt, configfn fn); 81extern int cgit_parse_query(char *txt, configfn fn);
diff --git a/git.h b/git.h
index a3f977c..922a167 100644
--- a/git.h
+++ b/git.h
@@ -128,6 +128,8 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len)
128#define MINIMUM_ABBREV 4 128#define MINIMUM_ABBREV 4
129#define DEFAULT_ABBREV 7 129#define DEFAULT_ABBREV 7
130 130
131extern const unsigned char null_sha1[20];
132
131extern int sha1_object_info(const unsigned char *, char *, unsigned long *); 133extern int sha1_object_info(const unsigned char *, char *, unsigned long *);
132 134
133extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size); 135extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size);
@@ -136,6 +138,24 @@ extern int get_sha1(const char *str, unsigned char *sha1);
136extern int get_sha1_hex(const char *hex, unsigned char *sha1); 138extern int get_sha1_hex(const char *hex, unsigned char *sha1);
137extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ 139extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
138 140
141static inline int is_null_sha1(const unsigned char *sha1)
142{
143 return !memcmp(sha1, null_sha1, 20);
144}
145static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
146{
147 return memcmp(sha1, sha2, 20);
148}
149static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
150{
151 memcpy(sha_dst, sha_src, 20);
152}
153static inline void hashclr(unsigned char *hash)
154{
155 memset(hash, 0, 20);
156}
157
158
139 159
140 160
141/* 161/*
@@ -257,6 +277,61 @@ typedef void* (*topo_sort_get_fn_t)(struct commit*);
257 277
258 278
259 279
280/*
281 * from git:diffcore.h
282 */
283
284struct diff_filespec {
285 unsigned char sha1[20];
286 char *path;
287 void *data;
288 void *cnt_data;
289 unsigned long size;
290 int xfrm_flags; /* for use by the xfrm */
291 unsigned short mode; /* file mode */
292 unsigned sha1_valid : 1; /* if true, use sha1 and trust mode;
293 * if false, use the name and read from
294 * the filesystem.
295 */
296#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
297 unsigned should_free : 1; /* data should be free()'ed */
298 unsigned should_munmap : 1; /* data should be munmap()'ed */
299};
300
301struct diff_filepair {
302 struct diff_filespec *one;
303 struct diff_filespec *two;
304 unsigned short int score;
305 char status; /* M C R N D U (see Documentation/diff-format.txt) */
306 unsigned source_stays : 1; /* all of R/C are copies */
307 unsigned broken_pair : 1;
308 unsigned renamed_pair : 1;
309};
310
311#define DIFF_PAIR_UNMERGED(p) \
312 (!DIFF_FILE_VALID((p)->one) && !DIFF_FILE_VALID((p)->two))
313
314#define DIFF_PAIR_RENAME(p) ((p)->renamed_pair)
315
316#define DIFF_PAIR_BROKEN(p) \
317 ( (!DIFF_FILE_VALID((p)->one) != !DIFF_FILE_VALID((p)->two)) && \
318 ((p)->broken_pair != 0) )
319
320#define DIFF_PAIR_TYPE_CHANGED(p) \
321 ((S_IFMT & (p)->one->mode) != (S_IFMT & (p)->two->mode))
322
323#define DIFF_PAIR_MODE_CHANGED(p) ((p)->one->mode != (p)->two->mode)
324
325extern void diff_free_f