Commit 364d800b018325914ac01cb5f1b06beb1cab528f

Ben Straub 2013-10-10T14:53:07

Move flag dependencies into docs and code.

diff --git a/include/git2/blame.h b/include/git2/blame.h
index fe51371..b98c6f0 100644
--- a/include/git2/blame.h
+++ b/include/git2/blame.h
@@ -33,13 +33,13 @@ typedef enum {
 	 * NOT IMPLEMENTED. */
 	GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
 	/** Track lines that have been copied from another file that exists in the
-	 * same commit (like `git blame -CC`).
+	 * same commit (like `git blame -CC`). Implies SAME_FILE.
 	 * NOT IMPLEMENTED. */
-	GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<1 | 1<<2),
+	GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
 	/** Track lines that have been copied from another file that exists in *any*
-	 * commit (like `git blame -CCC`).
+	 * commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
 	 * NOT IMPLEMENTED. */
-	GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<1 | 1<<2 | 1<<3),
+	GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
 } git_blame_flag_t;
 
 /**
diff --git a/src/blame.c b/src/blame.c
index 5b0ebd4..e698d39 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -184,6 +184,14 @@ static void normalize_options(
 	/* min_line 0 really means 1 */
 	if (!out->min_line) out->min_line = 1;
 	/* max_line 0 really means N, but we don't know N yet */
+
+	/* Fix up option implications */
+	if (out->flags & GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES)
+		out->flags |= GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES;
+	if (out->flags & GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES)
+		out->flags |= GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES;
+	if (out->flags & GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES)
+		out->flags |= GIT_BLAME_TRACK_COPIES_SAME_FILE;
 }
 
 static git_blame_hunk *split_hunk_in_vector(