diff options
| author | Juan Rubén <juanruben.segovia@gmail.com> | 2014-02-21 00:22:07 +0100 |
|---|---|---|
| committer | Juan Rubén <juanruben.segovia@gmail.com> | 2014-02-23 23:26:12 +0100 |
| commit | c7c833947ec7ac446761242c02d32916661daeb7 (patch) | |
| tree | 226a4eb8de0a1366ac04ab921411847693c11581 /examples | |
| parent | e0ebaaa53ea1154a1f392dae463453ac6c428d78 (diff) | |
| download | libgit2-c7c833947ec7ac446761242c02d32916661daeb7.tar.gz | |
Add option to limit blame to first parent
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/blame.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/blame.c b/examples/blame.c index 1f5db69a1..f04c41772 100644 --- a/examples/blame.c +++ b/examples/blame.c @@ -31,6 +31,7 @@ struct opts { int M; int start_line; int end_line; + int F; }; static void parse_opts(struct opts *o, int argc, char *argv[]); @@ -52,6 +53,7 @@ int main(int argc, char *argv[]) parse_opts(&o, argc, argv); if (o.M) blameopts.flags |= GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES; if (o.C) blameopts.flags |= GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES; + if (o.F) blameopts.flags |= GIT_BLAME_FIRST_PARENT; /** Open the repository. */ check_lg2(git_repository_open_ext(&repo, ".", 0, NULL), "Couldn't open repository", NULL); @@ -146,6 +148,7 @@ static void usage(const char *msg, const char *arg) fprintf(stderr, " -L <n,m> process only line range n-m, counting from 1\n"); fprintf(stderr, " -M find line moves within and across files\n"); fprintf(stderr, " -C find line copies within and across files\n"); + fprintf(stderr, " -F only care about the first parent\n"); fprintf(stderr, "\n"); exit(1); } @@ -174,6 +177,8 @@ static void parse_opts(struct opts *o, int argc, char *argv[]) o->M = 1; else if (!strcasecmp(a, "-C")) o->C = 1; + else if (!strcasecmp(a, "-F")) + o->F = 1; else if (!strcasecmp(a, "-L")) { i++; a = argv[i]; if (i >= argc) fatal("Not enough arguments to -L", NULL); |
