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

[PATCH 1/2] git-sh-setup: make require_clean_work_tree part of the interface

From
Thomas Rast <trast@student.ethz.ch>
Date
Dec 20, 2011, 11:09 UTC
Message-ID
<c53feb0de8006c205fd26c2c07dcd78bd86b6c24.1324378986.git.trast@student.ethz.ch>

92c62a3 (Porcelain scripts: Rewrite cryptic "needs update" error message, 2010-10-19) refactored git's own checking to a function in git-sh-setup. This is a very useful thing for script writers, so document it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Noticed while helping ribasushi on IRC.
 Documentation/git-sh-setup.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt
index a2f346c..bbfefca 100644
--- a/Documentation/git-sh-setup.txt
+++ b/Documentation/git-sh-setup.txt
@@ -68,6 +68,15 @@ require_work_tree_exists::
 	cd_to_toplevel, which is impossible to do if there is no
 	working tree.
 
+require_clean_work_tree <action> [<hint>]::
+	checks if the working tree associated with the repository is
+	clean.  Otherwise it emits an error message of the form
+	`Cannot <action>: <reason>. <hint>`, and dies.  Example:
++
+----------------
+require_clean_work_tree rebase "Please commit or stash them."
+----------------
+
 get_author_ident_from_commit::
 	outputs code for use with eval to set the GIT_AUTHOR_NAME,
 	GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.
-- 
1.7.8.484.gdad4270
Next: Thomas Rast
Message 1 of 10 in “git-sh-setup: make require_clean_work_tree part of the interface”
  1. 1/2 git-sh-setup: make require_clean_work_tree part of the interfaceThomas Rast, Dec 20, 2011
  2. 2/2 Documentation: make git-sh-setup docs less scaryThomas Rast, Dec 20, 2011
  3. Junio C HamanoDec 20, 2011
  4. Ævar Arnfjörð BjarmasonDec 20, 2011
  5. Thomas RastDec 20, 2011
  6. Junio C HamanoDec 20, 2011
  7. git-sh-setup: make require_clean_work_tree part of the interfaceThomas Rast, Dec 20, 2011
  8. Junio C HamanoDec 20, 2011
  9. git-sh-setup: make require_clean_work_tree part of the interfaceThomas Rast, Dec 20, 2011
  10. Junio C HamanoDec 20, 2011

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.