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

[PATCH] Mark 'git stash [message...]' as deprecated

From
Brian Downing <bdowning@lavos.net>
Date
Nov 7, 2007, 00:26 UTC
Message-ID
<1194395205-27905-1-git-send-email-bdowning@lavos.net>
In-Reply-To
<20071106085134.GD4435@artemis.corp>

Complain to STDERR unless 'git stash save' is explicitly used. This is in preparation for completely disabling the "default save" behavior of the command in the future.

Signed-off-by: Brian Downing <bdowning@lavos.net>
---
 Documentation/git-stash.txt |    9 ++++-----
 git-stash.sh                |    8 +++++++-
 t/t3903-stash.sh            |   14 +++++++++++++-
 3 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index c0147b9..61cf95d 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git-stash' (list | show [<stash>] | apply [<stash>] | clear)
-'git-stash' [save] [message...]
+'git-stash' save [message...]
 
 DESCRIPTION
 -----------
@@ -39,8 +39,7 @@ OPTIONS
 save::
 
 	Save your local modifications to a new 'stash', and run `git-reset
-	--hard` to revert them.  This is the default action when no
-	subcommand is given.
+	--hard` to revert them.
 
 list::
 
@@ -119,7 +118,7 @@ perform a pull, and then unstash, like this:
 $ git pull
 ...
 file foobar not up to date, cannot merge.
-$ git stash
+$ git stash save
 $ git pull
 $ git stash apply
 ----------------------------------------------------------------
@@ -147,7 +146,7 @@ You can use `git-stash` to simplify the above, like this:
 +
 ----------------------------------------------------------------
 ... hack hack hack ...
-$ git stash
+$ git stash save
 $ edit emergency fix
 $ git commit -a -m "Fix in a hurry"
 $ git stash apply
diff --git a/git-stash.sh b/git-stash.sh
index f39bd55..a8b854a 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright (c) 2007, Nanako Shiraishi
 
-USAGE='[ | list | show | apply | clear]'
+USAGE='[save | list | show | apply | clear]'
 
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
@@ -223,6 +223,12 @@ help | usage)
 	if test $# -gt 0 && test "$1" = save
 	then
 		shift
+	else
+		cat >&2 <<EOF
+'git stash [message...]' is deprecated, please use
+'git stash save [message...]' instead.
+
+EOF
 	fi
 	save_stash "$*" && git-reset --hard
 	;;
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 9a9a250..adfac4b 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -16,7 +16,7 @@ test_expect_success 'stash some dirty working directory' '
 	git add file &&
 	echo 3 > file &&
 	test_tick &&
-	git stash &&
+	git stash save &&
 	git diff-files --quiet &&
 	git diff-index --cached --quiet HEAD
 '
@@ -73,4 +73,16 @@ test_expect_success 'unstashing in a subdirectory' '
 	git stash apply
 '
 
+test_expect_success 'stash with no args' '
+	echo 7 > file &&
+	test_tick &&
+	git stash
+'
+
+test_expect_success 'stash with bare message' '
+	echo 8 > file &&
+	test_tick &&
+	git stash "a message"
+'
+
 test_done
-- 
1.5.3.5.1547.gf6d81-dirty
Previous: Pierre HabouzitNext: Brian Downing
Message 35 of 43 in “git pull opinion”
  1. AghilesNov 5, 2007
  2. Jakub NarebskiNov 5, 2007
  3. Johannes SchindelinNov 6, 2007
  4. AghilesNov 6, 2007
  5. Johannes SchindelinNov 6, 2007
  6. Junio C HamanoNov 6, 2007
  7. Johannes SchindelinNov 6, 2007
  8. Alex RiesenNov 5, 2007
  9. Junio C HamanoNov 5, 2007
  10. Bill LearNov 6, 2007
  11. Pierre HabouzitNov 6, 2007
  12. Alex RiesenNov 6, 2007
  13. Pierre HabouzitNov 6, 2007
  14. Andreas EricssonNov 6, 2007
  15. Johannes SchindelinNov 6, 2007
  16. Andreas EricssonNov 6, 2007
  17. Johannes SchindelinNov 6, 2007
  18. Andreas EricssonNov 6, 2007
  19. AghilesNov 6, 2007
  20. Alex RiesenNov 6, 2007
  21. Linus TorvaldsNov 6, 2007
  22. AghilesNov 7, 2007
  23. Johannes SchindelinNov 8, 2007
  24. Linus TorvaldsNov 10, 2007
  25. Steven GrimmNov 6, 2007
  26. AghilesNov 6, 2007
  27. Miklos VajnaNov 5, 2007
  28. AghilesNov 6, 2007
  29. Benoit SigoureNov 6, 2007
  30. Ralf WildenhuesNov 6, 2007
  31. Johannes SchindelinNov 6, 2007
  32. Ralf WildenhuesNov 6, 2007
  33. AghilesNov 6, 2007
  34. Pierre HabouzitNov 6, 2007
  35. Mark 'git stash [message...]' as deprecatedBrian Downing, Nov 7, 2007
  36. Disable implicit 'save' argument for 'git stash'Brian Downing, Nov 7, 2007
  37. Johannes SixtNov 7, 2007
  38. Wincent ColaiutaNov 7, 2007
  39. Junio C HamanoNov 7, 2007
  40. Pierre HabouzitNov 7, 2007
  41. Pascal ObryNov 6, 2007
  42. Uwe Kleine-KönigNov 7, 2007
  43. Pascal ObryNov 7, 2007

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.