Re: What's cooking in git.git (topics)
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:37
Matthieu Moy [off-list ref] writes:
I'd add this to be consistant with "git status". I find the "needs update" really short, and especially confusing for centralized systems users, for whom "needs update" would probably mean "new version available, please run '$VCS update'".
Yeah, and "needs merge" solicits 'SCM merge'.
quoted hunk
diff --git a/read-cache.c b/read-cache.c index 2e40a34..3745a48 100644 --- a/read-cache.c +++ b/read-cache.c@@ -869,7 +869,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: Changed but not updated\n", ce->name); has_errors = 1; continue; }
I tried to stay away from touching that part on purpose. Doing this unconditionally may break people's existing scripts that use update-index --refresh plumbing. We could introduce a new option to "update-index --refresh" that makes the output more machine readable by either NUL terminating or c_quoting ce->name to protect the caller from potential spaces and newlines in the name, and use that from the caller. But for this particular case, I think a much simpler alternative would be to do it this way:
# The tree must be really really clean.
-git update-index --refresh || exit
+git update-index -q --refresh || {+ git status
+ printf "cannot rebase: the work tree is not clean.\n" + exit 1 +} diff=$(git diff-index --cached --name-status -r HEAD) case "$diff" in ?*) echo "cannot rebase: your index is not up-to-date"