I'm trying to run two different 'diffs' in the same C program, and the results of the second diff depend on whether or not the first diff has run. A minimal case is below. When show_updated() is run, show_changed() results in all files listed as "unmerged". If show_updated() is commented out, the output for show_changed() is as expected. -- >8 -- #include "cache.h" #include "object.h" #include "commit.h" #include "diff.h" #include "revision.h" void show_updated() { struct rev_info rev; const char *argv[] = { NULL, "HEAD", NULL }; init_revisions(&rev, NULL); setup_revisions(2, argv, &rev, NULL); rev.diffopt.output_format = DIFF_FORMAT_NAME_STATUS; run_diff_index(&rev, 1); } void show_changed() { struct rev_info rev; const char *argv[] = { NULL, NULL }; init_revisions(&rev, NULL); setup_revisions(1, argv, &rev, NULL); rev.diffopt.output_format = DIFF_FORMAT_NAME_STATUS; run_diff_files(&rev, 0); } int main(int argc, char **argv) { printf("updated:\n"); show_updated(); printf("changed:\n"); show_changed(); return 0; } -- >8 -- It seems clear that there's some global magic touched by the first diff that impacts the second. I have to give up on finding it for tonight, but I'm hoping somebody who knows more about the code will find it obvious (or can tell me that I'm doing something else horribly wrong in the above, or that these functions were never intended to be called within the same program). -Peff - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html