/* * This is equivalent to "git log -g --abbrev-commit --pretty=oneline" */ int cmd_log_reflog(int argc, const char **argv, const char *prefix) { struct rev_info rev; git_config(git_log_config, NULL); if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; init_revisions(&rev, prefix); init_reflog_walk(&rev.reflog_info); rev.abbrev_commit = 1; rev.verbose_header = 1; cmd_log_init(argc, argv, prefix, &rev); /* * This means that we override whatever commit format the user gave * on the cmd line. Sad, but cmd_log_init() currently doesn't * allow us to set a different default. */ rev.commit_format = CMIT_FMT_ONELINE; rev.use_terminator = 1; rev.always_show_header = 1; /* * We get called through "git reflog", so unlike the other log * routines, we need to set up our pager manually.. */ setup_pager(); return cmd_log_walk(&rev); }
/* * This is equivalent to "git log -g --abbrev-commit --pretty=oneline" */ int cmd_log_reflog(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct setup_revision_opt opt; git_config(git_log_config, NULL); if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; init_revisions(&rev, prefix); init_reflog_walk(&rev.reflog_info); rev.abbrev_commit = 1; rev.verbose_header = 1; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; cmd_log_init(argc, argv, prefix, &rev, &opt); /* * This means that we override whatever commit format the user gave * on the cmd line. Sad, but cmd_log_init() currently doesn't * allow us to set a different default. */ rev.commit_format = CMIT_FMT_ONELINE; rev.use_terminator = 1; rev.always_show_header = 1; return cmd_log_walk(&rev); }
int git_open_log(GIT_LOG * handle, char * arg) { struct rev_info *p_Rev; char ** argv=0; int argc=0; unsigned int i=0; struct setup_revision_opt opt; /* clear flags */ unsigned int obj_size = get_max_object_index(); for(i =0; i<obj_size; i++) { struct object *ob= get_indexed_object(i); if(ob) { ob->flags=0; if (ob->parsed && ob->type == OBJ_COMMIT) { struct commit* commit = (struct commit*)ob; free_commit_list(commit->parents); commit->parents = NULL; if (commit->tree) free_tree_buffer(commit->tree); commit->tree = NULL; ob->parsed = 0; } } } if(arg != NULL) argv = strtoargv(arg,&argc); if (!argv) return -1; p_Rev = malloc(sizeof(struct rev_info)); if (p_Rev == NULL) { free(argv); return -1; } memset(p_Rev,0,sizeof(struct rev_info)); invalidate_ref_cache(NULL); init_revisions(p_Rev, g_prefix); p_Rev->diff = 1; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; cmd_log_init(argc, argv, g_prefix,p_Rev,&opt); p_Rev->pPrivate = argv; *handle = p_Rev; return 0; }
int cmd_log(int argc, const char **argv, const char *prefix) { struct rev_info rev; git_config(git_log_config, NULL); if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; init_revisions(&rev, prefix); rev.always_show_header = 1; cmd_log_init(argc, argv, prefix, &rev); return cmd_log_walk(&rev); }
int cmd_log(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct setup_revision_opt opt; git_config(git_log_config, NULL); init_revisions(&rev, prefix); rev.always_show_header = 1; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; cmd_log_init(argc, argv, prefix, &rev, &opt); return cmd_log_walk(&rev); }
int git_open_log(GIT_LOG * handle, char * arg) { struct rev_info *p_Rev; char ** argv=0; int argc=0; unsigned int i=0; struct setup_revision_opt opt; /* clear flags */ unsigned int obj_size = get_max_object_index(); for(i =0; i<obj_size; i++) { struct object *ob= get_indexed_object(i); if(ob) ob->flags=0; } if(arg != NULL) argv = strtoargv(arg,&argc); if (!argv) return -1; p_Rev = malloc(sizeof(struct rev_info)); if (p_Rev == NULL) { free(argv); return -1; } memset(p_Rev,0,sizeof(struct rev_info)); invalidate_ref_cache(NULL); init_revisions(p_Rev, g_prefix); p_Rev->diff = 1; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; cmd_log_init(argc, argv, g_prefix,p_Rev,&opt); p_Rev->pPrivate = argv; *handle = p_Rev; return 0; }
int cmd_whatchanged(int argc, const char **argv, const char *prefix) { struct rev_info rev; git_config(git_log_config, NULL); if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; init_revisions(&rev, prefix); rev.diff = 1; rev.simplify_history = 0; cmd_log_init(argc, argv, prefix, &rev); if (!rev.diffopt.output_format) rev.diffopt.output_format = DIFF_FORMAT_RAW; return cmd_log_walk(&rev); }
int cmd_log(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct setup_revision_opt opt; init_log_defaults(); git_config(git_log_config, NULL); init_revisions(&rev, prefix); rev.always_show_header = 1; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; opt.revarg_opt = REVARG_COMMITTISH; opt.tweak = log_setup_revisions_tweak; cmd_log_init(argc, argv, prefix, &rev, &opt); return cmd_log_walk(&rev); }
int cmd_whatchanged(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct setup_revision_opt opt; git_config(git_log_config, NULL); init_revisions(&rev, prefix); rev.diff = 1; rev.simplify_history = 0; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; cmd_log_init(argc, argv, prefix, &rev, &opt); if (!rev.diffopt.output_format) rev.diffopt.output_format = DIFF_FORMAT_RAW; return cmd_log_walk(&rev); }
int cmd_show(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct object_array_entry *objects; int i, count, ret = 0; git_config(git_log_config, NULL); if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; init_revisions(&rev, prefix); rev.diff = 1; rev.combine_merges = 1; rev.dense_combined_merges = 1; rev.always_show_header = 1; rev.ignore_merges = 0; rev.no_walk = 1; cmd_log_init(argc, argv, prefix, &rev); count = rev.pending.nr; objects = rev.pending.objects; for (i = 0; i < count && !ret; i++) { struct object *o = objects[i].item; const char *name = objects[i].name; switch (o->type) { case OBJ_BLOB: ret = show_object(o->sha1, 0, NULL); break; case OBJ_TAG: { struct tag *t = (struct tag *)o; if (rev.shown_one) putchar('\n'); printf("%stag %s%s\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_object(o->sha1, 1, &rev); rev.shown_one = 1; if (ret) break; o = parse_object(t->tagged->sha1); if (!o) ret = error("Could not read object %s", sha1_to_hex(t->tagged->sha1)); objects[i].item = o; i--; break; } case OBJ_TREE: if (rev.shown_one) putchar('\n'); printf("%stree %s%s\n\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), name, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); read_tree_recursive((struct tree *)o, "", 0, 0, NULL, show_tree_object, NULL); rev.shown_one = 1; break; case OBJ_COMMIT: rev.pending.nr = rev.pending.alloc = 0; rev.pending.objects = NULL; add_object_array(o, name, &rev.pending); ret = cmd_log_walk(&rev); break; default: ret = error("Unknown type: %d", o->type); } } free(objects); return ret; }
int cmd_show(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct object_array_entry *objects; struct setup_revision_opt opt; struct pathspec match_all; int i, count, ret = 0; git_config(git_log_config, NULL); init_pathspec(&match_all, NULL); init_revisions(&rev, prefix); rev.diff = 1; rev.always_show_header = 1; rev.no_walk = 1; rev.diffopt.stat_width = -1; /* Scale to real terminal size */ memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; opt.tweak = show_rev_tweak_rev; cmd_log_init(argc, argv, prefix, &rev, &opt); if (!rev.no_walk) return cmd_log_walk(&rev); count = rev.pending.nr; objects = rev.pending.objects; for (i = 0; i < count && !ret; i++) { struct object *o = objects[i].item; const char *name = objects[i].name; switch (o->type) { case OBJ_BLOB: ret = show_blob_object(o->sha1, NULL); break; case OBJ_TAG: { struct tag *t = (struct tag *)o; if (rev.shown_one) putchar('\n'); printf("%stag %s%s\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_tag_object(o->sha1, &rev); rev.shown_one = 1; if (ret) break; o = parse_object(t->tagged->sha1); if (!o) ret = error(_("Could not read object %s"), sha1_to_hex(t->tagged->sha1)); objects[i].item = o; i--; break; } case OBJ_TREE: if (rev.shown_one) putchar('\n'); printf("%stree %s%s\n\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), name, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); read_tree_recursive((struct tree *)o, "", 0, 0, &match_all, show_tree_object, NULL); rev.shown_one = 1; break; case OBJ_COMMIT: rev.pending.nr = rev.pending.alloc = 0; rev.pending.objects = NULL; add_object_array(o, name, &rev.pending); ret = cmd_log_walk(&rev); break; default: ret = error(_("Unknown type: %d"), o->type); } } free(objects); return ret; }