threads / patch / 20922

patchdiffcore-order: Default the order file to .git/info/order.

Subject: [PATCH] diffcore-order: Default the order file to .git/info/order.

## tl;dr

One message between Sep 12, 2009 and Sep 12, 2009. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Geoffrey Thomas· Sep 12, 2009, 23:49 UTC · lore

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 <geofft@mit.edu>
---
 diff.c           |    3 +--
 diffcore-order.c |    6 ++++++
 2 files changed, 7 insertions(+), 2 deletions(-)
Show changes to 2 files +7 −2

diff.c, diffcore-order.c

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

← back to recent threads