Re: What's cooking in git.git (topics)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 2, 2007, 17:44 UTC
- Message-ID
- <7vd4vxmmxr.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <vpqr6keos6e.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> 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'.
Show 13 quoted lines
> 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
Show 6 quoted lines
> + 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"