[PATCH] diffcore-order: Default the order file to .git/info/order.
From: Geoffrey Thomas <hidden>
Date: 2016-06-15 22:47:23
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Geoffrey Thomas <hidden>
Date: 2016-06-15 22:47:23
Subsystem:
the rest · Maintainer:
Linus Torvalds
Since order files tend to be useful for all operations in the project/repository, add a default location for the order file, so that you don't have to specify -O<orderfile> on every diff or similar operation. Signed-off-by: Geoffrey Thomas <redacted> --- diff.c | 3 +-- diffcore-order.c | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c
index e1be189..148342c 100644
--- a/diff.c
+++ b/diff.c@@ -3461,8 +3461,7 @@ void diffcore_std(struct diff_options *options) diffcore_merge_broken(); if (options->pickaxe) diffcore_pickaxe(options->pickaxe, options->pickaxe_opts); - if (options->orderfile) - diffcore_order(options->orderfile); + diffcore_order(options->orderfile); diff_resolve_rename_copy(); diffcore_apply_filter(options->filter);
diff --git a/diffcore-order.c b/diffcore-order.c
index 23e9385..d116dc9 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c@@ -109,6 +109,12 @@ void diffcore_order(const char *orderfile) if (!q->nr) return; + if (!orderfile) { + orderfile = git_path("info/order"); + if (access(orderfile, R_OK) != 0) + return; + } + o = xmalloc(sizeof(*o) * q->nr); prepare_order(orderfile); for (i = 0; i < q->nr; i++) {
--
1.5.6.5