1 /* Copyright (c) 2006-2013 Jonas Fonseca <fonseca@diku.dk>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
18 * Argv-style git command macros.
21 #define GIT_DIFF_INITIAL(encoding_arg, cached_arg, context_arg, space_arg, old_name, new_name) \
22 "git", "diff", (encoding_arg), "--no-color", "--patch-with-stat", \
23 (cached_arg), (context_arg), (space_arg), "--", (old_name), (new_name), NULL
25 #define GIT_DIFF_STAGED_INITIAL(encoding_arg, context_arg, space_arg, new_name) \
26 GIT_DIFF_INITIAL(encoding_arg, "--cached", context_arg, space_arg, "", new_name)
28 #define GIT_DIFF_STAGED(encoding_arg, context_arg, space_arg, old_name, new_name) \
29 "git", "diff-index", (encoding_arg), "--root", "--patch-with-stat", "-C", "-M", \
30 "--cached", (context_arg), (space_arg), "HEAD", "--", (old_name), (new_name), NULL
32 #define GIT_DIFF_UNSTAGED(encoding_arg, context_arg, space_arg, old_name, new_name) \
33 "git", "diff-files", (encoding_arg), "--root", "--patch-with-stat", "-C", "-M", \
34 (context_arg), (space_arg), "--", (old_name), (new_name), NULL
36 /* Don't show staged unmerged entries. */
37 #define GIT_DIFF_STAGED_FILES(output_arg) \
38 "git", "diff-index", (output_arg), "--diff-filter=ACDMRTXB", "-M", "--cached", "HEAD", NULL
40 #define GIT_DIFF_UNSTAGED_FILES(output_arg) \
41 "git", "diff-files", (output_arg), NULL
43 #define GIT_DIFF_BLAME(encoding_arg, context_arg, space_arg, new_name) \
44 GIT_DIFF_UNSTAGED(encoding_arg, context_arg, space_arg, "", new_name)
46 #define GIT_DIFF_BLAME_NO_PARENT(encoding_arg, context_arg, space_arg, new_name) \
47 GIT_DIFF_INITIAL(encoding_arg, "", context_arg, space_arg, "/dev/null", new_name)
49 #define GIT_MAIN_LOG(encoding_arg, diffargs, revargs, fileargs) \
50 "git", "log", (encoding_arg), \
51 opt_commit_order_arg, (diffargs), (revargs), \
52 "--no-color", "--pretty=raw", "--parents", \
53 "--", (fileargs), NULL
55 /* FIXME(jfonseca): This is incomplete, but enough to support:
56 * git rev-list --author=vivien HEAD | tig --stdin --no-walk */
57 #define GIT_REV_FLAGS \
58 "--stdin", "--no-walk"
62 /* vim: set ts=8 sw=8 noexpandtab: */