diff mbox series

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

Message ID 77ca4656ed442321b41e653505c85d0be31b8045.1607223276.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series diffcore-rename improvements | expand

Commit Message

Elijah Newren Dec. 6, 2020, 2:54 a.m. UTC
From: Elijah Newren <newren@gmail.com>

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.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 diffcore-rename.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Junio C Hamano Dec. 10, 2020, 2:29 a.m. UTC | #1
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Elijah Newren <newren@gmail.com>
>
> 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.

> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>  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);
>  		}
diff mbox series

Patch

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);
 		}