git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use macro define to replace magic character

From
ZLZheng Liu <gnehzuil.liu@gmail.com>
Date
Nov 18, 2011, 01:43 UTC
Message-ID
<1321580586-19247-1-git-send-email-wenqing.lz@taobao.com>
We should use macro define rather than magic character to make more readable
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 merge-recursive.c |    2 +-
 tree-diff.c       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index cc664c3..96457bc 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -503,7 +503,7 @@ static struct string_list *get_renames(struct merge_options *o,
 		struct string_list_item *item;
 		struct rename *re;
 		struct diff_filepair *pair = diff_queued_diff.queue[i];
-		if (pair->status != 'R') {
+		if (pair->status != DIFF_STATUS_RENAMED) {
 			diff_free_filepair(pair);
 			continue;
 		}
diff --git a/tree-diff.c b/tree-diff.c
index b3cc2e4..d52c440 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -225,7 +225,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
 		 * diff_queued_diff, we will also use that as the path in
 		 * the future!
 		 */
-		if ((p->status == 'R' || p->status == 'C') &&
+		if ((p->status == DIFF_STATUS_RENAMED || p->status == DIFF_STATUS_COPIED) &&
 		    !strcmp(p->two->path, opt->pathspec.raw[0])) {
 			/* Switch the file-pairs around */
 			q->queue[i] = choice;
-- 
1.7.5.4
Message 1 of 1 in “Use macro define to replace magic character”
  1. Use macro define to replace magic characterZheng Liu, Nov 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.