#include "cache.h"
#include "refs.h"
#include "builtin.h"
-#include "blob.h"
#include "commit.h"
#include "tag.h"
#include "tree-walk.h"
return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
}
-/*
- * Prepare diff_filespec and convert it using diff textconv API
- * if the textconv driver exists.
- * Return 1 if the conversion succeeds, 0 otherwise.
- */
-int textconv_object(const char *path,
- unsigned mode,
- const struct object_id *oid,
- int oid_valid,
- char **buf,
- unsigned long *buf_size)
-{
- struct diff_filespec *df;
- struct userdiff_driver *textconv;
-
- df = alloc_filespec(path);
- fill_filespec(df, oid->hash, oid_valid, mode);
- textconv = get_textconv(df);
- if (!textconv) {
- free_filespec(df);
- return 0;
- }
-
- *buf_size = fill_textconv(textconv, df, buf);
- free_filespec(df);
- return 1;
-}
-
/*
* Given an origin, prepare mmfile_t structure to be used by the
* diff machinery
* Locate an existing origin or create a new one.
* This moves the origin to front position in the commit util list.
*/
-static struct origin *get_origin(struct scoreboard *sb,
- struct commit *commit,
- const char *path)
+static struct origin *get_origin(struct commit *commit, const char *path)
{
struct origin *o, *l;
* We have an origin -- check if the same path exists in the
* parent and return an origin structure to represent it.
*/
-static struct origin *find_origin(struct scoreboard *sb,
- struct commit *parent,
+static struct origin *find_origin(struct commit *parent,
struct origin *origin)
{
struct origin *porigin;
if (!diff_queued_diff.nr) {
/* The path is the same as parent */
- porigin = get_origin(sb, parent, origin->path);
+ porigin = get_origin(parent, origin->path);
oidcpy(&porigin->blob_oid, &origin->blob_oid);
porigin->mode = origin->mode;
} else {
die("internal error in blame::find_origin (%c)",
p->status);
case 'M':
- porigin = get_origin(sb, parent, origin->path);
+ porigin = get_origin(parent, origin->path);
oidcpy(&porigin->blob_oid, &p->one->oid);
porigin->mode = p->one->mode;
break;
* We have an origin -- find the path that corresponds to it in its
* parent and return an origin structure to represent it.
*/
-static struct origin *find_rename(struct scoreboard *sb,
- struct commit *parent,
+static struct origin *find_rename(struct commit *parent,
struct origin *origin)
{
struct origin *porigin = NULL;
struct diff_filepair *p = diff_queued_diff.queue[i];
if ((p->status == 'R' || p->status == 'C') &&
!strcmp(p->two->path, origin->path)) {
- porigin = get_origin(sb, parent, p->one->path);
+ porigin = get_origin(parent, p->one->path);
oidcpy(&porigin->blob_oid, &p->one->oid);
porigin->mode = p->one->mode;
break;
/* find_move already dealt with this path */
continue;
- norigin = get_origin(sb, parent, p->one->path);
+ norigin = get_origin(parent, p->one->path);
oidcpy(&norigin->blob_oid, &p->one->oid);
norigin->mode = p->one->mode;
fill_origin_blob(&sb->revs->diffopt, norigin, &file_p);
* common cases, then we look for renames in the second pass.
*/
for (pass = 0; pass < 2 - no_whole_file_rename; pass++) {
- struct origin *(*find)(struct scoreboard *,
- struct commit *, struct origin *);
+ struct origin *(*find)(struct commit *, struct origin *);
find = pass ? find_rename : find_origin;
for (i = 0, sg = first_scapegoat(revs, commit);
continue;
if (parse_commit(p))
continue;
- porigin = find(sb, p, origin);
+ porigin = find(p, origin);
if (!porigin)
continue;
if (!oidcmp(&porigin->blob_oid, &origin->blob_oid)) {
struct commit_info {
struct strbuf author;
struct strbuf author_mail;
- unsigned long author_time;
+ timestamp_t author_time;
struct strbuf author_tz;
/* filled only when asked for details */
struct strbuf committer;
struct strbuf committer_mail;
- unsigned long committer_time;
+ timestamp_t committer_time;
struct strbuf committer_tz;
struct strbuf summary;
*/
static void get_ac_line(const char *inbuf, const char *what,
struct strbuf *name, struct strbuf *mail,
- unsigned long *time, struct strbuf *tz)
+ timestamp_t *time, struct strbuf *tz)
{
struct ident_split ident;
size_t len, maillen, namelen;
get_commit_info(suspect->commit, &ci, 1);
printf("author %s\n", ci.author.buf);
printf("author-mail %s\n", ci.author_mail.buf);
- printf("author-time %lu\n", ci.author_time);
+ printf("author-time %"PRItime"\n", ci.author_time);
printf("author-tz %s\n", ci.author_tz.buf);
printf("committer %s\n", ci.committer.buf);
printf("committer-mail %s\n", ci.committer_mail.buf);
- printf("committer-time %lu\n", ci.committer_time);
+ printf("committer-time %"PRItime"\n", ci.committer_time);
printf("committer-tz %s\n", ci.committer_tz.buf);
printf("summary %s\n", ci.summary.buf);
if (suspect->commit->object.flags & UNINTERESTING)
stop_progress(&pi.progress);
}
-static const char *format_time(unsigned long time, const char *tz_str,
+static const char *format_time(timestamp_t time, const char *tz_str,
int show_raw_time)
{
static struct strbuf time_buf = STRBUF_INIT;
strbuf_reset(&time_buf);
if (show_raw_time) {
- strbuf_addf(&time_buf, "%lu %s", time, tz_str);
+ strbuf_addf(&time_buf, "%"PRItime" %s", time, tz_str);
}
else {
const char *time_str;
sb.final_buf_size = o->file.size;
}
else {
- o = get_origin(&sb, sb.final, path);
+ o = get_origin(sb.final, path);
if (fill_blob_sha1_and_mode(o))
die(_("no such path %s in %s"), path, final_commit_name);