All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Joshua Jensen <jjensen@workspacewhiz.com>
Subject: Re: [PATCH 1/2] sh-setup: Write a new require_clean_work_tree function
Date: Sun, 26 Sep 2010 18:28:56 +0200	[thread overview]
Message-ID: <vpqmxr4piyf.fsf@bauges.imag.fr> (raw)
In-Reply-To: <1285514516-5112-2-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Sun\, 26 Sep 2010 20\:51\:55 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> +	then
> +		echo >&2 "cannot $1: you have unstaged changes."
> +		echo >&2 "Please commit or stash them."
> +		git diff-files --name-status -r --ignore-submodules -- >&2

I totally agree on the idea, and the implementation is OK. On the
format of the message, you can try to make it more consistent with
other error messages, like:

$ git merge branch
error: The following untracked working tree files would be overwritten by merge:
        one
	two
Please move or remove them before you can merge.

That would give stg like:

echo >&2 "error: The following files have unstaged changes:"
git diff-files --name-status -r --ignore-submodules -- >&2
echo >&2 "Please commit or stash them to proceed."

(same for the second case)

Also, you probably want to give all the error before you "exit 1",
hence stg like:

error=f
...
if
then
	...
	error=t
fi

if
then
	...
	error=t
fi

if [ "$error" = "t" ]; then
	exit 1
fi

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2010-09-26 16:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25  5:18 What exactly does 'needs update' mean? Joshua Jensen
2010-09-25  6:06 ` Junio C Hamano
2010-09-25 14:16   ` Joshua Jensen
2010-09-25 14:31     ` Joshua Jensen
2010-09-26 15:21       ` [PATCH 0/2] Eliminate cryptic "needs update" error message Ramkumar Ramachandra
2010-09-26 15:21       ` [PATCH 1/2] sh-setup: Write a new require_clean_work_tree function Ramkumar Ramachandra
2010-09-26 16:28         ` Matthieu Moy [this message]
2010-09-26 17:39           ` Ramkumar Ramachandra
2010-09-26 18:46             ` Matthieu Moy
2010-09-26 18:51               ` Ramkumar Ramachandra
2010-09-26 15:21       ` [PATCH 2/2] Porcelain scripts: Rewrite cryptic "needs update" error message Ramkumar Ramachandra
2010-09-26 16:31         ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqmxr4piyf.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jjensen@workspacewhiz.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.