[RFC variant 2 of 2] "needs update" considered harmful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"git update-index --refresh", "git reset" and "git add --refresh" have
reported paths that have local modifications as "needs update" since the
beginning of git.

Although this is logically correct in that you need to update the index at
that path before you can commit that change, it is now becoming more and
more clear, especially with the continuous push for user friendliness
since 1.5.0 series, that the message is suboptimal.  After all, the change
may be something the user might want to get rid of, and "updating" would
be absolutely a wrong thing to do if that is the case.

I prepared two alternatives to solve this.  Both aim to reword the message
to more neutral "locally modified".

This patch is a more straightforward variant that changes the message not
only for Porcelain commands ("add" and "reset") but also changes the
output from the plumbing command "update-index".

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 read-cache.c                           |    2 +-
 t/t2103-update-index-ignore-missing.sh |    2 +-
 t/t7102-reset.sh                       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index f83de8c..d37aec0 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1019,7 +1019,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
 			}
 			if (quiet)
 				continue;
-			printf("%s: needs update\n", ce->name);
+			printf("%s: locally modified\n", ce->name);
 			has_errors = 1;
 			continue;
 		}
diff --git a/t/t2103-update-index-ignore-missing.sh b/t/t2103-update-index-ignore-missing.sh
index 4fbf855..f775acb 100755
--- a/t/t2103-update-index-ignore-missing.sh
+++ b/t/t2103-update-index-ignore-missing.sh
@@ -62,7 +62,7 @@ test_expect_success '--unmerged --refresh' '
 	test_must_fail git update-index --refresh &&
 	git update-index --unmerged --refresh &&
 	echo 2 >two &&
-	echo "two: needs update" >expect &&
+	echo "two: locally modified" >expect &&
 	test_must_fail git update-index --unmerged --refresh >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 96d1508..da4b142 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -419,7 +419,7 @@ test_expect_success 'resetting an unmodified path is a no-op' '
 '
 
 cat > expect << EOF
-file2: needs update
+file2: locally modified
 EOF
 
 test_expect_success '--mixed refreshes the index' '
-- 
1.5.6.4.570.g052e6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux