hg diffとgit diffの出力の違い
hg diff:
% hg diff diff --git a/p.c b/p.c --- a/p.c +++ b/p.c @@ -1,26 +1,25 @@ #include <stdio.h> +int fib(int n) +{ + if(n > 2) + { + return fib(n-1) + fib(n-2); + } + return 1; +} + // Frobs foo heartily int frobnitz(int foo) { int i; for(i = 0; i < 10; i++) { - printf("Your answer is: "); printf("%d\n", foo); } } -int fact(int n) -{ - if(n > 1) - { - return fact(n-1) * n; - } - return 1; -} - int main(int argc, char **argv) { - frobnitz(fact(10)); + frobnitz(fib(10)); }
git diff:
diff --git a/p.c b/p.c index 6faa5a3..e3af329 100644 --- a/p.c +++ b/p.c @@ -1,26 +1,25 @@ #include <stdio.h> -// Frobs foo heartily -int frobnitz(int foo) +int fib(int n) { - int i; - for(i = 0; i < 10; i++) + if(n > 2) { - printf("Your answer is: "); - printf("%d\n", foo); + return fib(n-1) + fib(n-2); } + return 1; } -int fact(int n) +// Frobs foo heartily +int frobnitz(int foo) { - if(n > 1) + int i; + for(i = 0; i < 10; i++) { - return fact(n-1) * n; + printf("%d\n", foo); } - return 1; } int main(int argc, char **argv) { - frobnitz(fact(10)); + frobnitz(fib(10)); }
git diff --patience:
diff --git a/p.c b/p.c index 6faa5a3..e3af329 100644 --- a/p.c +++ b/p.c @@ -1,26 +1,25 @@ #include <stdio.h> +int fib(int n) +{ + if(n > 2) + { + return fib(n-1) + fib(n-2); + } + return 1; +} + // Frobs foo heartily int frobnitz(int foo) { int i; for(i = 0; i < 10; i++) { - printf("Your answer is: "); printf("%d\n", foo); } } -int fact(int n) -{ - if(n > 1) - { - return fact(n-1) * n; - } - return 1; -} - int main(int argc, char **argv) { - frobnitz(fact(10)); + frobnitz(fib(10)); }