Thread (1 message) 1 message, 1 author, 2020-12-10

Re: [PATCH 4/7] diffcore-rename: change a few comments to use 'add' instead of 'create'

From: Junio C Hamano <hidden>
Date: 2020-12-10 02:30:08

"Elijah Newren via GitGitGadget" [off-list ref] writes:
From: Elijah Newren <redacted>

As with the last commit, it feels odd to talk about "creation" (which to
me implies a brand new file, i.e. one not associated with an existing
file, and thus one that could not have been a rename) when we are using
the files to look for renames.  Use the term "addition" instead.
Hmph, to me "create" and "add" mean the same thing in all the
sentences this patch updates.

We first notice the differences in two trees, some paths have
contents in both trees so they cannot be creation or deletion.  Some
paths only exist in one of the trees and they are initially labelled
as "created" or "deleted".  If there were no request by the caller
to detect renames, then that's the end of the story.

Only after we match up a path in the new tree that did not exist in
the old tree with another path in the old tree that no longer exists
in the new tree, what initially got labelled as creation of one and
deletion of another may become a rename.

And in the above two paragraphs, if I replace "to create" with "to
add" and "to delete" with "to remove", I do not see how the story
becomes more natural or logical or intuitive.  Perhaps I am not
getting the subtle difference you find in these two words?  This
looks like a totally meaningless churn to me.
quoted hunk
Signed-off-by: Elijah Newren <redacted>
---
 diffcore-rename.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 655a67759c8..7270eb6af48 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -173,7 +173,7 @@ static int estimate_similarity(struct repository *r,
 {
 	/* src points at a file that existed in the original tree (or
 	 * optionally a file in the destination tree) and dst points
-	 * at a newly created file.  They may be quite similar, in which
+	 * at a newly added file.  They may be quite similar, in which
 	 * case we want to say src is renamed to dst or src is copied into
 	 * dst, and then some edit has been applied to dst.
 	 *
@@ -652,9 +652,9 @@ void diffcore_rename(struct diff_options *options)
 		}
 		else if (!DIFF_FILE_VALID(p->one) && DIFF_FILE_VALID(p->two)) {
 			/*
-			 * Creation
+			 * Addition
 			 *
-			 * We would output this create record if it has
+			 * We would output this add record if it has
 			 * not been turned into a rename/copy already.
 			 */
 			struct diff_rename_dst *dst = locate_rename_dst(p->two);
@@ -664,7 +664,7 @@ void diffcore_rename(struct diff_options *options)
 			}
 			else
 				/* no matching rename/copy source, so
-				 * record this as a creation.
+				 * record this as an addition.
 				 */
 				diff_q(&outq, p);
 		}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help