{"thread":{"id":"35121","subject":"[PATCH try2 14/14] completion: update 'git reset' new stage options","startedAt":"2013-10-12T07:04:34Z","lastAt":"2013-10-14T22:22:33Z","messageCount":21,"participants":["Felipe Contreras","Eric Sunshine","Miles Bader"],"isPatch":true,"patchVersion":1,"patchTotal":14},"messages":[{"id":"228793","messageId":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":null,"subject":"[PATCH try2 14/14] completion: update 'git reset' new stage options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:34Z","receivedAt":"2013-10-12T07:04:34Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1dde51f..082f207 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2231,7 +2231,8 @@ _git_reset ()\n \n \tcase \"$cur\" in\n \t--*)\n-\t\t__gitcomp \"--merge --mixed --hard --soft --patch\"\n+\t\t__gitcomp \"--merge --mixed --hard --soft --patch --keep --merge\n+\t\t\t--stage --no-stage --work --no-work\"\n \t\treturn\n \t\t;;\n \tesac\n-- \n1.8.4-fc\n"},{"id":"228794","messageId":"1381561488-20294-2-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 04/14] grep: add --staged option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:35Z","receivedAt":"2013-10-12T07:04:35Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-grep.txt | 5 ++++-\n builtin/grep.c             | 2 ++\n 2 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt\nindex 8497aa4..9f7899c 100644\n--- a/Documentation/git-grep.txt\n+++ b/Documentation/git-grep.txt\n@@ -25,7 +25,7 @@ SYNOPSIS\n \t   [-W | --function-context]\n \t   [-f <file>] [-e] <pattern>\n \t   [--and|--or|--not|(|)|-e <pattern>...]\n-\t   [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>...]\n+\t   [ [--[no-]exclude-standard] [--cached | --staged | --no-index | --untracked] | <tree>...]\n \t   [--] [<pathspec>...]\n \n DESCRIPTION\n@@ -60,6 +60,9 @@ OPTIONS\n \tInstead of searching tracked files in the working tree, search\n \tblobs registered in the index file.\n \n+--staged::\n+\tSynonym for `--cached`.\n+\n --no-index::\n \tSearch files in the current directory that is not managed by Git.\n \ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex d3b3b1d..b953911 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -640,6 +640,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tstruct option options[] = {\n \t\tOPT_BOOLEAN(0, \"cached\", &cached,\n \t\t\tN_(\"search in index instead of in the work tree\")),\n+\t\tOPT_BOOLEAN(0, \"staged\", &cached,\n+\t\t\tN_(\"search in index instead of in the work tree\")),\n \t\tOPT_NEGBIT(0, \"no-index\", &use_index,\n \t\t\t N_(\"find in contents not managed by git\"), 1),\n \t\tOPT_BOOLEAN(0, \"untracked\", &untracked,\n-- \n1.8.4-fc\n"},{"id":"228796","messageId":"1381561488-20294-3-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 07/14] stash: add --stage to pop and apply","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:36Z","receivedAt":"2013-10-12T07:04:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym of --index.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stash.txt | 8 ++++----\n git-stash.sh                | 4 ++--\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 75b4cc6..b4066fd 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n 'git stash' list [<options>]\n 'git stash' show [<stash>]\n 'git stash' drop [-q|--quiet] [<stash>]\n-'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n+'git stash' ( pop | apply ) [--index|--stage] [-q|--quiet] [<stash>]\n 'git stash' branch <branchname> [<stash>]\n 'git stash' [save [-p|--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t     [-u|--include-untracked] [-a|--all] [<message>]]\n@@ -96,7 +96,7 @@ show [<stash>]::\n \tit will accept any format known to 'git diff' (e.g., `git stash show\n \t-p stash@{1}` to view the second most recent stash in patch form).\n \n-pop [--index] [-q|--quiet] [<stash>]::\n+pop [--index|--stage] [-q|--quiet] [<stash>]::\n \n \tRemove a single stashed state from the stash list and apply it\n \ton top of the current working tree state, i.e., do the inverse\n@@ -110,12 +110,12 @@ and call `git stash drop` manually afterwards.\n If the `--index` option is used, then tries to reinstate not only the working\n tree's changes, but also the index's ones. However, this can fail, when you\n have conflicts (which are stored in the index, where you therefore can no\n-longer apply the changes as they were originally).\n+longer apply the changes as they were originally). `--stage` is a synonym.\n +\n When no `<stash>` is given, `stash@{0}` is assumed, otherwise `<stash>` must\n be a reference of the form `stash@{<revision>}`.\n \n-apply [--index] [-q|--quiet] [<stash>]::\n+apply [--index|--stage] [-q|--quiet] [<stash>]::\n \n \tLike `pop`, but do not remove the state from the stash list. Unlike `pop`,\n \t`<stash>` may be any commit that looks like a commit created by\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 47220d0..e2eb8dc 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -5,7 +5,7 @@ dashless=$(basename \"$0\" | sed -e 's/-/ /')\n USAGE=\"list [<options>]\n    or: $dashless show [<stash>]\n    or: $dashless drop [-q|--quiet] [<stash>]\n-   or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n+   or: $dashless ( pop | apply ) [--index|--stage] [-q|--quiet] [<stash>]\n    or: $dashless branch <branchname> [<stash>]\n    or: $dashless [save [--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t\t       [-u|--include-untracked] [-a|--all] [<message>]]\n@@ -373,7 +373,7 @@ parse_flags_and_rev()\n \t\t\t-q|--quiet)\n \t\t\t\tGIT_QUIET=-t\n \t\t\t;;\n-\t\t\t--index)\n+\t\t\t--index|--stage)\n \t\t\t\tINDEX_OPTION=--index\n \t\t\t;;\n \t\t\t-*)\n-- \n1.8.4-fc\n"},{"id":"228795","messageId":"1381561488-20294-4-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 00/14] Officially start moving to the term 'staging area'","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:37Z","receivedAt":"2013-10-12T07:04:37Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"tl;dr: everyone except Junio C Hamano and Drew Northup agrees; we should move\naway from the name \"the index\".\n\nIt has been discussed many times in the past that 'index' is not an\nappropriate description for what the high-level user does with it, and\nit has been agreed that 'staging area' is the best term.\n\nThe term 'staging area' is more intuitive for newcomers which are more\nfamiliar with English than with Git, and it seems to be a\nstraightforward mental notion for people with different mother tongues.\n\nIn fact it is so intuitive that it's used already in a lot online\ndocumentation, and the people that do teach Git professionally use this\nterm, because it's easier for many kinds of audiences to grasp.\n\nThe meaning of the words 'cache' and 'index' doesn't represent correctly\nthe mental model of the high-level user:\n\ncache: a 'cache' is a place for easier access; a squirrel caches nuts\nso it doesn't have to go looking for them in the future when it might\nbe much more difficult. Git porcelain is not using the staging area\nfor easier future access; it's not a cache.\n\nindex: an 'index' is a guide of pointers to something else; a book\nindex has a list of entries so the reader can locate information\neasily without having to go through the whole book. Git porcelain is\nnot using the staging area to find out entries quicker; it's not an\nindex.\n\nstage: a 'stage' is a special area designated for convenience in order\nfor some activity to take place; an orator would prepare a stage in\norder for her speak to be successful, otherwise many people might not\nbe able to hear, or see her. Git porcelain is using the staging area\nprecisely as a special area to be separated from the working directory\nfor convenience.\n\nThe term 'stage' is a good noun itself, but also 'staging area', it\nhas a good verb; 'to stage', and a nice past-participle; 'staged'.\n\nThe first step in moving Git towards this term, is first to add --stage\noptions for every command that uses --index or --cache. However, there's\na problem with the 'git apply' command, because it treats --index and\n--cache differently. Different solutions were proposed, including a\nspecial --stage-only option, however, I think the best solution is a\n--[no-]work option to specify if the working directory should be touched\nor not, so --index becomes --staged, and --cached becomes --staged\n--no-work.\n\nIn addition, the 'git stage' command can be extended so the staging area\ncan be brought closer to the user, like other important Git concepts,\nlike 'git branch, 'git tag', and 'git remote'. For example, the command\n'git stage edit' (which allows the user to edit directly the diff from\nHEAD to the staging area) can have a home, where previously there was no\nplace. It would become natural then to do 'git stage diff', and then\n'git stage edit' (to edit the previous diff).\n\nAfter adding the new --stage options and making sure no functionality is\nlost, they can become the recommended ones in the documentation,\neventually, the old ones get deprecated, and eventually obsoleted.\n\nAlso, the documentation would need to be updated to replace many\ninstances of 'the index', with 'the staging area' in porcelain commands.\n\nMoreover, the --stage and --work options also make sense for 'git\nreset', and after these options are added, the complicated table to\nexplain the different behaviors between --soft, --mixed, and --hard\nbecomes so simple it's not needed any more:\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       A       B     C    D     --no-stage  A       B     D\n\t\t\t\t--stage     A       D     D\n\t\t\t\t--work      D       D     D\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       A       B     C    C     --no-stage  A       B     C\n\t\t\t\t--stage     A       C     C\n\t\t\t\t--work      C       C     C\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       B     C    D     --no-stage  B       B     D\n\t\t\t\t--stage     B       D     D\n\t\t\t\t--work      D       D     D\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       B     C    C     --no-stage  B       B     C\n\t\t\t\t--stage     B       C     C\n\t\t\t\t--work      C       C     C\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       C     C    D     --no-stage  B       C     D\n\t\t\t\t--stage     B       D     D\n\t\t\t\t--work      D       D     D\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       C     C    C     --no-stage  B       C     C\n\t\t\t\t--stage     B       C     C\n\t\t\t\t--work      C       C     C\n\nIt might be possible to do 'git reset --no-stage --work', to reset the\nworking directory, but leave the staging area alone.\n\nFor more reference about the previous discussions:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/197111\nhttp://thread.gmane.org/gmane.comp.version-control.git/166675\nhttp://thread.gmane.org/gmane.comp.version-control.git/115666\n\nFelipe Contreras (14):\n  Add proper 'stage' command\n  stage: add edit command\n  diff: document --staged\n  grep: add --staged option\n  rm: add --staged option\n  stash: add --stage option to save\n  stash: add --stage to pop and apply\n  submodule: add --staged options\n  apply: add --stage option\n  apply: add --work, --no-work options\n  completion: update --staged options\n  reset: add --stage and --work options\n  reset: allow --keep with --stage\n  completion: update 'git reset' new stage options\n\n Documentation/git-apply.txt            |  11 ++-\n Documentation/git-diff.txt             |   4 +-\n Documentation/git-grep.txt             |   5 +-\n Documentation/git-reset.txt            |   8 +++\n Documentation/git-rm.txt               |   5 +-\n Documentation/git-stage.txt            |  50 +++++++++++--\n Documentation/git-stash.txt            |  14 ++--\n Documentation/git-submodule.txt        |   8 ++-\n Makefile                               |   2 +-\n builtin.h                              |   1 +\n builtin/apply.c                        |   7 ++\n builtin/grep.c                         |   2 +\n builtin/reset.c                        |  27 +++++++\n builtin/rm.c                           |   1 +\n builtin/stage.c                        | 126 +++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash |  39 ++++++++--\n git-stash.sh                           |  12 +++-\n git-submodule.sh                       |  10 +--\n git.c                                  |   2 +-\n 19 files changed, 297 insertions(+), 37 deletions(-)\n create mode 100644 builtin/stage.c\n\n-- \n1.8.4-fc\n"},{"id":"228870","messageId":"1381561488-20294-5-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 10/14] apply: add --work, --no-work options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:38Z","receivedAt":"2013-10-12T07:04:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"'git apply', 'git apply --index', 'git apply --cached' do different\nthings, but what they do is not precisely clear, specially since no\nother commands has similar distinctions.\n\nWith --no-work (--work being the default), it's clear what the option\nwould do; modify, or not, the working directory.\n\nSo, --work (the default), doesn't cause any changes, and --no-work\nenables the current --cache if used with --index.\n\nEventually --work might replace --cache, if these options are\nstandarized in the whole git toolset.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-apply.txt | 6 +++++-\n builtin/apply.c             | 5 +++++\n 2 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex ce44327..6167061 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -16,7 +16,7 @@ SYNOPSIS\n \t  [--ignore-space-change | --ignore-whitespace ]\n \t  [--whitespace=(nowarn|warn|fix|error|error-all)]\n \t  [--exclude=<path>] [--include=<path>] [--directory=<root>]\n-\t  [--verbose] [<patch>...]\n+\t  [--verbose] [--no-work] [<patch>...]\n \n DESCRIPTION\n -----------\n@@ -75,6 +75,10 @@ OPTIONS\n \tcached data, apply the patch, and store the result in the index\n \twithout using the working tree. This implies `--index`.\n \n+--[no-]work::\n+\tApply a patch with or without touching the working tree, essentially\n+\t`--no-work` plus `--index` are the equivalent of `--cached`.\n+\n -3::\n --3way::\n \tWhen the patch does not apply cleanly, fall back on 3-way merge if\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 42b5a4b..a3dd89d 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -4350,6 +4350,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \tint errs = 0;\n \tint is_not_gitdir = !startup_info->have_repository;\n \tint force_apply = 0;\n+\tint work = 1;\n \n \tconst char *whitespace_option = NULL;\n \n@@ -4381,6 +4382,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \t\t\tN_(\"make sure the patch is applicable to the current index\")),\n \t\tOPT_BOOLEAN(0, \"cached\", &cached,\n \t\t\tN_(\"apply a patch without touching the working tree\")),\n+\t\tOPT_BOOLEAN(0, \"work\", &work,\n+\t\t\tN_(\"modify the working tree\")),\n \t\tOPT_BOOLEAN(0, \"apply\", &force_apply,\n \t\t\tN_(\"also apply the patch (use with --stat/--summary/--check)\")),\n \t\tOPT_BOOL('3', \"3way\", &threeway,\n@@ -4433,6 +4436,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \targc = parse_options(argc, argv, prefix, builtin_apply_options,\n \t\t\tapply_usage, 0);\n \n+\tif (check_index && !work)\n+\t\tcached = 1;\n \tif (apply_with_reject && threeway)\n \t\tdie(\"--reject and --3way cannot be used together.\");\n \tif (cached && threeway)\n-- \n1.8.4-fc\n"},{"id":"228797","messageId":"1381561488-20294-6-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 01/14] Add proper 'stage' command","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:39Z","receivedAt":"2013-10-12T07:04:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stage.txt            | 45 +++++++++++++++++++++++++----\n Makefile                               |  2 +-\n builtin.h                              |  1 +\n builtin/stage.c                        | 52 ++++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash | 24 +++++++++++++++-\n git.c                                  |  2 +-\n 6 files changed, 118 insertions(+), 8 deletions(-)\n create mode 100644 builtin/stage.c\n\ndiff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt\nindex ba3fe0d..318bf45 100644\n--- a/Documentation/git-stage.txt\n+++ b/Documentation/git-stage.txt\n@@ -3,20 +3,55 @@ git-stage(1)\n \n NAME\n ----\n-git-stage - Add file contents to the staging area\n+git-stage - manage the staging area\n \n \n SYNOPSIS\n --------\n [verse]\n-'git stage' args...\n-\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>...]\n+'git stage apply' [options] [--] [<paths>...]\n \n DESCRIPTION\n -----------\n \n-This is a synonym for linkgit:git-add[1].  Please refer to the\n-documentation of that command.\n+\n+COMMANDS\n+--------\n+\n+With no arguments, it's a synonym for linkgit:git-add[1].\n+\n+'add'::\n+\n+Adds file contents to the staging area. See linkgit:git-add[1].\n+\n+'reset'::\n+\n+Resets the staging area. See linkgit:git-reset[1].\n+\n+'diff'::\n+\n+View the changes you staged for the next commit. See linkgit:git-diff[1] --staged.\n+\n+'rm'::\n+\n+Remove files from the staging area only. See linkgit:git-rm[1] --staged.\n+\n+'apply'::\n+\n+Apply a patch to the staging area. See linkgit:git-rm[1] --staged.\n+\n+SEE ALSO\n+--------\n+linkgit:git-add[1]\n+linkgit:git-reset[1]\n+linkgit:git-diff[1]\n+linkgit:git-rm[1]\n+linkgit:git-apply[1]\n \n GIT\n ---\ndiff --git a/Makefile b/Makefile\nindex 3588ca1..1f7ddf3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -598,7 +598,6 @@ BUILT_INS += git-merge-subtree$X\n BUILT_INS += git-peek-remote$X\n BUILT_INS += git-repo-config$X\n BUILT_INS += git-show$X\n-BUILT_INS += git-stage$X\n BUILT_INS += git-status$X\n BUILT_INS += git-whatchanged$X\n \n@@ -982,6 +981,7 @@ BUILTIN_OBJS += builtin/send-pack.o\n BUILTIN_OBJS += builtin/shortlog.o\n BUILTIN_OBJS += builtin/show-branch.o\n BUILTIN_OBJS += builtin/show-ref.o\n+BUILTIN_OBJS += builtin/stage.o\n BUILTIN_OBJS += builtin/stripspace.o\n BUILTIN_OBJS += builtin/symbolic-ref.o\n BUILTIN_OBJS += builtin/tag.o\ndiff --git a/builtin.h b/builtin.h\nindex 8afa2de..baf3a0f 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -113,6 +113,7 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);\n extern int cmd_shortlog(int argc, const char **argv, const char *prefix);\n extern int cmd_show(int argc, const char **argv, const char *prefix);\n extern int cmd_show_branch(int argc, const char **argv, const char *prefix);\n+extern int cmd_stage(int argc, const char **argv, const char *prefix);\n extern int cmd_status(int argc, const char **argv, const char *prefix);\n extern int cmd_stripspace(int argc, const char **argv, const char *prefix);\n extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);\ndiff --git a/builtin/stage.c b/builtin/stage.c\nnew file mode 100644\nindex 0000000..3023d17\n--- /dev/null\n+++ b/builtin/stage.c\n@@ -0,0 +1,52 @@\n+/*\n+ * 'git stage' builtin command\n+ *\n+ * Copyright (C) 2013 Felipe Contreras\n+ */\n+\n+#include \"builtin.h\"\n+#include \"parse-options.h\"\n+\n+static const char *const stage_usage[] = {\n+\tN_(\"git stage [options] [--] <paths>...\"),\n+\tN_(\"git stage add [options] [--] <paths>...\"),\n+\tN_(\"git stage reset [-q|--patch] [--] <paths>...\"),\n+\tN_(\"git stage diff [options] [<commit]> [--] <paths>...\"),\n+\tN_(\"git stage rm [options] [--] <paths>...\"),\n+\tNULL\n+};\n+\n+int cmd_stage(int argc, const char **argv, const char *prefix)\n+{\n+\tstruct option options[] = { OPT_END() };\n+\n+\targc = parse_options(argc, argv, prefix, options, stage_usage,\n+\t\t\tPARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);\n+\n+\tif (argc > 1) {\n+\t\tif (!strcmp(argv[1], \"add\"))\n+\t\t\treturn cmd_add(argc - 1, argv + 1, prefix);\n+\t\tif (!strcmp(argv[1], \"reset\"))\n+\t\t\treturn cmd_reset(argc - 1, argv + 1, prefix);\n+\t\tif (!strcmp(argv[1], \"diff\")) {\n+\t\t\targv[0] = \"diff\";\n+\t\t\targv[1] = \"--staged\";\n+\n+\t\t\treturn cmd_diff(argc, argv, prefix);\n+\t\t}\n+\t\tif (!strcmp(argv[1], \"rm\")) {\n+\t\t\targv[0] = \"rm\";\n+\t\t\targv[1] = \"--cached\";\n+\n+\t\t\treturn cmd_rm(argc, argv, prefix);\n+\t\t}\n+\t\tif (!strcmp(argv[1], \"apply\")) {\n+\t\t\targv[0] = \"apply\";\n+\t\t\targv[1] = \"--cached\";\n+\n+\t\t\treturn cmd_apply(argc, argv, prefix);\n+\t\t}\n+\t}\n+\n+\treturn cmd_add(argc, argv, prefix);\n+}\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 5da920e..8cf26e2 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1691,7 +1691,29 @@ _git_send_email ()\n \n _git_stage ()\n {\n-\t_git_add\n+\t__git_has_doubledash && return\n+\n+\tlocal subcommands=\"add reset diff rm apply\"\n+\tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n+\tif [ -z \"$subcommand\" ]; then\n+\t\t__gitcomp \"$subcommands\"\n+\t\treturn\n+\tfi\n+\n+\tcase \"$subcommand\" in\n+\tadd)\n+\t\t_git_add;;\n+\treset)\n+\t\t_git_reset;;\n+\tdiff)\n+\t\t_git_diff;;\n+\trm)\n+\t\t_git_rm;;\n+\tapply)\n+\t\t_git_apply;;\n+\t*)\n+\t\t_git_add;\n+\tesac\n }\n \n __git_config_get_set_variables ()\ndiff --git a/git.c b/git.c\nindex 2025f77..0e639aa 100644\n--- a/git.c\n+++ b/git.c\n@@ -409,7 +409,7 @@ static void handle_internal_command(int argc, const char **argv)\n \t\t{ \"show\", cmd_show, RUN_SETUP },\n \t\t{ \"show-branch\", cmd_show_branch, RUN_SETUP },\n \t\t{ \"show-ref\", cmd_show_ref, RUN_SETUP },\n-\t\t{ \"stage\", cmd_add, RUN_SETUP | NEED_WORK_TREE },\n+\t\t{ \"stage\", cmd_stage, RUN_SETUP | NEED_WORK_TREE },\n \t\t{ \"status\", cmd_status, RUN_SETUP | NEED_WORK_TREE },\n \t\t{ \"stripspace\", cmd_stripspace },\n \t\t{ \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n-- \n1.8.4-fc\n"},{"id":"228868","messageId":"1381561488-20294-7-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 09/14] apply: add --stage option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:40Z","receivedAt":"2013-10-12T07:04:40Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --index.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-apply.txt | 5 ++++-\n builtin/apply.c             | 2 ++\n 2 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex f605327..ce44327 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n 'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]\n \t  [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]\n \t  [--allow-binary-replacement | --binary] [--reject] [-z]\n-\t  [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]\n+\t  [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached|--staged]\n \t  [--ignore-space-change | --ignore-whitespace ]\n \t  [--whitespace=(nowarn|warn|fix|error|error-all)]\n \t  [--exclude=<path>] [--include=<path>] [--directory=<root>]\n@@ -67,6 +67,9 @@ OPTIONS\n \tup-to-date, it is flagged as an error.  This flag also\n \tcauses the index file to be updated.\n \n+--staged::\n+\tSynonym for --index.\n+\n --cached::\n \tApply a patch without touching the working tree. Instead take the\n \tcached data, apply the patch, and store the result in the index\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 50912c9..42b5a4b 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \t\t\tN_(\"instead of applying the patch, see if the patch is applicable\")),\n \t\tOPT_BOOLEAN(0, \"index\", &check_index,\n \t\t\tN_(\"make sure the patch is applicable to the current index\")),\n+\t\tOPT_BOOLEAN(0, \"stage\", &check_index,\n+\t\t\tN_(\"make sure the patch is applicable to the current index\")),\n \t\tOPT_BOOLEAN(0, \"cached\", &cached,\n \t\t\tN_(\"apply a patch without touching the working tree\")),\n \t\tOPT_BOOLEAN(0, \"apply\", &force_apply,\n-- \n1.8.4-fc\n"},{"id":"228869","messageId":"1381561488-20294-8-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 03/14] diff: document --staged","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:41Z","receivedAt":"2013-10-12T07:04:41Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-diff.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 78d6d50..646e5cd 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git diff' [options] [<commit>] [--] [<path>...]\n-'git diff' [options] --cached [<commit>] [--] [<path>...]\n+'git diff' [options] [--cached|--staged] [<commit>] [--] [<path>...]\n 'git diff' [options] <commit> <commit> [--] [<path>...]\n 'git diff' [options] <blob> <blob>\n 'git diff' [options] [--no-index] [--] <path> <path>\n@@ -33,7 +33,7 @@ If exactly two paths are given and at least one points outside\n the current repository, 'git diff' will compare the two files /\n directories. This behavior can be forced by --no-index.\n \n-'git diff' [--options] --cached [<commit>] [--] [<path>...]::\n+'git diff' [--options] [--cached|--staged] [<commit>] [--] [<path>...]::\n \n \tThis form is to view the changes you staged for the next\n \tcommit relative to the named <commit>.  Typically you\n-- \n1.8.4-fc\n"},{"id":"228806","messageId":"1381561488-20294-9-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 05/14] rm: add --staged option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:42Z","receivedAt":"2013-10-12T07:04:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-rm.txt | 5 ++++-\n builtin/rm.c             | 1 +\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt\nindex 1d876c2..156b40d 100644\n--- a/Documentation/git-rm.txt\n+++ b/Documentation/git-rm.txt\n@@ -8,7 +8,7 @@ git-rm - Remove files from the working tree and from the index\n SYNOPSIS\n --------\n [verse]\n-'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...\n+'git rm' [-f | --force] [-n] [-r] [--cached | --staged] [--ignore-unmatch] [--quiet] [--] <file>...\n \n DESCRIPTION\n -----------\n@@ -60,6 +60,9 @@ OPTIONS\n \tWorking tree files, whether modified or not, will be\n \tleft alone.\n \n+--staged::\n+\tSynonym for --cached.\n+\n --ignore-unmatch::\n \tExit with a zero status even if no files matched.\n \ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 0df0b4d..919911f 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -268,6 +268,7 @@ static struct option builtin_rm_options[] = {\n \tOPT__DRY_RUN(&show_only, N_(\"dry run\")),\n \tOPT__QUIET(&quiet, N_(\"do not list removed files\")),\n \tOPT_BOOLEAN( 0 , \"cached\",         &index_only, N_(\"only remove from the index\")),\n+\tOPT_BOOLEAN( 0 , \"staged\",         &index_only, N_(\"only remove from the index\")),\n \tOPT__FORCE(&force, N_(\"override the up-to-date check\")),\n \tOPT_BOOLEAN('r', NULL,             &recursive,  N_(\"allow recursive removal\")),\n \tOPT_BOOLEAN( 0 , \"ignore-unmatch\", &ignore_unmatch,\n-- \n1.8.4-fc\n"},{"id":"228798","messageId":"1381561488-20294-10-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 02/14] stage: add edit command","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:43Z","receivedAt":"2013-10-12T07:04:43Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stage.txt            |  5 +++\n builtin/stage.c                        | 74 ++++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash |  4 +-\n 3 files changed, 82 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt\nindex 318bf45..3e52a66 100644\n--- a/Documentation/git-stage.txt\n+++ b/Documentation/git-stage.txt\n@@ -15,6 +15,7 @@ SYNOPSIS\n 'git stage diff' [options] [<commit>] [--] [<paths>...]\n 'git stage rm' [options] [--] [<paths>...]\n 'git stage apply' [options] [--] [<paths>...]\n+'git stage edit'\n \n DESCRIPTION\n -----------\n@@ -45,6 +46,10 @@ Remove files from the staging area only. See linkgit:git-rm[1] --staged.\n \n Apply a patch to the staging area. See linkgit:git-rm[1] --staged.\n \n+'edit'::\n+\n+Manually edit the staging area (as a diff).\n+\n SEE ALSO\n --------\n linkgit:git-add[1]\ndiff --git a/builtin/stage.c b/builtin/stage.c\nindex 3023d17..d3c58d5 100644\n--- a/builtin/stage.c\n+++ b/builtin/stage.c\n@@ -6,6 +6,9 @@\n \n #include \"builtin.h\"\n #include \"parse-options.h\"\n+#include \"diff.h\"\n+#include \"diffcore.h\"\n+#include \"revision.h\"\n \n static const char *const stage_usage[] = {\n \tN_(\"git stage [options] [--] <paths>...\"),\n@@ -16,6 +19,74 @@ static const char *const stage_usage[] = {\n \tNULL\n };\n \n+static int do_reset(const char *prefix)\n+{\n+\tconst char *argv[] = { \"reset\", \"--quiet\", NULL };\n+\treturn cmd_reset(2, argv, prefix);\n+}\n+\n+static int do_apply(const char *file, const char *prefix)\n+{\n+\tconst char *argv[] = { \"apply\", \"--recount\", \"--cached\", file, NULL };\n+\treturn cmd_apply(4, argv, prefix);\n+}\n+\n+static int edit(int argc, const char **argv, const char *prefix)\n+{\n+\tchar *file = git_pathdup(\"STAGE_EDIT.patch\");\n+\tint out;\n+\tstruct rev_info rev;\n+\tint ret = 0;\n+\tstruct stat st;\n+\n+\tread_cache();\n+\n+\tinit_revisions(&rev, prefix);\n+\trev.diffopt.context = 7;\n+\n+\targc = setup_revisions(argc, argv, &rev, NULL);\n+\tadd_head_to_pending(&rev);\n+\tif (!rev.pending.nr) {\n+\t\tstruct tree *tree;\n+\t\ttree = lookup_tree(EMPTY_TREE_SHA1_BIN);\n+\t\tadd_pending_object(&rev, &tree->object, \"HEAD\");\n+\t}\n+\n+\trev.diffopt.output_format = DIFF_FORMAT_PATCH;\n+\trev.diffopt.use_color = 0;\n+\tDIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);\n+\n+\tout = open(file, O_CREAT | O_WRONLY, 0666);\n+\tif (out < 0)\n+\t\tdie(_(\"Could not open '%s' for writing.\"), file);\n+\trev.diffopt.file = xfdopen(out, \"w\");\n+\trev.diffopt.close_file = 1;\n+\n+\tif (run_diff_index(&rev, 1))\n+\t\tdie(_(\"Could not write patch\"));\n+\tif (launch_editor(file, NULL, NULL))\n+\t\texit(1);\n+\n+\tif (stat(file, &st))\n+\t\tdie_errno(_(\"Could not stat '%s'\"), file);\n+\n+\tret = do_reset(prefix);\n+\tif (ret)\n+\t\tgoto leave;\n+\n+\tif (!st.st_size)\n+\t\tgoto leave;\n+\n+\tret = do_apply(file, prefix);\n+\tif (ret)\n+\t\tgoto leave;\n+\n+leave:\n+\tunlink(file);\n+\tfree(file);\n+\treturn ret;\n+}\n+\n int cmd_stage(int argc, const char **argv, const char *prefix)\n {\n \tstruct option options[] = { OPT_END() };\n@@ -46,6 +117,9 @@ int cmd_stage(int argc, const char **argv, const char *prefix)\n \n \t\t\treturn cmd_apply(argc, argv, prefix);\n \t\t}\n+\t\tif (!strcmp(argv[1], \"edit\")) {\n+\t\t\treturn edit(argc - 1, argv + 1, prefix);\n+\t\t}\n \t}\n \n \treturn cmd_add(argc, argv, prefix);\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 8cf26e2..2b81e78 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1693,7 +1693,7 @@ _git_stage ()\n {\n \t__git_has_doubledash && return\n \n-\tlocal subcommands=\"add reset diff rm apply\"\n+\tlocal subcommands=\"add reset diff rm apply edit\"\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n \t\t__gitcomp \"$subcommands\"\n@@ -1711,6 +1711,8 @@ _git_stage ()\n \t\t_git_rm;;\n \tapply)\n \t\t_git_apply;;\n+\tedit)\n+\t\t;;\n \t*)\n \t\t_git_add;\n \tesac\n-- \n1.8.4-fc\n"},{"id":"228808","messageId":"1381561488-20294-11-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 13/14] reset: allow --keep with --stage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:44Z","receivedAt":"2013-10-12T07:04:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-reset.txt |  2 +-\n builtin/reset.c             | 13 ++++++++++---\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 5cd75a8..a1419c9 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n 'git reset' [-q] [<tree-ish>] [--] <paths>...\n 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]\n 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n-'git reset' [--stage | --work] [-q] [<commit>]\n+'git reset' [--stage | --work | --keep] [-q] [<commit>]\n \n DESCRIPTION\n -----------\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex fbc1abc..dde03a7 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -23,7 +23,7 @@\n \n static const char * const git_reset_usage[] = {\n \tN_(\"git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]\"),\n-\tN_(\"git reset [--stage | --work] [-q] [<commit>]\"),\n+\tN_(\"git reset [--stage | --work | --keep] [-q] [<commit>]\"),\n \tN_(\"git reset [-q] <tree-ish> [--] <paths>...\"),\n \tN_(\"git reset --patch [<tree-ish>] [--] [<paths>...]\"),\n \tNULL\n@@ -295,8 +295,15 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (stage >= 0 || working_tree >= 0) {\n-\t\tif (reset_type != NONE)\n+\t\tint keep = 0;\n+\n+\t\tif (reset_type == KEEP) {\n+\t\t\tif (working_tree == 1)\n+\t\t\t\tdie(_(\"--keep is incompatible with --work\"));\n+\t\t\tkeep = 1;\n+\t\t} else if (reset_type != NONE) {\n \t\t\tdie(_(\"--{stage,work} are incompatible with --{hard,mixed,soft,merge}\"));\n+\t\t}\n \n \t\tif (working_tree == 1) {\n \t\t\tif (stage == 0)\n@@ -304,7 +311,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\t\treset_type = HARD;\n \t\t} else {\n \t\t\tif (stage == 1)\n-\t\t\t\treset_type = NONE;\n+\t\t\t\treset_type = keep ? KEEP : NONE;\n \t\t\telse\n \t\t\t\treset_type = SOFT;\n \t\t}\n-- \n1.8.4-fc\n"},{"id":"228799","messageId":"1381561488-20294-12-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 12/14] reset: add --stage and --work options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:45Z","receivedAt":"2013-10-12T07:04:45Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-reset.txt |  8 ++++++++\n builtin/reset.c             | 20 ++++++++++++++++++++\n 2 files changed, 28 insertions(+)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex f445cb3..5cd75a8 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -11,6 +11,7 @@ SYNOPSIS\n 'git reset' [-q] [<tree-ish>] [--] <paths>...\n 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]\n 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n+'git reset' [--stage | --work] [-q] [<commit>]\n \n DESCRIPTION\n -----------\n@@ -81,6 +82,13 @@ but carries forward unmerged index entries.\n \tdifferent between <commit> and HEAD.\n \tIf a file that is different between <commit> and HEAD has local changes,\n \treset is aborted.\n+\n+--stage::\n+\tReset the index, basically `--mixed`. `--no-stage` is the equivalent of\n+\t`--soft`.\n+\n+--work::\n+\tResets the working tree, basically `--hard`.\n --\n \n If you want to undo a commit other than the latest on a branch,\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex afa6e02..fbc1abc 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -23,6 +23,7 @@\n \n static const char * const git_reset_usage[] = {\n \tN_(\"git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]\"),\n+\tN_(\"git reset [--stage | --work] [-q] [<commit>]\"),\n \tN_(\"git reset [-q] <tree-ish> [--] <paths>...\"),\n \tN_(\"git reset --patch [<tree-ish>] [--] [<paths>...]\"),\n \tNULL\n@@ -243,6 +244,7 @@ static int update_refs(const char *rev, const unsigned char *sha1)\n int cmd_reset(int argc, const char **argv, const char *prefix)\n {\n \tint reset_type = NONE, update_ref_status = 0, quiet = 0;\n+\tint stage = -1, working_tree = -1;\n \tint patch_mode = 0, unborn;\n \tconst char *rev;\n \tunsigned char sha1[20];\n@@ -258,6 +260,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\t\t\tN_(\"reset HEAD, index and working tree\"), MERGE),\n \t\tOPT_SET_INT(0, \"keep\", &reset_type,\n \t\t\t\tN_(\"reset HEAD but keep local changes\"), KEEP),\n+\t\tOPT_BOOL(0, \"stage\", &stage, N_(\"reset index\")),\n+\t\tOPT_BOOL(0, \"work\", &working_tree, N_(\"reset working tree\")),\n \t\tOPT_BOOLEAN('p', \"patch\", &patch_mode, N_(\"select hunks interactively\")),\n \t\tOPT_END()\n \t};\n@@ -290,6 +294,22 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\thashcpy(sha1, tree->object.sha1);\n \t}\n \n+\tif (stage >= 0 || working_tree >= 0) {\n+\t\tif (reset_type != NONE)\n+\t\t\tdie(_(\"--{stage,work} are incompatible with --{hard,mixed,soft,merge}\"));\n+\n+\t\tif (working_tree == 1) {\n+\t\t\tif (stage == 0)\n+\t\t\t\tdie(_(\"--no-stage doesn't make sense with --work\"));\n+\t\t\treset_type = HARD;\n+\t\t} else {\n+\t\t\tif (stage == 1)\n+\t\t\t\treset_type = NONE;\n+\t\t\telse\n+\t\t\t\treset_type = SOFT;\n+\t\t}\n+\t}\n+\n \tif (patch_mode) {\n \t\tif (reset_type != NONE)\n \t\t\tdie(_(\"--patch is incompatible with --{hard,mixed,soft}\"));\n-- \n1.8.4-fc\n"},{"id":"228804","messageId":"1381561488-20294-13-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 08/14] submodule: add --staged options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:46Z","receivedAt":"2013-10-12T07:04:46Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-submodule.txt |  8 ++++++--\n git-submodule.sh                | 10 +++++-----\n 2 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex bfef8a0..904e007 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -11,13 +11,13 @@ SYNOPSIS\n [verse]\n 'git submodule' [--quiet] add [-b <branch>] [-f|--force] [--name <name>]\n \t      [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]\n-'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]\n+'git submodule' [--quiet] status [--cached|--staged] [--recursive] [--] [<path>...]\n 'git submodule' [--quiet] init [--] [<path>...]\n 'git submodule' [--quiet] deinit [-f|--force] [--] <path>...\n 'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]\n \t      [-f|--force] [--rebase] [--reference <repository>] [--depth <depth>]\n \t      [--merge] [--recursive] [--] [<path>...]\n-'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]\n+'git submodule' [--quiet] summary [--cached|--staged|--files] [(-n|--summary-limit) <n>]\n \t      [commit] [--] [<path>...]\n 'git submodule' [--quiet] foreach [--recursive] <command>\n 'git submodule' [--quiet] sync [--] [<path>...]\n@@ -248,6 +248,10 @@ OPTIONS\n \tcommands typically use the commit found in the submodule HEAD, but\n \twith this option, the commit stored in the index is used instead.\n \n+\n+--staged::\n+\tSynonym for `--cached`.\n+\n --files::\n \tThis option is only valid for the summary command. This command\n \tcompares the commit in the index with that in the submodule HEAD\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 2979197..823b783 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -6,11 +6,11 @@\n \n dashless=$(basename \"$0\" | sed -e 's/-/ /')\n USAGE=\"[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]\n-   or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]\n+   or: $dashless [--quiet] status [--cached|--staged] [--recursive] [--] [<path>...]\n    or: $dashless [--quiet] init [--] [<path>...]\n    or: $dashless [--quiet] deinit [-f|--force] [--] <path>...\n    or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n-   or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n+   or: $dashless [--quiet] summary [--cached|--staged|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n    or: $dashless [--quiet] foreach [--recursive] <command>\n    or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n OPTIONS_SPEC=\n@@ -972,7 +972,7 @@ cmd_summary() {\n \twhile test $# -ne 0\n \tdo\n \t\tcase \"$1\" in\n-\t\t--cached)\n+\t\t--cached|--staged)\n \t\t\tcached=\"$1\"\n \t\t\t;;\n \t\t--files)\n@@ -1181,7 +1181,7 @@ cmd_status()\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n-\t\t--cached)\n+\t\t--cached|--staged)\n \t\t\tcached=1\n \t\t\t;;\n \t\t--recursive)\n@@ -1348,7 +1348,7 @@ do\n \t\tesac\n \t\tbranch=\"$2\"; shift\n \t\t;;\n-\t--cached)\n+\t--cached|--staged)\n \t\tcached=\"$1\"\n \t\t;;\n \t--)\n-- \n1.8.4-fc\n"},{"id":"228807","messageId":"1381561488-20294-14-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 11/14] completion: update --staged options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:47Z","receivedAt":"2013-10-12T07:04:47Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 2b81e78..1dde51f 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -881,7 +881,7 @@ _git_apply ()\n \t\t__gitcomp \"\n \t\t\t--stat --numstat --summary --check --index\n \t\t\t--cached --index-info --reverse --reject --unidiff-zero\n-\t\t\t--apply --no-add --exclude=\n+\t\t\t--apply --no-add --exclude= --staged\n \t\t\t--ignore-whitespace --ignore-space-change\n \t\t\t--whitespace= --inaccurate-eof --verbose\n \t\t\t\"\n@@ -1294,7 +1294,7 @@ _git_grep ()\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp \"\n-\t\t\t--cached\n+\t\t\t--cached --staged\n \t\t\t--text --ignore-case --word-regexp --invert-match\n \t\t\t--full-name --line-number\n \t\t\t--extended-regexp --basic-regexp --fixed-strings\n@@ -2253,7 +2253,7 @@ _git_rm ()\n {\n \tcase \"$cur\" in\n \t--*)\n-\t\t__gitcomp \"--cached --dry-run --ignore-unmatch --quiet\"\n+\t\t__gitcomp \"--cached --staged --dry-run --ignore-unmatch --quiet\"\n \t\treturn\n \t\t;;\n \tesac\n@@ -2320,7 +2320,7 @@ _git_show_branch ()\n \n _git_stash ()\n {\n-\tlocal save_opts='--keep-index --no-keep-index --quiet --patch'\n+\tlocal save_opts='--keep-index --no-keep-index --stage --no-stage --quiet --patch'\n \tlocal subcommands='save list show apply clear drop pop create branch'\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n@@ -2340,7 +2340,7 @@ _git_stash ()\n \t\t\t__gitcomp \"$save_opts\"\n \t\t\t;;\n \t\tapply,--*|pop,--*)\n-\t\t\t__gitcomp \"--index --quiet\"\n+\t\t\t__gitcomp \"--index --stage --quiet\"\n \t\t\t;;\n \t\tshow,--*|drop,--*|branch,--*)\n \t\t\t;;\n-- \n1.8.4-fc\n"},{"id":"228805","messageId":"1381561488-20294-15-git-send-email-felipe.contreras@gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH try2 06/14] stash: add --stage option to save","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-12T07:04:48Z","receivedAt":"2013-10-12T07:04:48Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"--no-stage is synonym for --keep-index.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stash.txt | 6 +++---\n git-stash.sh                | 8 +++++++-\n 2 files changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex db7e803..75b4cc6 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -13,7 +13,7 @@ SYNOPSIS\n 'git stash' drop [-q|--quiet] [<stash>]\n 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n 'git stash' branch <branchname> [<stash>]\n-'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n+'git stash' [save [-p|--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t     [-u|--include-untracked] [-a|--all] [<message>]]\n 'git stash' clear\n 'git stash' create [<message>]\n@@ -44,7 +44,7 @@ is also possible).\n OPTIONS\n -------\n \n-save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::\n+save [-p|--patch] [--[no-]keep-index|--[no-]stage] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::\n \n \tSave your local modifications to a new 'stash', and run `git reset\n \t--hard` to revert them.  The <message> part is optional and gives\n@@ -54,7 +54,7 @@ save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--\n \tsubcommand from making an unwanted stash.\n +\n If the `--keep-index` option is used, all changes already added to the\n-index are left intact.\n+index are left intact. Same with `--no-stage`, which is a snynonym.\n +\n If the `--include-untracked` option is used, all untracked files are also\n stashed and then cleaned up with `git clean`, leaving the working directory\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 1e541a2..47220d0 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -7,7 +7,7 @@ USAGE=\"list [<options>]\n    or: $dashless drop [-q|--quiet] [<stash>]\n    or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n    or: $dashless branch <branchname> [<stash>]\n-   or: $dashless [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]\n+   or: $dashless [save [--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t\t       [-u|--include-untracked] [-a|--all] [<message>]]\n    or: $dashless clear\"\n \n@@ -204,6 +204,12 @@ save_stash () {\n \t\t--no-keep-index)\n \t\t\tkeep_index=n\n \t\t\t;;\n+\t\t--stage)\n+\t\t\tkeep_index=n\n+\t\t\t;;\n+\t\t--no-stage)\n+\t\t\tkeep_index=t\n+\t\t\t;;\n \t\t-p|--patch)\n \t\t\tpatch_mode=t\n \t\t\t# only default to keep if we don't already have an override\n-- \n1.8.4-fc\n"},{"id":"228897","messageId":"CAPig+cSmVKK_onR8NtLkdahkFci77SCsU6PagyJEBYLo4xZBUQ@mail.gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-7-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH try2 09/14] apply: add --stage option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-10-13T09:53:37Z","receivedAt":"2013-10-13T09:53:37Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n> Synonym for --index.\n>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  Documentation/git-apply.txt | 5 ++++-\n>  builtin/apply.c             | 2 ++\n>  2 files changed, 6 insertions(+), 1 deletion(-)\n>\n> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\n> index f605327..ce44327 100644\n> --- a/Documentation/git-apply.txt\n> +++ b/Documentation/git-apply.txt\n> @@ -12,7 +12,7 @@ SYNOPSIS\n>  'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]\n>           [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]\n>           [--allow-binary-replacement | --binary] [--reject] [-z]\n> -         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]\n> +         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached|--staged]\n\nHere \"staged\".\n\n>           [--ignore-space-change | --ignore-whitespace ]\n>           [--whitespace=(nowarn|warn|fix|error|error-all)]\n>           [--exclude=<path>] [--include=<path>] [--directory=<root>]\n> @@ -67,6 +67,9 @@ OPTIONS\n>         up-to-date, it is flagged as an error.  This flag also\n>         causes the index file to be updated.\n>\n> +--staged::\n> +       Synonym for --index.\n> +\n\nAlso \"staged\".\n\n>  --cached::\n>         Apply a patch without touching the working tree. Instead take the\n>         cached data, apply the patch, and store the result in the index\n> diff --git a/builtin/apply.c b/builtin/apply.c\n> index 50912c9..42b5a4b 100644\n> --- a/builtin/apply.c\n> +++ b/builtin/apply.c\n> @@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n>                         N_(\"instead of applying the patch, see if the patch is applicable\")),\n>                 OPT_BOOLEAN(0, \"index\", &check_index,\n>                         N_(\"make sure the patch is applicable to the current index\")),\n> +               OPT_BOOLEAN(0, \"stage\", &check_index,\n\nBut here \"stage\".\n\n> +                       N_(\"make sure the patch is applicable to the current index\")),\n>                 OPT_BOOLEAN(0, \"cached\", &cached,\n>                         N_(\"apply a patch without touching the working tree\")),\n>                 OPT_BOOLEAN(0, \"apply\", &force_apply,\n> --\n> 1.8.4-fc\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"228900","messageId":"CAMP44s153nOGxS+Z_AYOUw+JxmOi_QSbweAb82AU8yy1H580kw@mail.gmail.com","threadId":"35121","inReplyTo":"CAPig+cSmVKK_onR8NtLkdahkFci77SCsU6PagyJEBYLo4xZBUQ@mail.gmail.com","subject":"Re: [PATCH try2 09/14] apply: add --stage option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-13T10:16:26Z","receivedAt":"2013-10-13T10:16:26Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sun, Oct 13, 2013 at 4:53 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n>> Synonym for --index.\n>>\n>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n>> ---\n>>  Documentation/git-apply.txt | 5 ++++-\n>>  builtin/apply.c             | 2 ++\n>>  2 files changed, 6 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\n>> index f605327..ce44327 100644\n>> --- a/Documentation/git-apply.txt\n>> +++ b/Documentation/git-apply.txt\n>> @@ -12,7 +12,7 @@ SYNOPSIS\n>>  'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]\n>>           [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]\n>>           [--allow-binary-replacement | --binary] [--reject] [-z]\n>> -         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]\n>> +         [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached|--staged]\n>\n> Here \"staged\".\n>\n>>           [--ignore-space-change | --ignore-whitespace ]\n>>           [--whitespace=(nowarn|warn|fix|error|error-all)]\n>>           [--exclude=<path>] [--include=<path>] [--directory=<root>]\n>> @@ -67,6 +67,9 @@ OPTIONS\n>>         up-to-date, it is flagged as an error.  This flag also\n>>         causes the index file to be updated.\n>>\n>> +--staged::\n>> +       Synonym for --index.\n>> +\n>\n> Also \"staged\".\n>\n>>  --cached::\n>>         Apply a patch without touching the working tree. Instead take the\n>>         cached data, apply the patch, and store the result in the index\n>> diff --git a/builtin/apply.c b/builtin/apply.c\n>> index 50912c9..42b5a4b 100644\n>> --- a/builtin/apply.c\n>> +++ b/builtin/apply.c\n>> @@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n>>                         N_(\"instead of applying the patch, see if the patch is applicable\")),\n>>                 OPT_BOOLEAN(0, \"index\", &check_index,\n>>                         N_(\"make sure the patch is applicable to the current index\")),\n>> +               OPT_BOOLEAN(0, \"stage\", &check_index,\n>\n> But here \"stage\".\n\nRight. Should be \"staged\".\n\n-- \nFelipe Contreras\n"},{"id":"228901","messageId":"CADCnXoaeF9Avjy08C_eJN3YJAMbGZXh6mkKjj4sgfaED=b_GnA@mail.gmail.com","threadId":"35121","inReplyTo":"CAPig+cSmVKK_onR8NtLkdahkFci77SCsU6PagyJEBYLo4xZBUQ@mail.gmail.com","subject":"Re: [PATCH try2 09/14] apply: add --stage option","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2013-10-13T10:19:21Z","receivedAt":"2013-10-13T10:19:21Z","isPatch":true,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"2013/10/13 Eric Sunshine <sunshine@sunshineco.com>:\n> Here \"staged\".\n...\n> But here \"stage\".\n\nThe inconsistency is weird, but isn't the term \"staged\" a bit odd with\nsomething that affects the future...?\n\n\"Apply to the stage\" seems a reasonable english phrasing, but \"staged\"\nseems more awkward...\n\n-miles\n\n-- \nCat is power.  Cat is peace.\n"},{"id":"228902","messageId":"CAMP44s2sZfXOiNcK3ScJnV=un9ra8k2ONmEmcuNHNRh1nH42Sw@mail.gmail.com","threadId":"35121","inReplyTo":"CADCnXoaeF9Avjy08C_eJN3YJAMbGZXh6mkKjj4sgfaED=b_GnA@mail.gmail.com","subject":"Re: [PATCH try2 09/14] apply: add --stage option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-13T10:31:31Z","receivedAt":"2013-10-13T10:31:31Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Sun, Oct 13, 2013 at 5:19 AM, Miles Bader <miles@gnu.org> wrote:\n> 2013/10/13 Eric Sunshine <sunshine@sunshineco.com>:\n>> Here \"staged\".\n> ...\n>> But here \"stage\".\n>\n> The inconsistency is weird, but isn't the term \"staged\" a bit odd with\n> something that affects the future...?\n>\n> \"Apply to the stage\" seems a reasonable english phrasing, but \"staged\"\n> seems more awkward...\n\nThat's true, I was thinking since this was supposed to be a\nnon-intrusive change, it would make sense to keep close to the\n--cached option, but the synonym is actually --index, not --cached. So\n--stage makes more sense from those two points of view.\n\n-- \nFelipe Contreras\n"},{"id":"228944","messageId":"CAPig+cQN5e8hOKTvHRKUQoLmctUWbAqTydgfY10Kr4AzHtB7kg@mail.gmail.com","threadId":"35121","inReplyTo":"1381561488-20294-6-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH try2 01/14] Add proper 'stage' command","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-10-14T19:44:11Z","receivedAt":"2013-10-14T19:44:11Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras\n<felipe.contreras@gmail.com> wrote:\n>  SYNOPSIS\n>  --------\n>  [verse]\n> -'git stage' args...\n> -\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>...]\n> +'git stage apply' [options] [--] [<paths>...]\n>\n> diff --git a/builtin/stage.c b/builtin/stage.c\n> new file mode 100644\n> index 0000000..3023d17\n> --- /dev/null\n> +++ b/builtin/stage.c\n> @@ -0,0 +1,52 @@\n> +/*\n> + * 'git stage' builtin command\n> + *\n> + * Copyright (C) 2013 Felipe Contreras\n> + */\n> +\n> +#include \"builtin.h\"\n> +#include \"parse-options.h\"\n> +\n> +static const char *const stage_usage[] = {\n> +       N_(\"git stage [options] [--] <paths>...\"),\n> +       N_(\"git stage add [options] [--] <paths>...\"),\n> +       N_(\"git stage reset [-q|--patch] [--] <paths>...\"),\n> +       N_(\"git stage diff [options] [<commit]> [--] <paths>...\"),\n> +       N_(\"git stage rm [options] [--] <paths>...\"),\n> +       NULL\n> +};\n\nMissing usage for \"git stage apply\".\n\n> +\n> +int cmd_stage(int argc, const char **argv, const char *prefix)\n> +{\n> +       struct option options[] = { OPT_END() };\n> +\n> +       argc = parse_options(argc, argv, prefix, options, stage_usage,\n> +                       PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);\n> +\n> +       if (argc > 1) {\n> +               if (!strcmp(argv[1], \"add\"))\n> +                       return cmd_add(argc - 1, argv + 1, prefix);\n> +               if (!strcmp(argv[1], \"reset\"))\n> +                       return cmd_reset(argc - 1, argv + 1, prefix);\n> +               if (!strcmp(argv[1], \"diff\")) {\n> +                       argv[0] = \"diff\";\n> +                       argv[1] = \"--staged\";\n> +\n> +                       return cmd_diff(argc, argv, prefix);\n> +               }\n> +               if (!strcmp(argv[1], \"rm\")) {\n> +                       argv[0] = \"rm\";\n> +                       argv[1] = \"--cached\";\n> +\n> +                       return cmd_rm(argc, argv, prefix);\n> +               }\n> +               if (!strcmp(argv[1], \"apply\")) {\n> +                       argv[0] = \"apply\";\n> +                       argv[1] = \"--cached\";\n> +\n> +                       return cmd_apply(argc, argv, prefix);\n> +               }\n> +       }\n> +\n> +       return cmd_add(argc, argv, prefix);\n> +}\n"},{"id":"228952","messageId":"525c6ea918b6a_235dd2be7837@nysa.notmuch","threadId":"35121","inReplyTo":"CAPig+cQN5e8hOKTvHRKUQoLmctUWbAqTydgfY10Kr4AzHtB7kg@mail.gmail.com","subject":"Re: [PATCH try2 01/14] Add proper 'stage' command","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-10-14T22:22:33Z","receivedAt":"2013-10-14T22:22:33Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Eric Sunshine wrote:\n> On Sat, Oct 12, 2013 at 3:04 AM, Felipe Contreras\n> <felipe.contreras@gmail.com> wrote:\n> >  SYNOPSIS\n> >  --------\n> >  [verse]\n> > -'git stage' args...\n> > -\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>...]\n> > +'git stage apply' [options] [--] [<paths>...]\n> >\n> > diff --git a/builtin/stage.c b/builtin/stage.c\n> > new file mode 100644\n> > index 0000000..3023d17\n> > --- /dev/null\n> > +++ b/builtin/stage.c\n> > @@ -0,0 +1,52 @@\n> > +/*\n> > + * 'git stage' builtin command\n> > + *\n> > + * Copyright (C) 2013 Felipe Contreras\n> > + */\n> > +\n> > +#include \"builtin.h\"\n> > +#include \"parse-options.h\"\n> > +\n> > +static const char *const stage_usage[] = {\n> > +       N_(\"git stage [options] [--] <paths>...\"),\n> > +       N_(\"git stage add [options] [--] <paths>...\"),\n> > +       N_(\"git stage reset [-q|--patch] [--] <paths>...\"),\n> > +       N_(\"git stage diff [options] [<commit]> [--] <paths>...\"),\n> > +       N_(\"git stage rm [options] [--] <paths>...\"),\n> > +       NULL\n> > +};\n> \n> Missing usage for \"git stage apply\".\n\nRight. Will add\n\n-- \nFelipe Contreras\n"}]}