git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] sh-setup: Write a new require_clean_work_tree function

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 26, 2010, 16:28 UTC
Message-ID
<vpqmxr4piyf.fsf@bauges.imag.fr>
In-Reply-To
<1285514516-5112-2-git-send-email-artagnon@gmail.com>
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/
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 7 of 12 in “What exactly does 'needs update' mean?”
  1. Joshua JensenSep 25, 2010
  2. Junio C HamanoSep 25, 2010
  3. Joshua JensenSep 25, 2010
  4. Joshua JensenSep 25, 2010
  5. 0/2 Eliminate cryptic "needs update" error messageRamkumar Ramachandra, Sep 26, 2010
  6. 1/2 sh-setup: Write a new require_clean_work_tree functionRamkumar Ramachandra, Sep 26, 2010
  7. Matthieu MoySep 26, 2010
  8. Ramkumar RamachandraSep 26, 2010
  9. Matthieu MoySep 26, 2010
  10. Ramkumar RamachandraSep 26, 2010
  11. 2/2 Porcelain scripts: Rewrite cryptic "needs update" error messageRamkumar Ramachandra, Sep 26, 2010
  12. Matthieu MoySep 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.