[PATCH 0/3] git-rev-list libification effort: the next stage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, the following three patches that I'll send out are still pretty rough, 
but they actually get us to the first real point of this whole exercise: 
writing one of the trivial git helper scripts in C.

In particular, at the end, we have "git log" being implemented as this 
trivial C function:

	#define LOGSIZE (65536)

	static int cmd_log(int argc, char **argv, char **envp)
	{
		struct rev_info rev;
		struct commit *commit;
		char *buf = xmalloc(LOGSIZE);

		argc = setup_revisions(argc, argv, &rev, "HEAD");
		prepare_revision_walk(&rev);
		setup_pager();
		while ((commit = get_revision(&rev)) != NULL) {
			pretty_print_commit(CMIT_FMT_DEFAULT, commit, ~0, buf, LOGSIZE, 18);
			printf("%s\n", buf);
		}
		free(buf);
		return 0;
	}

which is actually a pretty good example of what I wanted to do.  It's
not perfect yet (it doesn't parse the "--pretty=xxx" option yet, nor the
"--since" and "--until" dates, for example), but I think this is all
going in the right direction. 

			Linus
-
: 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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]