File tools/diff/diff.cpp changed (mode: 100644) (index 2d804b8..4fc146a) |
... |
... |
run(Environment &env, const Args &args) |
196 |
196 |
static int |
static int |
197 |
197 |
gitFallback(const Args &args) |
gitFallback(const Args &args) |
198 |
198 |
{ |
{ |
|
199 |
|
std::cout << "Parsing has failed, falling back to `git diff`\n"; |
|
200 |
|
|
|
201 |
|
// Print only a header by passing in an empty tree. |
|
202 |
|
Node n; |
|
203 |
|
std::unique_ptr<Language> l = Language::create(args.pos[0]); |
|
204 |
|
Printer printer(n, n, *l, std::cout); |
|
205 |
|
printer.addHeader({ args.pos[3], args.pos[6] }); |
|
206 |
|
printer.addHeader({ "a/" + args.pos[0], "b/" + args.pos[0] }); |
|
207 |
|
TimeReport tr; |
|
208 |
|
printer.print(tr); |
|
209 |
|
|
|
210 |
|
std::cout.flush(); |
|
211 |
|
|
199 |
212 |
if (args.pos[5] == std::string(40U, '0')) { |
if (args.pos[5] == std::string(40U, '0')) { |
200 |
213 |
execlp("git", "git", "diff", "--no-ext-diff", args.pos[2].c_str(), |
execlp("git", "git", "diff", "--no-ext-diff", args.pos[2].c_str(), |
201 |
214 |
"--", args.pos[0].c_str(), static_cast<char *>(nullptr)); |
"--", args.pos[0].c_str(), static_cast<char *>(nullptr)); |