git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH try2 14/14] completion: update 'git reset' new stage options
@ 2013-10-12  7:04 Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 04/14] grep: add --staged option Felipe Contreras
                   ` (13 more replies)
  0 siblings, 14 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1dde51f..082f207 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2231,7 +2231,8 @@ _git_reset ()
 
 	case "$cur" in
 	--*)
-		__gitcomp "--merge --mixed --hard --soft --patch"
+		__gitcomp "--merge --mixed --hard --soft --patch --keep --merge
+			--stage --no-stage --work --no-work"
 		return
 		;;
 	esac
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 04/14] grep: add --staged option
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 07/14] stash: add --stage to pop and apply Felipe Contreras
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Synonym for --cached.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-grep.txt | 5 ++++-
 builtin/grep.c             | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 8497aa4..9f7899c 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -25,7 +25,7 @@ SYNOPSIS
 	   [-W | --function-context]
 	   [-f <file>] [-e] <pattern>
 	   [--and|--or|--not|(|)|-e <pattern>...]
-	   [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>...]
+	   [ [--[no-]exclude-standard] [--cached | --staged | --no-index | --untracked] | <tree>...]
 	   [--] [<pathspec>...]
 
 DESCRIPTION
@@ -60,6 +60,9 @@ OPTIONS
 	Instead of searching tracked files in the working tree, search
 	blobs registered in the index file.
 
+--staged::
+	Synonym for `--cached`.
+
 --no-index::
 	Search files in the current directory that is not managed by Git.
 
diff --git a/builtin/grep.c b/builtin/grep.c
index d3b3b1d..b953911 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -640,6 +640,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	struct option options[] = {
 		OPT_BOOLEAN(0, "cached", &cached,
 			N_("search in index instead of in the work tree")),
+		OPT_BOOLEAN(0, "staged", &cached,
+			N_("search in index instead of in the work tree")),
 		OPT_NEGBIT(0, "no-index", &use_index,
 			 N_("find in contents not managed by git"), 1),
 		OPT_BOOLEAN(0, "untracked", &untracked,
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 07/14] stash: add --stage to pop and apply
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 04/14] grep: add --staged option Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 00/14] Officially start moving to the term 'staging area' Felipe Contreras
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Synonym of --index.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-stash.txt | 8 ++++----
 git-stash.sh                | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 75b4cc6..b4066fd 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 'git stash' list [<options>]
 'git stash' show [<stash>]
 'git stash' drop [-q|--quiet] [<stash>]
-'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
+'git stash' ( pop | apply ) [--index|--stage] [-q|--quiet] [<stash>]
 'git stash' branch <branchname> [<stash>]
 'git stash' [save [-p|--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]
 	     [-u|--include-untracked] [-a|--all] [<message>]]
@@ -96,7 +96,7 @@ show [<stash>]::
 	it will accept any format known to 'git diff' (e.g., `git stash show
 	-p stash@{1}` to view the second most recent stash in patch form).
 
-pop [--index] [-q|--quiet] [<stash>]::
+pop [--index|--stage] [-q|--quiet] [<stash>]::
 
 	Remove a single stashed state from the stash list and apply it
 	on top of the current working tree state, i.e., do the inverse
@@ -110,12 +110,12 @@ and call `git stash drop` manually afterwards.
 If the `--index` option is used, then tries to reinstate not only the working
 tree's changes, but also the index's ones. However, this can fail, when you
 have conflicts (which are stored in the index, where you therefore can no
-longer apply the changes as they were originally).
+longer apply the changes as they were originally). `--stage` is a synonym.
 +
 When no `<stash>` is given, `stash@{0}` is assumed, otherwise `<stash>` must
 be a reference of the form `stash@{<revision>}`.
 
-apply [--index] [-q|--quiet] [<stash>]::
+apply [--index|--stage] [-q|--quiet] [<stash>]::
 
 	Like `pop`, but do not remove the state from the stash list. Unlike `pop`,
 	`<stash>` may be any commit that looks like a commit created by
diff --git a/git-stash.sh b/git-stash.sh
index 47220d0..e2eb8dc 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -5,7 +5,7 @@ dashless=$(basename "$0" | sed -e 's/-/ /')
 USAGE="list [<options>]
    or: $dashless show [<stash>]
    or: $dashless drop [-q|--quiet] [<stash>]
-   or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
+   or: $dashless ( pop | apply ) [--index|--stage] [-q|--quiet] [<stash>]
    or: $dashless branch <branchname> [<stash>]
    or: $dashless [save [--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]
 		       [-u|--include-untracked] [-a|--all] [<message>]]
@@ -373,7 +373,7 @@ parse_flags_and_rev()
 			-q|--quiet)
 				GIT_QUIET=-t
 			;;
-			--index)
+			--index|--stage)
 				INDEX_OPTION=--index
 			;;
 			-*)
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 00/14] Officially start moving to the term 'staging area'
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 04/14] grep: add --staged option Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 07/14] stash: add --stage to pop and apply Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 10/14] apply: add --work, --no-work options Felipe Contreras
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

tl;dr: everyone except Junio C Hamano and Drew Northup agrees; we should move
away from the name "the index".

It has been discussed many times in the past that 'index' is not an
appropriate description for what the high-level user does with it, and
it has been agreed that 'staging area' is the best term.

The term 'staging area' is more intuitive for newcomers which are more
familiar with English than with Git, and it seems to be a
straightforward mental notion for people with different mother tongues.

In fact it is so intuitive that it's used already in a lot online
documentation, and the people that do teach Git professionally use this
term, because it's easier for many kinds of audiences to grasp.

The meaning of the words 'cache' and 'index' doesn't represent correctly
the mental model of the high-level user:

cache: a 'cache' is a place for easier access; a squirrel caches nuts
so it doesn't have to go looking for them in the future when it might
be much more difficult. Git porcelain is not using the staging area
for easier future access; it's not a cache.

index: an 'index' is a guide of pointers to something else; a book
index has a list of entries so the reader can locate information
easily without having to go through the whole book. Git porcelain is
not using the staging area to find out entries quicker; it's not an
index.

stage: a 'stage' is a special area designated for convenience in order
for some activity to take place; an orator would prepare a stage in
order for her speak to be successful, otherwise many people might not
be able to hear, or see her. Git porcelain is using the staging area
precisely as a special area to be separated from the working directory
for convenience.

The term 'stage' is a good noun itself, but also 'staging area', it
has a good verb; 'to stage', and a nice past-participle; 'staged'.

The first step in moving Git towards this term, is first to add --stage
options for every command that uses --index or --cache. However, there's
a problem with the 'git apply' command, because it treats --index and
--cache differently. Different solutions were proposed, including a
special --stage-only option, however, I think the best solution is a
--[no-]work option to specify if the working directory should be touched
or not, so --index becomes --staged, and --cached becomes --staged
--no-work.

In addition, the 'git stage' command can be extended so the staging area
can be brought closer to the user, like other important Git concepts,
like 'git branch, 'git tag', and 'git remote'. For example, the command
'git stage edit' (which allows the user to edit directly the diff from
HEAD to the staging area) can have a home, where previously there was no
place. It would become natural then to do 'git stage diff', and then
'git stage edit' (to edit the previous diff).

After adding the new --stage options and making sure no functionality is
lost, they can become the recommended ones in the documentation,
eventually, the old ones get deprecated, and eventually obsoleted.

Also, the documentation would need to be updated to replace many
instances of 'the index', with 'the staging area' in porcelain commands.

Moreover, the --stage and --work options also make sense for 'git
reset', and after these options are added, the complicated table to
explain the different behaviors between --soft, --mixed, and --hard
becomes so simple it's not needed any more:

      working stage HEAD target             working stage HEAD
      ----------------------------------------------------
       A       B     C    D     --no-stage  A       B     D
				--stage     A       D     D
				--work      D       D     D

      working stage HEAD target             working stage HEAD
      ----------------------------------------------------
       A       B     C    C     --no-stage  A       B     C
				--stage     A       C     C
				--work      C       C     C

      working stage HEAD target             working stage HEAD
      ----------------------------------------------------
       B       B     C    D     --no-stage  B       B     D
				--stage     B       D     D
				--work      D       D     D

      working stage HEAD target             working stage HEAD
      ----------------------------------------------------
       B       B     C    C     --no-stage  B       B     C
				--stage     B       C     C
				--work      C       C     C

      working stage HEAD target             working stage HEAD
      ----------------------------------------------------
       B       C     C    D     --no-stage  B       C     D
				--stage     B       D     D
				--work      D       D     D

      working stage HEAD target             working stage HEAD
      ----------------------------------------------------
       B       C     C    C     --no-stage  B       C     C
				--stage     B       C     C
				--work      C       C     C

It might be possible to do 'git reset --no-stage --work', to reset the
working directory, but leave the staging area alone.

For more reference about the previous discussions:

http://thread.gmane.org/gmane.comp.version-control.git/197111
http://thread.gmane.org/gmane.comp.version-control.git/166675
http://thread.gmane.org/gmane.comp.version-control.git/115666

Felipe Contreras (14):
  Add proper 'stage' command
  stage: add edit command
  diff: document --staged
  grep: add --staged option
  rm: add --staged option
  stash: add --stage option to save
  stash: add --stage to pop and apply
  submodule: add --staged options
  apply: add --stage option
  apply: add --work, --no-work options
  completion: update --staged options
  reset: add --stage and --work options
  reset: allow --keep with --stage
  completion: update 'git reset' new stage options

 Documentation/git-apply.txt            |  11 ++-
 Documentation/git-diff.txt             |   4 +-
 Documentation/git-grep.txt             |   5 +-
 Documentation/git-reset.txt            |   8 +++
 Documentation/git-rm.txt               |   5 +-
 Documentation/git-stage.txt            |  50 +++++++++++--
 Documentation/git-stash.txt            |  14 ++--
 Documentation/git-submodule.txt        |   8 ++-
 Makefile                               |   2 +-
 builtin.h                              |   1 +
 builtin/apply.c                        |   7 ++
 builtin/grep.c                         |   2 +
 builtin/reset.c                        |  27 +++++++
 builtin/rm.c                           |   1 +
 builtin/stage.c                        | 126 +++++++++++++++++++++++++++++++++
 contrib/completion/git-completion.bash |  39 ++++++++--
 git-stash.sh                           |  12 +++-
 git-submodule.sh                       |  10 +--
 git.c                                  |   2 +-
 19 files changed, 297 insertions(+), 37 deletions(-)
 create mode 100644 builtin/stage.c

-- 
1.8.4-fc

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH try2 10/14] apply: add --work, --no-work options
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (2 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 00/14] Officially start moving to the term 'staging area' Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 01/14] Add proper 'stage' command Felipe Contreras
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

'git apply', 'git apply --index', 'git apply --cached' do different
things, but what they do is not precisely clear, specially since no
other commands has similar distinctions.

With --no-work (--work being the default), it's clear what the option
would do; modify, or not, the working directory.

So, --work (the default), doesn't cause any changes, and --no-work
enables the current --cache if used with --index.

Eventually --work might replace --cache, if these options are
standarized in the whole git toolset.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-apply.txt | 6 +++++-
 builtin/apply.c             | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index ce44327..6167061 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -16,7 +16,7 @@ SYNOPSIS
 	  [--ignore-space-change | --ignore-whitespace ]
 	  [--whitespace=(nowarn|warn|fix|error|error-all)]
 	  [--exclude=<path>] [--include=<path>] [--directory=<root>]
-	  [--verbose] [<patch>...]
+	  [--verbose] [--no-work] [<patch>...]
 
 DESCRIPTION
 -----------
@@ -75,6 +75,10 @@ OPTIONS
 	cached data, apply the patch, and store the result in the index
 	without using the working tree. This implies `--index`.
 
+--[no-]work::
+	Apply a patch with or without touching the working tree, essentially
+	`--no-work` plus `--index` are the equivalent of `--cached`.
+
 -3::
 --3way::
 	When the patch does not apply cleanly, fall back on 3-way merge if
diff --git a/builtin/apply.c b/builtin/apply.c
index 42b5a4b..a3dd89d 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4350,6 +4350,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
 	int errs = 0;
 	int is_not_gitdir = !startup_info->have_repository;
 	int force_apply = 0;
+	int work = 1;
 
 	const char *whitespace_option = NULL;
 
@@ -4381,6 +4382,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
 			N_("make sure the patch is applicable to the current index")),
 		OPT_BOOLEAN(0, "cached", &cached,
 			N_("apply a patch without touching the working tree")),
+		OPT_BOOLEAN(0, "work", &work,
+			N_("modify the working tree")),
 		OPT_BOOLEAN(0, "apply", &force_apply,
 			N_("also apply the patch (use with --stat/--summary/--check)")),
 		OPT_BOOL('3', "3way", &threeway,
@@ -4433,6 +4436,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
 	argc = parse_options(argc, argv, prefix, builtin_apply_options,
 			apply_usage, 0);
 
+	if (check_index && !work)
+		cached = 1;
 	if (apply_with_reject && threeway)
 		die("--reject and --3way cannot be used together.");
 	if (cached && threeway)
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 01/14] Add proper 'stage' command
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (3 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 10/14] apply: add --work, --no-work options Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-14 19:44   ` Eric Sunshine
  2013-10-12  7:04 ` [PATCH try2 09/14] apply: add --stage option Felipe Contreras
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-stage.txt            | 45 +++++++++++++++++++++++++----
 Makefile                               |  2 +-
 builtin.h                              |  1 +
 builtin/stage.c                        | 52 ++++++++++++++++++++++++++++++++++
 contrib/completion/git-completion.bash | 24 +++++++++++++++-
 git.c                                  |  2 +-
 6 files changed, 118 insertions(+), 8 deletions(-)
 create mode 100644 builtin/stage.c

diff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt
index ba3fe0d..318bf45 100644
--- a/Documentation/git-stage.txt
+++ b/Documentation/git-stage.txt
@@ -3,20 +3,55 @@ git-stage(1)
 
 NAME
 ----
-git-stage - Add file contents to the staging area
+git-stage - manage the staging area
 
 
 SYNOPSIS
 --------
 [verse]
-'git stage' args...
-
+'git stage' [options] [--] [<paths>...]
+'git stage add' [options] [--] [<paths>...]
+'git stage reset' [-q|--patch] [--] [<paths>...]
+'git stage diff' [options] [<commit>] [--] [<paths>...]
+'git stage rm' [options] [--] [<paths>...]
+'git stage apply' [options] [--] [<paths>...]
 
 DESCRIPTION
 -----------
 
-This is a synonym for linkgit:git-add[1].  Please refer to the
-documentation of that command.
+
+COMMANDS
+--------
+
+With no arguments, it's a synonym for linkgit:git-add[1].
+
+'add'::
+
+Adds file contents to the staging area. See linkgit:git-add[1].
+
+'reset'::
+
+Resets the staging area. See linkgit:git-reset[1].
+
+'diff'::
+
+View the changes you staged for the next commit. See linkgit:git-diff[1] --staged.
+
+'rm'::
+
+Remove files from the staging area only. See linkgit:git-rm[1] --staged.
+
+'apply'::
+
+Apply a patch to the staging area. See linkgit:git-rm[1] --staged.
+
+SEE ALSO
+--------
+linkgit:git-add[1]
+linkgit:git-reset[1]
+linkgit:git-diff[1]
+linkgit:git-rm[1]
+linkgit:git-apply[1]
 
 GIT
 ---
diff --git a/Makefile b/Makefile
index 3588ca1..1f7ddf3 100644
--- a/Makefile
+++ b/Makefile
@@ -598,7 +598,6 @@ BUILT_INS += git-merge-subtree$X
 BUILT_INS += git-peek-remote$X
 BUILT_INS += git-repo-config$X
 BUILT_INS += git-show$X
-BUILT_INS += git-stage$X
 BUILT_INS += git-status$X
 BUILT_INS += git-whatchanged$X
 
@@ -982,6 +981,7 @@ BUILTIN_OBJS += builtin/send-pack.o
 BUILTIN_OBJS += builtin/shortlog.o
 BUILTIN_OBJS += builtin/show-branch.o
 BUILTIN_OBJS += builtin/show-ref.o
+BUILTIN_OBJS += builtin/stage.o
 BUILTIN_OBJS += builtin/stripspace.o
 BUILTIN_OBJS += builtin/symbolic-ref.o
 BUILTIN_OBJS += builtin/tag.o
diff --git a/builtin.h b/builtin.h
index 8afa2de..baf3a0f 100644
--- a/builtin.h
+++ b/builtin.h
@@ -113,6 +113,7 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
 extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
 extern int cmd_show(int argc, const char **argv, const char *prefix);
 extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
+extern int cmd_stage(int argc, const char **argv, const char *prefix);
 extern int cmd_status(int argc, const char **argv, const char *prefix);
 extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
 extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
diff --git a/builtin/stage.c b/builtin/stage.c
new file mode 100644
index 0000000..3023d17
--- /dev/null
+++ b/builtin/stage.c
@@ -0,0 +1,52 @@
+/*
+ * 'git stage' builtin command
+ *
+ * Copyright (C) 2013 Felipe Contreras
+ */
+
+#include "builtin.h"
+#include "parse-options.h"
+
+static const char *const stage_usage[] = {
+	N_("git stage [options] [--] <paths>..."),
+	N_("git stage add [options] [--] <paths>..."),
+	N_("git stage reset [-q|--patch] [--] <paths>..."),
+	N_("git stage diff [options] [<commit]> [--] <paths>..."),
+	N_("git stage rm [options] [--] <paths>..."),
+	NULL
+};
+
+int cmd_stage(int argc, const char **argv, const char *prefix)
+{
+	struct option options[] = { OPT_END() };
+
+	argc = parse_options(argc, argv, prefix, options, stage_usage,
+			PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);
+
+	if (argc > 1) {
+		if (!strcmp(argv[1], "add"))
+			return cmd_add(argc - 1, argv + 1, prefix);
+		if (!strcmp(argv[1], "reset"))
+			return cmd_reset(argc - 1, argv + 1, prefix);
+		if (!strcmp(argv[1], "diff")) {
+			argv[0] = "diff";
+			argv[1] = "--staged";
+
+			return cmd_diff(argc, argv, prefix);
+		}
+		if (!strcmp(argv[1], "rm")) {
+			argv[0] = "rm";
+			argv[1] = "--cached";
+
+			return cmd_rm(argc, argv, prefix);
+		}
+		if (!strcmp(argv[1], "apply")) {
+			argv[0] = "apply";
+			argv[1] = "--cached";
+
+			return cmd_apply(argc, argv, prefix);
+		}
+	}
+
+	return cmd_add(argc, argv, prefix);
+}
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5da920e..8cf26e2 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1691,7 +1691,29 @@ _git_send_email ()
 
 _git_stage ()
 {
-	_git_add
+	__git_has_doubledash && return
+
+	local subcommands="add reset diff rm apply"
+	local subcommand="$(__git_find_on_cmdline "$subcommands")"
+	if [ -z "$subcommand" ]; then
+		__gitcomp "$subcommands"
+		return
+	fi
+
+	case "$subcommand" in
+	add)
+		_git_add;;
+	reset)
+		_git_reset;;
+	diff)
+		_git_diff;;
+	rm)
+		_git_rm;;
+	apply)
+		_git_apply;;
+	*)
+		_git_add;
+	esac
 }
 
 __git_config_get_set_variables ()
diff --git a/git.c b/git.c
index 2025f77..0e639aa 100644
--- a/git.c
+++ b/git.c
@@ -409,7 +409,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "show", cmd_show, RUN_SETUP },
 		{ "show-branch", cmd_show_branch, RUN_SETUP },
 		{ "show-ref", cmd_show_ref, RUN_SETUP },
-		{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
+		{ "stage", cmd_stage, RUN_SETUP | NEED_WORK_TREE },
 		{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
 		{ "stripspace", cmd_stripspace },
 		{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 09/14] apply: add --stage option
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (4 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 01/14] Add proper 'stage' command Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-13  9:53   ` Eric Sunshine
  2013-10-12  7:04 ` [PATCH try2 03/14] diff: document --staged Felipe Contreras
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Synonym for --index.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-apply.txt | 5 ++++-
 builtin/apply.c             | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index f605327..ce44327 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]
 	  [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]
 	  [--allow-binary-replacement | --binary] [--reject] [-z]
-	  [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]
+	  [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached|--staged]
 	  [--ignore-space-change | --ignore-whitespace ]
 	  [--whitespace=(nowarn|warn|fix|error|error-all)]
 	  [--exclude=<path>] [--include=<path>] [--directory=<root>]
@@ -67,6 +67,9 @@ OPTIONS
 	up-to-date, it is flagged as an error.  This flag also
 	causes the index file to be updated.
 
+--staged::
+	Synonym for --index.
+
 --cached::
 	Apply a patch without touching the working tree. Instead take the
 	cached data, apply the patch, and store the result in the index
diff --git a/builtin/apply.c b/builtin/apply.c
index 50912c9..42b5a4b 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
 			N_("instead of applying the patch, see if the patch is applicable")),
 		OPT_BOOLEAN(0, "index", &check_index,
 			N_("make sure the patch is applicable to the current index")),
+		OPT_BOOLEAN(0, "stage", &check_index,
+			N_("make sure the patch is applicable to the current index")),
 		OPT_BOOLEAN(0, "cached", &cached,
 			N_("apply a patch without touching the working tree")),
 		OPT_BOOLEAN(0, "apply", &force_apply,
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 03/14] diff: document --staged
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (5 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 09/14] apply: add --stage option Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 05/14] rm: add --staged option Felipe Contreras
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Synonym for --cached.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-diff.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 78d6d50..646e5cd 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git diff' [options] [<commit>] [--] [<path>...]
-'git diff' [options] --cached [<commit>] [--] [<path>...]
+'git diff' [options] [--cached|--staged] [<commit>] [--] [<path>...]
 'git diff' [options] <commit> <commit> [--] [<path>...]
 'git diff' [options] <blob> <blob>
 'git diff' [options] [--no-index] [--] <path> <path>
@@ -33,7 +33,7 @@ If exactly two paths are given and at least one points outside
 the current repository, 'git diff' will compare the two files /
 directories. This behavior can be forced by --no-index.
 
-'git diff' [--options] --cached [<commit>] [--] [<path>...]::
+'git diff' [--options] [--cached|--staged] [<commit>] [--] [<path>...]::
 
 	This form is to view the changes you staged for the next
 	commit relative to the named <commit>.  Typically you
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 05/14] rm: add --staged option
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (6 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 03/14] diff: document --staged Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 02/14] stage: add edit command Felipe Contreras
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Synonym for --cached.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-rm.txt | 5 ++++-
 builtin/rm.c             | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index 1d876c2..156b40d 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -8,7 +8,7 @@ git-rm - Remove files from the working tree and from the index
 SYNOPSIS
 --------
 [verse]
-'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...
+'git rm' [-f | --force] [-n] [-r] [--cached | --staged] [--ignore-unmatch] [--quiet] [--] <file>...
 
 DESCRIPTION
 -----------
@@ -60,6 +60,9 @@ OPTIONS
 	Working tree files, whether modified or not, will be
 	left alone.
 
+--staged::
+	Synonym for --cached.
+
 --ignore-unmatch::
 	Exit with a zero status even if no files matched.
 
diff --git a/builtin/rm.c b/builtin/rm.c
index 0df0b4d..919911f 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -268,6 +268,7 @@ static struct option builtin_rm_options[] = {
 	OPT__DRY_RUN(&show_only, N_("dry run")),
 	OPT__QUIET(&quiet, N_("do not list removed files")),
 	OPT_BOOLEAN( 0 , "cached",         &index_only, N_("only remove from the index")),
+	OPT_BOOLEAN( 0 , "staged",         &index_only, N_("only remove from the index")),
 	OPT__FORCE(&force, N_("override the up-to-date check")),
 	OPT_BOOLEAN('r', NULL,             &recursive,  N_("allow recursive removal")),
 	OPT_BOOLEAN( 0 , "ignore-unmatch", &ignore_unmatch,
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 02/14] stage: add edit command
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (7 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 05/14] rm: add --staged option Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 13/14] reset: allow --keep with --stage Felipe Contreras
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-stage.txt            |  5 +++
 builtin/stage.c                        | 74 ++++++++++++++++++++++++++++++++++
 contrib/completion/git-completion.bash |  4 +-
 3 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt
index 318bf45..3e52a66 100644
--- a/Documentation/git-stage.txt
+++ b/Documentation/git-stage.txt
@@ -15,6 +15,7 @@ SYNOPSIS
 'git stage diff' [options] [<commit>] [--] [<paths>...]
 'git stage rm' [options] [--] [<paths>...]
 'git stage apply' [options] [--] [<paths>...]
+'git stage edit'
 
 DESCRIPTION
 -----------
@@ -45,6 +46,10 @@ Remove files from the staging area only. See linkgit:git-rm[1] --staged.
 
 Apply a patch to the staging area. See linkgit:git-rm[1] --staged.
 
+'edit'::
+
+Manually edit the staging area (as a diff).
+
 SEE ALSO
 --------
 linkgit:git-add[1]
diff --git a/builtin/stage.c b/builtin/stage.c
index 3023d17..d3c58d5 100644
--- a/builtin/stage.c
+++ b/builtin/stage.c
@@ -6,6 +6,9 @@
 
 #include "builtin.h"
 #include "parse-options.h"
+#include "diff.h"
+#include "diffcore.h"
+#include "revision.h"
 
 static const char *const stage_usage[] = {
 	N_("git stage [options] [--] <paths>..."),
@@ -16,6 +19,74 @@ static const char *const stage_usage[] = {
 	NULL
 };
 
+static int do_reset(const char *prefix)
+{
+	const char *argv[] = { "reset", "--quiet", NULL };
+	return cmd_reset(2, argv, prefix);
+}
+
+static int do_apply(const char *file, const char *prefix)
+{
+	const char *argv[] = { "apply", "--recount", "--cached", file, NULL };
+	return cmd_apply(4, argv, prefix);
+}
+
+static int edit(int argc, const char **argv, const char *prefix)
+{
+	char *file = git_pathdup("STAGE_EDIT.patch");
+	int out;
+	struct rev_info rev;
+	int ret = 0;
+	struct stat st;
+
+	read_cache();
+
+	init_revisions(&rev, prefix);
+	rev.diffopt.context = 7;
+
+	argc = setup_revisions(argc, argv, &rev, NULL);
+	add_head_to_pending(&rev);
+	if (!rev.pending.nr) {
+		struct tree *tree;
+		tree = lookup_tree(EMPTY_TREE_SHA1_BIN);
+		add_pending_object(&rev, &tree->object, "HEAD");
+	}
+
+	rev.diffopt.output_format = DIFF_FORMAT_PATCH;
+	rev.diffopt.use_color = 0;
+	DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
+
+	out = open(file, O_CREAT | O_WRONLY, 0666);
+	if (out < 0)
+		die(_("Could not open '%s' for writing."), file);
+	rev.diffopt.file = xfdopen(out, "w");
+	rev.diffopt.close_file = 1;
+
+	if (run_diff_index(&rev, 1))
+		die(_("Could not write patch"));
+	if (launch_editor(file, NULL, NULL))
+		exit(1);
+
+	if (stat(file, &st))
+		die_errno(_("Could not stat '%s'"), file);
+
+	ret = do_reset(prefix);
+	if (ret)
+		goto leave;
+
+	if (!st.st_size)
+		goto leave;
+
+	ret = do_apply(file, prefix);
+	if (ret)
+		goto leave;
+
+leave:
+	unlink(file);
+	free(file);
+	return ret;
+}
+
 int cmd_stage(int argc, const char **argv, const char *prefix)
 {
 	struct option options[] = { OPT_END() };
@@ -46,6 +117,9 @@ int cmd_stage(int argc, const char **argv, const char *prefix)
 
 			return cmd_apply(argc, argv, prefix);
 		}
+		if (!strcmp(argv[1], "edit")) {
+			return edit(argc - 1, argv + 1, prefix);
+		}
 	}
 
 	return cmd_add(argc, argv, prefix);
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8cf26e2..2b81e78 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1693,7 +1693,7 @@ _git_stage ()
 {
 	__git_has_doubledash && return
 
-	local subcommands="add reset diff rm apply"
+	local subcommands="add reset diff rm apply edit"
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
 		__gitcomp "$subcommands"
@@ -1711,6 +1711,8 @@ _git_stage ()
 		_git_rm;;
 	apply)
 		_git_apply;;
+	edit)
+		;;
 	*)
 		_git_add;
 	esac
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 13/14] reset: allow --keep with --stage
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (8 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 02/14] stage: add edit command Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 12/14] reset: add --stage and --work options Felipe Contreras
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-reset.txt |  2 +-
 builtin/reset.c             | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 5cd75a8..a1419c9 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 'git reset' [-q] [<tree-ish>] [--] <paths>...
 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]
 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
-'git reset' [--stage | --work] [-q] [<commit>]
+'git reset' [--stage | --work | --keep] [-q] [<commit>]
 
 DESCRIPTION
 -----------
diff --git a/builtin/reset.c b/builtin/reset.c
index fbc1abc..dde03a7 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -23,7 +23,7 @@
 
 static const char * const git_reset_usage[] = {
 	N_("git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]"),
-	N_("git reset [--stage | --work] [-q] [<commit>]"),
+	N_("git reset [--stage | --work | --keep] [-q] [<commit>]"),
 	N_("git reset [-q] <tree-ish> [--] <paths>..."),
 	N_("git reset --patch [<tree-ish>] [--] [<paths>...]"),
 	NULL
@@ -295,8 +295,15 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 	}
 
 	if (stage >= 0 || working_tree >= 0) {
-		if (reset_type != NONE)
+		int keep = 0;
+
+		if (reset_type == KEEP) {
+			if (working_tree == 1)
+				die(_("--keep is incompatible with --work"));
+			keep = 1;
+		} else if (reset_type != NONE) {
 			die(_("--{stage,work} are incompatible with --{hard,mixed,soft,merge}"));
+		}
 
 		if (working_tree == 1) {
 			if (stage == 0)
@@ -304,7 +311,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 			reset_type = HARD;
 		} else {
 			if (stage == 1)
-				reset_type = NONE;
+				reset_type = keep ? KEEP : NONE;
 			else
 				reset_type = SOFT;
 		}
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 12/14] reset: add --stage and --work options
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (9 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 13/14] reset: allow --keep with --stage Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 08/14] submodule: add --staged options Felipe Contreras
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-reset.txt |  8 ++++++++
 builtin/reset.c             | 20 ++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index f445cb3..5cd75a8 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -11,6 +11,7 @@ SYNOPSIS
 'git reset' [-q] [<tree-ish>] [--] <paths>...
 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]
 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
+'git reset' [--stage | --work] [-q] [<commit>]
 
 DESCRIPTION
 -----------
@@ -81,6 +82,13 @@ but carries forward unmerged index entries.
 	different between <commit> and HEAD.
 	If a file that is different between <commit> and HEAD has local changes,
 	reset is aborted.
+
+--stage::
+	Reset the index, basically `--mixed`. `--no-stage` is the equivalent of
+	`--soft`.
+
+--work::
+	Resets the working tree, basically `--hard`.
 --
 
 If you want to undo a commit other than the latest on a branch,
diff --git a/builtin/reset.c b/builtin/reset.c
index afa6e02..fbc1abc 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -23,6 +23,7 @@
 
 static const char * const git_reset_usage[] = {
 	N_("git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]"),
+	N_("git reset [--stage | --work] [-q] [<commit>]"),
 	N_("git reset [-q] <tree-ish> [--] <paths>..."),
 	N_("git reset --patch [<tree-ish>] [--] [<paths>...]"),
 	NULL
@@ -243,6 +244,7 @@ static int update_refs(const char *rev, const unsigned char *sha1)
 int cmd_reset(int argc, const char **argv, const char *prefix)
 {
 	int reset_type = NONE, update_ref_status = 0, quiet = 0;
+	int stage = -1, working_tree = -1;
 	int patch_mode = 0, unborn;
 	const char *rev;
 	unsigned char sha1[20];
@@ -258,6 +260,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 				N_("reset HEAD, index and working tree"), MERGE),
 		OPT_SET_INT(0, "keep", &reset_type,
 				N_("reset HEAD but keep local changes"), KEEP),
+		OPT_BOOL(0, "stage", &stage, N_("reset index")),
+		OPT_BOOL(0, "work", &working_tree, N_("reset working tree")),
 		OPT_BOOLEAN('p', "patch", &patch_mode, N_("select hunks interactively")),
 		OPT_END()
 	};
@@ -290,6 +294,22 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 		hashcpy(sha1, tree->object.sha1);
 	}
 
+	if (stage >= 0 || working_tree >= 0) {
+		if (reset_type != NONE)
+			die(_("--{stage,work} are incompatible with --{hard,mixed,soft,merge}"));
+
+		if (working_tree == 1) {
+			if (stage == 0)
+				die(_("--no-stage doesn't make sense with --work"));
+			reset_type = HARD;
+		} else {
+			if (stage == 1)
+				reset_type = NONE;
+			else
+				reset_type = SOFT;
+		}
+	}
+
 	if (patch_mode) {
 		if (reset_type != NONE)
 			die(_("--patch is incompatible with --{hard,mixed,soft}"));
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 08/14] submodule: add --staged options
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (10 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 12/14] reset: add --stage and --work options Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 11/14] completion: update " Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 06/14] stash: add --stage option to save Felipe Contreras
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Synonym for --cached.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-submodule.txt |  8 ++++++--
 git-submodule.sh                | 10 +++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index bfef8a0..904e007 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -11,13 +11,13 @@ SYNOPSIS
 [verse]
 'git submodule' [--quiet] add [-b <branch>] [-f|--force] [--name <name>]
 	      [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]
-'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
+'git submodule' [--quiet] status [--cached|--staged] [--recursive] [--] [<path>...]
 'git submodule' [--quiet] init [--] [<path>...]
 'git submodule' [--quiet] deinit [-f|--force] [--] <path>...
 'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]
 	      [-f|--force] [--rebase] [--reference <repository>] [--depth <depth>]
 	      [--merge] [--recursive] [--] [<path>...]
-'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]
+'git submodule' [--quiet] summary [--cached|--staged|--files] [(-n|--summary-limit) <n>]
 	      [commit] [--] [<path>...]
 'git submodule' [--quiet] foreach [--recursive] <command>
 'git submodule' [--quiet] sync [--] [<path>...]
@@ -248,6 +248,10 @@ OPTIONS
 	commands typically use the commit found in the submodule HEAD, but
 	with this option, the commit stored in the index is used instead.
 
+
+--staged::
+	Synonym for `--cached`.
+
 --files::
 	This option is only valid for the summary command. This command
 	compares the commit in the index with that in the submodule HEAD
diff --git a/git-submodule.sh b/git-submodule.sh
index 2979197..823b783 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -6,11 +6,11 @@
 
 dashless=$(basename "$0" | sed -e 's/-/ /')
 USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
-   or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
+   or: $dashless [--quiet] status [--cached|--staged] [--recursive] [--] [<path>...]
    or: $dashless [--quiet] init [--] [<path>...]
    or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
    or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
-   or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
+   or: $dashless [--quiet] summary [--cached|--staged|--files] [--summary-limit <n>] [commit] [--] [<path>...]
    or: $dashless [--quiet] foreach [--recursive] <command>
    or: $dashless [--quiet] sync [--recursive] [--] [<path>...]"
 OPTIONS_SPEC=
@@ -972,7 +972,7 @@ cmd_summary() {
 	while test $# -ne 0
 	do
 		case "$1" in
-		--cached)
+		--cached|--staged)
 			cached="$1"
 			;;
 		--files)
@@ -1181,7 +1181,7 @@ cmd_status()
 		-q|--quiet)
 			GIT_QUIET=1
 			;;
-		--cached)
+		--cached|--staged)
 			cached=1
 			;;
 		--recursive)
@@ -1348,7 +1348,7 @@ do
 		esac
 		branch="$2"; shift
 		;;
-	--cached)
+	--cached|--staged)
 		cached="$1"
 		;;
 	--)
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 11/14] completion: update --staged options
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (11 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 08/14] submodule: add --staged options Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  2013-10-12  7:04 ` [PATCH try2 06/14] stash: add --stage option to save Felipe Contreras
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2b81e78..1dde51f 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -881,7 +881,7 @@ _git_apply ()
 		__gitcomp "
 			--stat --numstat --summary --check --index
 			--cached --index-info --reverse --reject --unidiff-zero
-			--apply --no-add --exclude=
+			--apply --no-add --exclude= --staged
 			--ignore-whitespace --ignore-space-change
 			--whitespace= --inaccurate-eof --verbose
 			"
@@ -1294,7 +1294,7 @@ _git_grep ()
 	case "$cur" in
 	--*)
 		__gitcomp "
-			--cached
+			--cached --staged
 			--text --ignore-case --word-regexp --invert-match
 			--full-name --line-number
 			--extended-regexp --basic-regexp --fixed-strings
@@ -2253,7 +2253,7 @@ _git_rm ()
 {
 	case "$cur" in
 	--*)
-		__gitcomp "--cached --dry-run --ignore-unmatch --quiet"
+		__gitcomp "--cached --staged --dry-run --ignore-unmatch --quiet"
 		return
 		;;
 	esac
@@ -2320,7 +2320,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local save_opts='--keep-index --no-keep-index --quiet --patch'
+	local save_opts='--keep-index --no-keep-index --stage --no-stage --quiet --patch'
 	local subcommands='save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
@@ -2340,7 +2340,7 @@ _git_stash ()
 			__gitcomp "$save_opts"
 			;;
 		apply,--*|pop,--*)
-			__gitcomp "--index --quiet"
+			__gitcomp "--index --stage --quiet"
 			;;
 		show,--*|drop,--*|branch,--*)
 			;;
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH try2 06/14] stash: add --stage option to save
  2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
                   ` (12 preceding siblings ...)
  2013-10-12  7:04 ` [PATCH try2 11/14] completion: update " Felipe Contreras
@ 2013-10-12  7:04 ` Felipe Contreras
  13 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-12  7:04 UTC (permalink / raw)
  To: git
  Cc: Piotr Krukowiecki, Jay Soffian, Miles Bader, Jonathan Nieder,
	Philip Oakley, Matthieu Moy, William Swanson, Ping Yin,
	Hilco Wijbenga, Felipe Contreras

--no-stage is synonym for --keep-index.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/git-stash.txt | 6 +++---
 git-stash.sh                | 8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index db7e803..75b4cc6 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 'git stash' drop [-q|--quiet] [<stash>]
 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
 'git stash' branch <branchname> [<stash>]
-'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
+'git stash' [save [-p|--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]
 	     [-u|--include-untracked] [-a|--all] [<message>]]
 'git stash' clear
 'git stash' create [<message>]
@@ -44,7 +44,7 @@ is also possible).
 OPTIONS
 -------
 
-save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::
+save [-p|--patch] [--[no-]keep-index|--[no-]stage] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::
 
 	Save your local modifications to a new 'stash', and run `git reset
 	--hard` to revert them.  The <message> part is optional and gives
@@ -54,7 +54,7 @@ save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--
 	subcommand from making an unwanted stash.
 +
 If the `--keep-index` option is used, all changes already added to the
-index are left intact.
+index are left intact. Same with `--no-stage`, which is a snynonym.
 +
 If the `--include-untracked` option is used, all untracked files are also
 stashed and then cleaned up with `git clean`, leaving the working directory
diff --git a/git-stash.sh b/git-stash.sh
index 1e541a2..47220d0 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -7,7 +7,7 @@ USAGE="list [<options>]
    or: $dashless drop [-q|--quiet] [<stash>]
    or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
    or: $dashless branch <branchname> [<stash>]
-   or: $dashless [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
+   or: $dashless [save [--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]
 		       [-u|--include-untracked] [-a|--all] [<message>]]
    or: $dashless clear"
 
@@ -204,6 +204,12 @@ save_stash () {
 		--no-keep-index)
 			keep_index=n
 			;;
+		--stage)
+			keep_index=n
+			;;
+		--no-stage)
+			keep_index=t
+			;;
 		-p|--patch)
 			patch_mode=t
 			# only default to keep if we don't already have an override
-- 
1.8.4-fc

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH try2 09/14] apply: add --stage option
  2013-10-12  7:04 ` [PATCH try2 09/14] apply: add --stage option Felipe Contreras
@ 2013-10-13  9:53   ` Eric Sunshine
  2013-10-13 10:16     ` Felipe Contreras
  2013-10-13 10:19     ` Miles Bader
  0 siblings, 2 replies; 21+ messages in thread
From: Eric Sunshine @ 2013-10-13  9:53 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Git List, Piotr Krukowiecki, Jay Soffian, Miles Bader,
	Jonathan Nieder, Philip Oakley, Matthieu Moy, William Swanson,
	Ping Yin, Hilco Wijbenga

On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> Synonym for --index.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  Documentation/git-apply.txt | 5 ++++-
>  builtin/apply.c             | 2 ++
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
> index f605327..ce44327 100644
> --- a/Documentation/git-apply.txt
> +++ b/Documentation/git-apply.txt
> @@ -12,7 +12,7 @@ SYNOPSIS
>  'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]
>           [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]
>           [--allow-binary-replacement | --binary] [--reject] [-z]
> -         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]
> +         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached|--staged]

Here "staged".

>           [--ignore-space-change | --ignore-whitespace ]
>           [--whitespace=(nowarn|warn|fix|error|error-all)]
>           [--exclude=<path>] [--include=<path>] [--directory=<root>]
> @@ -67,6 +67,9 @@ OPTIONS
>         up-to-date, it is flagged as an error.  This flag also
>         causes the index file to be updated.
>
> +--staged::
> +       Synonym for --index.
> +

Also "staged".

>  --cached::
>         Apply a patch without touching the working tree. Instead take the
>         cached data, apply the patch, and store the result in the index
> diff --git a/builtin/apply.c b/builtin/apply.c
> index 50912c9..42b5a4b 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
>                         N_("instead of applying the patch, see if the patch is applicable")),
>                 OPT_BOOLEAN(0, "index", &check_index,
>                         N_("make sure the patch is applicable to the current index")),
> +               OPT_BOOLEAN(0, "stage", &check_index,

But here "stage".

> +                       N_("make sure the patch is applicable to the current index")),
>                 OPT_BOOLEAN(0, "cached", &cached,
>                         N_("apply a patch without touching the working tree")),
>                 OPT_BOOLEAN(0, "apply", &force_apply,
> --
> 1.8.4-fc
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH try2 09/14] apply: add --stage option
  2013-10-13  9:53   ` Eric Sunshine
@ 2013-10-13 10:16     ` Felipe Contreras
  2013-10-13 10:19     ` Miles Bader
  1 sibling, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-13 10:16 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Git List, Piotr Krukowiecki, Jay Soffian, Miles Bader,
	Jonathan Nieder, Philip Oakley, Matthieu Moy, William Swanson,
	Ping Yin, Hilco Wijbenga

On Sun, Oct 13, 2013 at 4:53 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> Synonym for --index.
>>
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  Documentation/git-apply.txt | 5 ++++-
>>  builtin/apply.c             | 2 ++
>>  2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
>> index f605327..ce44327 100644
>> --- a/Documentation/git-apply.txt
>> +++ b/Documentation/git-apply.txt
>> @@ -12,7 +12,7 @@ SYNOPSIS
>>  'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]
>>           [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]
>>           [--allow-binary-replacement | --binary] [--reject] [-z]
>> -         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]
>> +         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached|--staged]
>
> Here "staged".
>
>>           [--ignore-space-change | --ignore-whitespace ]
>>           [--whitespace=(nowarn|warn|fix|error|error-all)]
>>           [--exclude=<path>] [--include=<path>] [--directory=<root>]
>> @@ -67,6 +67,9 @@ OPTIONS
>>         up-to-date, it is flagged as an error.  This flag also
>>         causes the index file to be updated.
>>
>> +--staged::
>> +       Synonym for --index.
>> +
>
> Also "staged".
>
>>  --cached::
>>         Apply a patch without touching the working tree. Instead take the
>>         cached data, apply the patch, and store the result in the index
>> diff --git a/builtin/apply.c b/builtin/apply.c
>> index 50912c9..42b5a4b 100644
>> --- a/builtin/apply.c
>> +++ b/builtin/apply.c
>> @@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
>>                         N_("instead of applying the patch, see if the patch is applicable")),
>>                 OPT_BOOLEAN(0, "index", &check_index,
>>                         N_("make sure the patch is applicable to the current index")),
>> +               OPT_BOOLEAN(0, "stage", &check_index,
>
> But here "stage".

Right. Should be "staged".

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH try2 09/14] apply: add --stage option
  2013-10-13  9:53   ` Eric Sunshine
  2013-10-13 10:16     ` Felipe Contreras
@ 2013-10-13 10:19     ` Miles Bader
  2013-10-13 10:31       ` Felipe Contreras
  1 sibling, 1 reply; 21+ messages in thread
From: Miles Bader @ 2013-10-13 10:19 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Felipe Contreras, Git List, Piotr Krukowiecki, Jay Soffian,
	Jonathan Nieder, Philip Oakley, Matthieu Moy, William Swanson,
	Ping Yin, Hilco Wijbenga

2013/10/13 Eric Sunshine <sunshine@sunshineco.com>:
> Here "staged".
...
> But here "stage".

The inconsistency is weird, but isn't the term "staged" a bit odd with
something that affects the future...?

"Apply to the stage" seems a reasonable english phrasing, but "staged"
seems more awkward...

-miles

-- 
Cat is power.  Cat is peace.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH try2 09/14] apply: add --stage option
  2013-10-13 10:19     ` Miles Bader
@ 2013-10-13 10:31       ` Felipe Contreras
  0 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-13 10:31 UTC (permalink / raw)
  To: Miles Bader
  Cc: Eric Sunshine, Git List, Piotr Krukowiecki, Jay Soffian,
	Jonathan Nieder, Philip Oakley, Matthieu Moy, William Swanson,
	Ping Yin, Hilco Wijbenga

On Sun, Oct 13, 2013 at 5:19 AM, Miles Bader <miles@gnu.org> wrote:
> 2013/10/13 Eric Sunshine <sunshine@sunshineco.com>:
>> Here "staged".
> ...
>> But here "stage".
>
> The inconsistency is weird, but isn't the term "staged" a bit odd with
> something that affects the future...?
>
> "Apply to the stage" seems a reasonable english phrasing, but "staged"
> seems more awkward...

That's true, I was thinking since this was supposed to be a
non-intrusive change, it would make sense to keep close to the
--cached option, but the synonym is actually --index, not --cached. So
--stage makes more sense from those two points of view.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH try2 01/14] Add proper 'stage' command
  2013-10-12  7:04 ` [PATCH try2 01/14] Add proper 'stage' command Felipe Contreras
@ 2013-10-14 19:44   ` Eric Sunshine
  2013-10-14 22:22     ` Felipe Contreras
  0 siblings, 1 reply; 21+ messages in thread
From: Eric Sunshine @ 2013-10-14 19:44 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Git List, Piotr Krukowiecki, Jay Soffian, Miles Bader,
	Jonathan Nieder, Philip Oakley, Matthieu Moy, William Swanson,
	Ping Yin, Hilco Wijbenga

On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>  SYNOPSIS
>  --------
>  [verse]
> -'git stage' args...
> -
> +'git stage' [options] [--] [<paths>...]
> +'git stage add' [options] [--] [<paths>...]
> +'git stage reset' [-q|--patch] [--] [<paths>...]
> +'git stage diff' [options] [<commit>] [--] [<paths>...]
> +'git stage rm' [options] [--] [<paths>...]
> +'git stage apply' [options] [--] [<paths>...]
>
> diff --git a/builtin/stage.c b/builtin/stage.c
> new file mode 100644
> index 0000000..3023d17
> --- /dev/null
> +++ b/builtin/stage.c
> @@ -0,0 +1,52 @@
> +/*
> + * 'git stage' builtin command
> + *
> + * Copyright (C) 2013 Felipe Contreras
> + */
> +
> +#include "builtin.h"
> +#include "parse-options.h"
> +
> +static const char *const stage_usage[] = {
> +       N_("git stage [options] [--] <paths>..."),
> +       N_("git stage add [options] [--] <paths>..."),
> +       N_("git stage reset [-q|--patch] [--] <paths>..."),
> +       N_("git stage diff [options] [<commit]> [--] <paths>..."),
> +       N_("git stage rm [options] [--] <paths>..."),
> +       NULL
> +};

Missing usage for "git stage apply".

> +
> +int cmd_stage(int argc, const char **argv, const char *prefix)
> +{
> +       struct option options[] = { OPT_END() };
> +
> +       argc = parse_options(argc, argv, prefix, options, stage_usage,
> +                       PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);
> +
> +       if (argc > 1) {
> +               if (!strcmp(argv[1], "add"))
> +                       return cmd_add(argc - 1, argv + 1, prefix);
> +               if (!strcmp(argv[1], "reset"))
> +                       return cmd_reset(argc - 1, argv + 1, prefix);
> +               if (!strcmp(argv[1], "diff")) {
> +                       argv[0] = "diff";
> +                       argv[1] = "--staged";
> +
> +                       return cmd_diff(argc, argv, prefix);
> +               }
> +               if (!strcmp(argv[1], "rm")) {
> +                       argv[0] = "rm";
> +                       argv[1] = "--cached";
> +
> +                       return cmd_rm(argc, argv, prefix);
> +               }
> +               if (!strcmp(argv[1], "apply")) {
> +                       argv[0] = "apply";
> +                       argv[1] = "--cached";
> +
> +                       return cmd_apply(argc, argv, prefix);
> +               }
> +       }
> +
> +       return cmd_add(argc, argv, prefix);
> +}

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH try2 01/14] Add proper 'stage' command
  2013-10-14 19:44   ` Eric Sunshine
@ 2013-10-14 22:22     ` Felipe Contreras
  0 siblings, 0 replies; 21+ messages in thread
From: Felipe Contreras @ 2013-10-14 22:22 UTC (permalink / raw)
  To: Eric Sunshine, Felipe Contreras
  Cc: Git List, Piotr Krukowiecki, Jay Soffian, Miles Bader,
	Jonathan Nieder, Philip Oakley, Matthieu Moy, William Swanson,
	Ping Yin, Hilco Wijbenga

Eric Sunshine wrote:
> On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >  SYNOPSIS
> >  --------
> >  [verse]
> > -'git stage' args...
> > -
> > +'git stage' [options] [--] [<paths>...]
> > +'git stage add' [options] [--] [<paths>...]
> > +'git stage reset' [-q|--patch] [--] [<paths>...]
> > +'git stage diff' [options] [<commit>] [--] [<paths>...]
> > +'git stage rm' [options] [--] [<paths>...]
> > +'git stage apply' [options] [--] [<paths>...]
> >
> > diff --git a/builtin/stage.c b/builtin/stage.c
> > new file mode 100644
> > index 0000000..3023d17
> > --- /dev/null
> > +++ b/builtin/stage.c
> > @@ -0,0 +1,52 @@
> > +/*
> > + * 'git stage' builtin command
> > + *
> > + * Copyright (C) 2013 Felipe Contreras
> > + */
> > +
> > +#include "builtin.h"
> > +#include "parse-options.h"
> > +
> > +static const char *const stage_usage[] = {
> > +       N_("git stage [options] [--] <paths>..."),
> > +       N_("git stage add [options] [--] <paths>..."),
> > +       N_("git stage reset [-q|--patch] [--] <paths>..."),
> > +       N_("git stage diff [options] [<commit]> [--] <paths>..."),
> > +       N_("git stage rm [options] [--] <paths>..."),
> > +       NULL
> > +};
> 
> Missing usage for "git stage apply".

Right. Will add

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2013-10-14 22:28 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12  7:04 [PATCH try2 14/14] completion: update 'git reset' new stage options Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 04/14] grep: add --staged option Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 07/14] stash: add --stage to pop and apply Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 00/14] Officially start moving to the term 'staging area' Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 10/14] apply: add --work, --no-work options Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 01/14] Add proper 'stage' command Felipe Contreras
2013-10-14 19:44   ` Eric Sunshine
2013-10-14 22:22     ` Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 09/14] apply: add --stage option Felipe Contreras
2013-10-13  9:53   ` Eric Sunshine
2013-10-13 10:16     ` Felipe Contreras
2013-10-13 10:19     ` Miles Bader
2013-10-13 10:31       ` Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 03/14] diff: document --staged Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 05/14] rm: add --staged option Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 02/14] stage: add edit command Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 13/14] reset: allow --keep with --stage Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 12/14] reset: add --stage and --work options Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 08/14] submodule: add --staged options Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 11/14] completion: update " Felipe Contreras
2013-10-12  7:04 ` [PATCH try2 06/14] stash: add --stage option to save Felipe Contreras

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).