{"thread":{"id":"16109","subject":"[PATCH] prepare deprecation of git-revert","startedAt":"2008-10-31T15:55:27Z","lastAt":"2008-11-02T16:12:09Z","messageCount":16,"participants":["Pierre Habouzit","Jakub Narebski","Alex Riesen","Theodore Tso","Johannes Schindelin","Junio C Hamano","Andreas Ericsson","Matthieu Moy","Jeff King","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"94411","messageId":"1225468527-29694-1-git-send-email-madcoder@debian.org","threadId":"16109","inReplyTo":null,"subject":"[PATCH] prepare deprecation of git-revert","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-10-31T15:55:27Z","receivedAt":"2008-10-31T15:55:27Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"* Rename builtin-revert.c into builtin-cherry-pick.c\n\n* Add option -R/--revert to git-cherry-pick.\n  Document it by taking the current content of git-revert manpage for the\n  option.\n\n* get rid of the no_replay initialization, just ignore it when we're in\n  the revert case, it makes really no sense to error out.\n\n* put the warning of deprecation in cmd_revert, #if 0-ed out for now.\n\nSigned-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n\n I've not kept the auto-edit feature of git-revert for the git-cherry-pick -R\n case as I don't believe it makes a lot of sense. But if people are unhappy\n with that, I can easily \"fix\" it.\n\n Documentation/git-cherry-pick.txt         |   15 +++++++++++++++\n Makefile                                  |    6 +++---\n builtin-revert.c => builtin-cherry-pick.c |   10 ++++------\n 3 files changed, 22 insertions(+), 9 deletions(-)\n rename builtin-revert.c => builtin-cherry-pick.c (98%)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex 837fb08..2d92f2d 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -40,6 +40,21 @@ OPTIONS\n \tdevelopment branch), adding this information can be\n \tuseful.\n \n+-R::\n+--revert::\n+\tGiven one existing commit, revert the change the patch introduces, and\n+\trecord a new commit that records it.  This requires your working tree\n+\tto be clean (no modifications from the HEAD commit).\n++\n+Note: 'git revert' is used to record a new commit to reverse the\n+effect of an earlier commit (often a faulty one).  If you want to\n+throw away all uncommitted changes in your working directory, you\n+should see linkgit:git-reset[1], particularly the '--hard' option.  If\n+you want to extract specific files as they were in another commit, you\n+should see linkgit:git-checkout[1], specifically the 'git checkout\n+<commit> -- <filename>' syntax.  Take care with these alternatives as\n+both will discard uncommitted changes in your working directory.\n+\n -r::\n \tIt used to be that the command defaulted to do `-x`\n \tdescribed above, and `-r` was to disable it.  Now the\ndiff --git a/Makefile b/Makefile\nindex d6f3695..43eb8e4 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -306,7 +306,7 @@ PROGRAMS += git-var$X\n # builtin-$C.o but is linked in as part of some other command.\n BUILT_INS += $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))\n \n-BUILT_INS += git-cherry-pick$X\n+BUILT_INS += git-revert$X\n BUILT_INS += git-cherry$X\n BUILT_INS += git-format-patch$X\n BUILT_INS += git-fsck-objects$X\n@@ -508,6 +508,7 @@ BUILTIN_OBJS += builtin-check-attr.o\n BUILTIN_OBJS += builtin-check-ref-format.o\n BUILTIN_OBJS += builtin-checkout-index.o\n BUILTIN_OBJS += builtin-checkout.o\n+BUILTIN_OBJS += builtin-cherry-pick.o\n BUILTIN_OBJS += builtin-clean.o\n BUILTIN_OBJS += builtin-clone.o\n BUILTIN_OBJS += builtin-commit-tree.o\n@@ -556,7 +557,6 @@ BUILTIN_OBJS += builtin-rerere.o\n BUILTIN_OBJS += builtin-reset.o\n BUILTIN_OBJS += builtin-rev-list.o\n BUILTIN_OBJS += builtin-rev-parse.o\n-BUILTIN_OBJS += builtin-revert.o\n BUILTIN_OBJS += builtin-rm.o\n BUILTIN_OBJS += builtin-send-pack.o\n BUILTIN_OBJS += builtin-shortlog.o\n@@ -1261,7 +1261,7 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)\n \n $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)\n $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)\n-builtin-revert.o wt-status.o: wt-status.h\n+builtin-cherry-pick.o wt-status.o: wt-status.h\n \n $(LIB_FILE): $(LIB_OBJS)\n \t$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)\ndiff --git a/builtin-revert.c b/builtin-cherry-pick.c\nsimilarity index 98%\nrename from builtin-revert.c\nrename to builtin-cherry-pick.c\nindex 4038b41..d1a7188 100644\n--- a/builtin-revert.c\n+++ b/builtin-cherry-pick.c\n@@ -57,6 +57,7 @@ static void parse_args(int argc, const char **argv)\n \t\tOPT_BOOLEAN('r', NULL, &noop, \"no-op (backward compatibility)\"),\n \t\tOPT_BOOLEAN('s', \"signoff\", &signoff, \"add Signed-off-by:\"),\n \t\tOPT_INTEGER('m', \"mainline\", &mainline, \"parent number\"),\n+\t\tOPT_SET_INT('R', \"revert\", &action, \"cherry-pick a reverted patch\", REVERT),\n \t\tOPT_END(),\n \t};\n \n@@ -261,10 +262,6 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n \tsetenv(GIT_REFLOG_ACTION, me, 0);\n \tparse_args(argc, argv);\n \n-\t/* this is copied from the shell script, but it's never triggered... */\n-\tif (action == REVERT && !no_replay)\n-\t\tdie(\"revert is incompatible with replay\");\n-\n \tif (read_cache() < 0)\n \t\tdie(\"git %s: failed to read the index\", me);\n \tif (no_commit) {\n@@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n \n int cmd_revert(int argc, const char **argv, const char *prefix)\n {\n+#if 0\n+\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n+#endif\n \tif (isatty(0))\n \t\tedit = 1;\n-\tno_replay = 1;\n \taction = REVERT;\n \treturn revert_or_cherry_pick(argc, argv);\n }\n \n int cmd_cherry_pick(int argc, const char **argv, const char *prefix)\n {\n-\tno_replay = 0;\n \taction = CHERRY_PICK;\n \treturn revert_or_cherry_pick(argc, argv);\n }\n-- \n1.6.0.3.790.ga4dd7.dirty\n"},{"id":"94412","messageId":"20081031155729.GB627@artemis.corp","threadId":"16109","inReplyTo":"1225468527-29694-1-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-10-31T15:57:29Z","receivedAt":"2008-10-31T15:57:29Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Fri, Oct 31, 2008 at 03:55:27PM +0000, Pierre Habouzit wrote:\n> * Rename builtin-revert.c into builtin-cherry-pick.c\n> \n> * Add option -R/--revert to git-cherry-pick.\n>   Document it by taking the current content of git-revert manpage for the\n>   option.\n> \n> * get rid of the no_replay initialization, just ignore it when we're in\n>   the revert case, it makes really no sense to error out.\n> \n> * put the warning of deprecation in cmd_revert, #if 0-ed out for now.\n> \n> Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n> ---\n> \n>  I've not kept the auto-edit feature of git-revert for the git-cherry-pick -R\n>  case as I don't believe it makes a lot of sense. But if people are unhappy\n>  with that, I can easily \"fix\" it.\n> \n>  Documentation/git-cherry-pick.txt         |   15 +++++++++++++++\n>  Makefile                                  |    6 +++---\n>  builtin-revert.c => builtin-cherry-pick.c |   10 ++++------\n>  3 files changed, 22 insertions(+), 9 deletions(-)\n>  rename builtin-revert.c => builtin-cherry-pick.c (98%)\n> \n> diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\n> index 837fb08..2d92f2d 100644\n> --- a/Documentation/git-cherry-pick.txt\n> +++ b/Documentation/git-cherry-pick.txt\n> @@ -40,6 +40,21 @@ OPTIONS\n>  \tdevelopment branch), adding this information can be\n>  \tuseful.\n>  \n> +-R::\n> +--revert::\n> +\tGiven one existing commit, revert the change the patch introduces, and\n> +\trecord a new commit that records it.  This requires your working tree\n> +\tto be clean (no modifications from the HEAD commit).\n> ++\n> +Note: 'git revert' is used to record a new commit to reverse the\n         ^ this was supposed to spell out 'git cherry-pick -R' of course :/\n> +effect of an earlier commit (often a faulty one).  If you want to\n> +throw away all uncommitted changes in your working directory, you\n> +should see linkgit:git-reset[1], particularly the '--hard' option.  If\n> +you want to extract specific files as they were in another commit, you\n> +should see linkgit:git-checkout[1], specifically the 'git checkout\n> +<commit> -- <filename>' syntax.  Take care with these alternatives as\n> +both will discard uncommitted changes in your working directory.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"94415","messageId":"m33aichgc1.fsf@localhost.localdomain","threadId":"16109","inReplyTo":"1225468527-29694-1-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-10-31T16:36:33Z","receivedAt":"2008-10-31T16:36:33Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Pierre Habouzit <madcoder@debian.org> writes:\n\n> * Rename builtin-revert.c into builtin-cherry-pick.c\n> \n> * Add option -R/--revert to git-cherry-pick.\n>   Document it by taking the current content of git-revert manpage for the\n>   option.\n> \n> * get rid of the no_replay initialization, just ignore it when we're in\n>   the revert case, it makes really no sense to error out.\n> \n> * put the warning of deprecation in cmd_revert, #if 0-ed out for now.\n\n> +#if 0\n> +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> +#endif\n\nBy the way, Mercurial names this command IIRC 'hg backout'. \n\nBut I think that adding '-R' option to git-cherry-pick is a good idea\neven if we don't go deprecating git-revert.\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"94419","messageId":"20081031165003.GA5355@steel.home","threadId":"16109","inReplyTo":"1225468527-29694-1-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-10-31T16:50:03Z","receivedAt":"2008-10-31T16:50:03Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Pierre Habouzit, Fri, Oct 31, 2008 16:55:27 +0100:\n> @@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n>  \n>  int cmd_revert(int argc, const char **argv, const char *prefix)\n>  {\n> +#if 0\n> +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> +#endif\n\n\"git revert\" is much shorter to type than \"git cherry-pick -R\".\nHow about renaming \"cherry-pick\" into something short, like \"pick\"?\n"},{"id":"94421","messageId":"20081031165401.GC627@artemis.corp","threadId":"16109","inReplyTo":"m33aichgc1.fsf@localhost.localdomain","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-10-31T16:54:01Z","receivedAt":"2008-10-31T16:54:01Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Fri, Oct 31, 2008 at 04:36:33PM +0000, Jakub Narebski wrote:\n> Pierre Habouzit <madcoder@debian.org> writes:\n> \n> > * Rename builtin-revert.c into builtin-cherry-pick.c\n> > \n> > * Add option -R/--revert to git-cherry-pick.\n> >   Document it by taking the current content of git-revert manpage for the\n> >   option.\n> > \n> > * get rid of the no_replay initialization, just ignore it when we're in\n> >   the revert case, it makes really no sense to error out.\n> > \n> > * put the warning of deprecation in cmd_revert, #if 0-ed out for now.\n> \n> > +#if 0\n> > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> > +#endif\n> \n> By the way, Mercurial names this command IIRC 'hg backout'. \n> \n> But I think that adding '-R' option to git-cherry-pick is a good idea\n> even if we don't go deprecating git-revert.\n\nActually part of the \"Git UI sucks at time\"-talk by pasy, we somehow\ndecided that git-revert would probably be deprecated in the future to\navoid the clash between what people coming from other's SCM worlds\nexpect it to be.\n\nI don't remember what the tentative schedule was, that's why I left the\nwarning commented out for now.\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"94422","messageId":"20081031165814.GD627@artemis.corp","threadId":"16109","inReplyTo":"20081031165003.GA5355@steel.home","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-10-31T16:58:14Z","receivedAt":"2008-10-31T16:58:14Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Fri, Oct 31, 2008 at 04:50:03PM +0000, Alex Riesen wrote:\n> Pierre Habouzit, Fri, Oct 31, 2008 16:55:27 +0100:\n> > @@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n> >  \n> >  int cmd_revert(int argc, const char **argv, const char *prefix)\n> >  {\n> > +#if 0\n> > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> > +#endif\n> \n> \"git revert\" is much shorter to type than \"git cherry-pick -R\".\n> How about renaming \"cherry-pick\" into something short, like \"pick\"?\n\nDo you really use git revert _that_ often ? I don't. And cherry-pick is\na really usual name for the tool.\n\nFWIW the basic idea is to deprecate revert in a (not so ?) long time,\nand leave git revert unimplemented for ever so that people that would\nlike it to be 'git checkout HEAD --' alias it to that, and the ones that\nwant to keep the current behaviour alias it to 'git cherry-pick -R'\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"94438","messageId":"20081031190157.GG17651@mit.edu","threadId":"16109","inReplyTo":"m33aichgc1.fsf@localhost.localdomain","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2008-10-31T19:01:57Z","receivedAt":"2008-10-31T19:01:57Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Fri, Oct 31, 2008 at 09:36:33AM -0700, Jakub Narebski wrote:\n> > +#if 0\n> > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> > +#endif\n> \n> By the way, Mercurial names this command IIRC 'hg backout'. \n\nBy the way, BitKeeper names this command \"bk undo\" (which is another\nreason why I would advocate against \"git undo\" as a syntatic sugar for\n\"git checkout HEAD -- $*\") --- not that I think there are too many BK\nrefugees that might want to switch to git, but it shows that \"undo\"\nhas its own ambiguities; gk uses \"undo\" the same way we currently use\n\"git revert\".\n\nFor people who argue that \"git cherry-pick --revert\" or \"git\ncherry-pick -R\" is too long, I'd argue that for most people its not a\ncommon command, and for those for which it is common, they can always\nmake in alias for \"git pick\".\n\n\t\t\t\t\t\t- Ted\n"},{"id":"94485","messageId":"alpine.DEB.1.00.0811010012320.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"16109","inReplyTo":"20081031165003.GA5355@steel.home","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-10-31T23:13:29Z","receivedAt":"2008-10-31T23:13:29Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 31 Oct 2008, Alex Riesen wrote:\n\n> Pierre Habouzit, Fri, Oct 31, 2008 16:55:27 +0100:\n> > @@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n> >  \n> >  int cmd_revert(int argc, const char **argv, const char *prefix)\n> >  {\n> > +#if 0\n> > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> > +#endif\n> \n> \"git revert\" is much shorter to type than \"git cherry-pick -R\". How \n> about renaming \"cherry-pick\" into something short, like \"pick\"?\n\nI thought we agreed that we should _never_ remove support for \"git \nrevert\"?  I mean, we can deprecate it, but I find it pretty strong, and \nunnecessary, to break existing users' expectations.\n\nCiao,\nDscho\n"},{"id":"94489","messageId":"7vej1w73nr.fsf@gitster.siamese.dyndns.org","threadId":"16109","inReplyTo":"alpine.DEB.1.00.0811010012320.22125@pacific.mpi-cbg.de.mpi-cbg.de","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-10-31T23:20:24Z","receivedAt":"2008-10-31T23:20:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Fri, 31 Oct 2008, Alex Riesen wrote:\n>\n>> Pierre Habouzit, Fri, Oct 31, 2008 16:55:27 +0100:\n>> > @@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n>> >  \n>> >  int cmd_revert(int argc, const char **argv, const char *prefix)\n>> >  {\n>> > +#if 0\n>> > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n>> > +#endif\n>> \n>> \"git revert\" is much shorter to type than \"git cherry-pick -R\". How \n>> about renaming \"cherry-pick\" into something short, like \"pick\"?\n>\n> I thought we agreed that we should _never_ remove support for \"git \n> revert\"?  I mean, we can deprecate it, but I find it pretty strong, and \n> unnecessary, to break existing users' expectations.\n\nLikewise.\n\nThe current state of affairs is that there is no remedy if teachers find\n\"git checkout -- path\" or \"git revert HEAD~24\" is confusing to new people.\nBy introducing \"git unstage path\" or \"git cherry-pick -r HEAD~24\",\nteachers can choose to teach what they feel less confusing, and they do\nnot have to teach \"git checkout -- path\" or \"git revert HEAD~24\".  We\nshould stop there.\n"},{"id":"94490","messageId":"20081031232419.GA21997@steel.home","threadId":"16109","inReplyTo":"20081031165814.GD627@artemis.corp","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-10-31T23:24:19Z","receivedAt":"2008-10-31T23:24:19Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Pierre Habouzit, Fri, Oct 31, 2008 17:58:14 +0100:\n> On Fri, Oct 31, 2008 at 04:50:03PM +0000, Alex Riesen wrote:\n> > Pierre Habouzit, Fri, Oct 31, 2008 16:55:27 +0100:\n> > > @@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n> > >  \n> > >  int cmd_revert(int argc, const char **argv, const char *prefix)\n> > >  {\n> > > +#if 0\n> > > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> > > +#endif\n> > \n> > \"git revert\" is much shorter to type than \"git cherry-pick -R\".\n> > How about renaming \"cherry-pick\" into something short, like \"pick\"?\n> \n> Do you really use git revert _that_ often ? I don't. And cherry-pick is\n> a really usual name for the tool.\n\nHave it 5 times in my bash history of 20k lines. 4 recent, one relatively old.\n\n> FWIW the basic idea is to deprecate revert in a (not so ?) long time,\n> and leave git revert unimplemented for ever so that people that would\n> like it to be 'git checkout HEAD --' alias it to that, and the ones that\n> want to keep the current behaviour alias it to 'git cherry-pick -R'\n\nWell, I kind of got used to it. And it makes sense (as does -R by\ncherry-pick, I have to admit). I have no other argument against the\nchange.\n"},{"id":"94553","messageId":"490C4332.9040504@op5.se","threadId":"16109","inReplyTo":"20081031190157.GG17651@mit.edu","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-11-01T11:53:22Z","receivedAt":"2008-11-01T11:53:22Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Theodore Tso wrote:\n> On Fri, Oct 31, 2008 at 09:36:33AM -0700, Jakub Narebski wrote:\n>>> +#if 0\n>>> +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n>>> +#endif\n>> By the way, Mercurial names this command IIRC 'hg backout'. \n> \n> By the way, BitKeeper names this command \"bk undo\" (which is another\n> reason why I would advocate against \"git undo\" as a syntatic sugar for\n> \"git checkout HEAD -- $*\") --- not that I think there are too many BK\n> refugees that might want to switch to git, but it shows that \"undo\"\n> has its own ambiguities; gk uses \"undo\" the same way we currently use\n> \"git revert\".\n> \n> For people who argue that \"git cherry-pick --revert\" or \"git\n> cherry-pick -R\" is too long, I'd argue that for most people its not a\n> common command, and for those for which it is common, they can always\n> make in alias for \"git pick\".\n> \n\nProbably \"git unpick\" in that case.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"94603","messageId":"vpqr65voxti.fsf@bauges.imag.fr","threadId":"16109","inReplyTo":"7vej1w73nr.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-11-01T23:01:29Z","receivedAt":"2008-11-01T23:01:29Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> The current state of affairs is that there is no remedy if teachers find\n> \"git checkout -- path\" or \"git revert HEAD~24\" is confusing to new people.\n> By introducing \"git unstage path\" or \"git cherry-pick -r HEAD~24\",\n> teachers can choose to teach what they feel less confusing, and they do\n> not have to teach \"git checkout -- path\" or \"git revert HEAD~24\".  We\n> should stop there.\n\nI think you should go half a step further: officially deprecate\n\"revert\", but keep it supported forever. The reason is just to help\ndocumentation to be homogeneous (I foresee questions of users having\nread here about \"cherry-pick -R\" and there about \"revert\" and asking\n\"should I use one or the other\"). At least, the man page for \"revert\"\nshould state explicitly \"this is a convenience alias for ...\".\n\nBut I agree that removing support for \"revert\" is probably useless and\nsomehow harmfull.\n\n(my 2 cents ...)\n\n-- \nMatthieu\n"},{"id":"94629","messageId":"20081102044159.GF5261@coredump.intra.peff.net","threadId":"16109","inReplyTo":"1225468527-29694-1-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-11-02T04:41:59Z","receivedAt":"2008-11-02T04:41:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 31, 2008 at 04:55:27PM +0100, Pierre Habouzit wrote:\n\n>  I've not kept the auto-edit feature of git-revert for the git-cherry-pick -R\n>  case as I don't believe it makes a lot of sense. But if people are unhappy\n>  with that, I can easily \"fix\" it.\n\nI disagree. I write a new commit message for every revert I do.\n\nWhen you cherry-pick, you are pulling a good commit from somewhere else.\nSo its commit message should suffice to explain why you are making the\nchange (and infrequently, you might want to give more context or say\n\"and here is where this comes from\").\n\nBut when you revert, you are saying \"this other commit was bad, so let's\nreverse it.\" So you can look at the other commit to see what it did, but\nyou still don't know _why_ it was bad. A revert should always give\ninformation about what you know _now_ that you didn't know when you\nmade the commit originally.\n\n-Peff\n"},{"id":"94646","messageId":"20081102093030.GD4066@artemis","threadId":"16109","inReplyTo":"20081102044159.GF5261@coredump.intra.peff.net","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2008-11-02T09:30:30Z","receivedAt":"2008-11-02T09:30:30Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Sun, Nov 02, 2008 at 04:41:59AM +0000, Jeff King wrote:\n> On Fri, Oct 31, 2008 at 04:55:27PM +0100, Pierre Habouzit wrote:\n> \n> >  I've not kept the auto-edit feature of git-revert for the git-cherry-pick -R\n> >  case as I don't believe it makes a lot of sense. But if people are unhappy\n> >  with that, I can easily \"fix\" it.\n> \n> I disagree. I write a new commit message for every revert I do.\n> \n> When you cherry-pick, you are pulling a good commit from somewhere else.\n> So its commit message should suffice to explain why you are making the\n> change (and infrequently, you might want to give more context or say\n> \"and here is where this comes from\").\n> \n> But when you revert, you are saying \"this other commit was bad, so let's\n> reverse it.\" So you can look at the other commit to see what it did, but\n> you still don't know _why_ it was bad. A revert should always give\n> information about what you know _now_ that you didn't know when you\n> made the commit originally.\n\nIndeed that makes sense, I'll update the patch then, and be lighter on\nthe deprecation side since it seems I misunderstood what people agreed\non.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"94647","messageId":"20081102093225.GA32296@laptop","threadId":"16109","inReplyTo":"20081031165003.GA5355@steel.home","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2008-11-02T09:32:25Z","receivedAt":"2008-11-02T09:32:25Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Oct 31, 2008 at 05:50:03PM +0100, Alex Riesen wrote:\n> Pierre Habouzit, Fri, Oct 31, 2008 16:55:27 +0100:\n> > @@ -439,16 +436,17 @@ static int revert_or_cherry_pick(int argc, const char **argv)\n> >  \n> >  int cmd_revert(int argc, const char **argv, const char *prefix)\n> >  {\n> > +#if 0\n> > +\twarning(\"git revert is deprecated, please use git cherry-pick --revert/-R instead\");\n> > +#endif\n> \n> \"git revert\" is much shorter to type than \"git cherry-pick -R\".\n> How about renaming \"cherry-pick\" into something short, like \"pick\"?\n\nMaybe a patch like this can help? With it you can type \"git cp\" for\ncherry-pick. If someday \"git cp\" is added, you can type \"git c-p\",\nmuch shorter.\n\n--<--\ncommit dce5cad329390905bb91115a9de0153772be57d8\nAuthor: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nDate:   Sat Nov 1 17:12:04 2008 +0700\n\n    Add git command expansion\n    \n    This allows git commands to be typed shorter (in shells that do not\n    support autocompletion). There are three types of expansion:\n    \n     - \"foo\" matches \"foo*\" commands (bi -> bisect)\n     - \"foo\" also matches \"f*-oo*\" (fim -> fast-import)\n     - \"foo-bar\" (with dash) matches \"foo*-bar*\" (fo-p -> format-patch)\n    \n    This feature is only enabled if core.commandexpansion is true. It\n    may work better if we can limit the command set (to porcelain\n    only for example) but I have yet to find a way to pull\n    commands-list.txt to help.c.\n\ndiff --git a/builtin.h b/builtin.h\nindex 1495cf6..9fb0fef 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -12,6 +12,7 @@ extern const char git_more_info_string[];\n \n extern void list_common_cmds_help(void);\n extern const char *help_unknown_cmd(const char *cmd);\n+extern const char *expand_command(const char *cmd);\n extern void prune_packed_objects(int);\n extern int read_line_with_nul(char *buf, int size, FILE *file);\n extern int fmt_merge_msg(int merge_summary, struct strbuf *in,\ndiff --git a/git.c b/git.c\nindex 89feb0b..1bbe340 100644\n--- a/git.c\n+++ b/git.c\n@@ -14,6 +14,7 @@ struct pager_config {\n \tconst char *cmd;\n \tint val;\n };\n+static int command_expansion;\n \n static int pager_command_config(const char *var, const char *value, void *data)\n {\n@@ -415,6 +416,13 @@ static void execv_dashed_external(const char **argv)\n \tstrbuf_release(&cmd);\n }\n \n+static int git_command_expansion_config(const char *var, const char *value, void *cb)\n+{\n+\tif (!strcmp(var, \"core.commandexpansion\"))\n+\t\tcommand_expansion = git_config_bool(var, value);\n+\n+\treturn git_default_config(var, value, cb);\n+}\n \n int main(int argc, const char **argv)\n {\n@@ -501,6 +509,15 @@ int main(int argc, const char **argv)\n \t\t\t\tcmd, argv[0]);\n \t\t\texit(1);\n \t\t}\n+\t\tgit_config(git_command_expansion_config, NULL);\n+\t\tif (command_expansion) {\n+\t\t\tconst char *expand_cmd = expand_command(cmd);\n+\t\t\tif (expand_cmd) {\n+\t\t\t\targv[0] = expand_cmd;\n+\t\t\t\thandle_internal_command(argc, argv);\n+\t\t\t\texecv_dashed_external(argv);\n+\t\t\t}\n+\t\t}\n \t\targv[0] = help_unknown_cmd(cmd);\n \t\thandle_internal_command(argc, argv);\n \t\texecv_dashed_external(argv);\ndiff --git a/help.c b/help.c\nindex fd87bb5..4f0e5a0 100644\n--- a/help.c\n+++ b/help.c\n@@ -359,6 +359,67 @@ const char *help_unknown_cmd(const char *cmd)\n \texit(1);\n }\n \n+const char *expand_command(const char *cmd)\n+{\n+\tint i, n, len;\n+\tstruct cmdnames main_cmds, other_cmds;\n+\tchar *src, *dst;\n+\n+\tmemset(&main_cmds, 0, sizeof(main_cmds));\n+\tmemset(&other_cmds, 0, sizeof(main_cmds));\n+\n+\tload_command_list(\"git-\", &main_cmds, &other_cmds);\n+\n+\tadd_cmd_list(&main_cmds, &aliases);\n+\tadd_cmd_list(&main_cmds, &other_cmds);\n+\tqsort(main_cmds.names, main_cmds.cnt,\n+\t      sizeof(main_cmds.names), cmdname_compare);\n+\tuniq(&main_cmds);\n+\n+\tlen = strlen(cmd);\n+\tn = -1;\n+\tsrc = strchr(cmd, '-');\n+\tfor (i = 0;i < main_cmds.cnt; i++) {\n+\t\tconst char *gitcmd = main_cmds.names[i]->name;\n+\n+\t\t/* match prefix */\n+\t\tif (!strncmp(cmd, gitcmd, len))\n+\t\t\tgoto ok_expand;\n+\n+\t\tif (*cmd != *gitcmd)\n+\t\t\tcontinue;\n+\t\tdst = strchr(gitcmd, '-');\n+\t\tif (!dst)\n+\t\t\tcontinue;\n+\n+\t\t/* cmd is foo-bar, match foo*-bar* */\n+\t\tif (src &&\n+\t\t    !strncmp(cmd, gitcmd, src-cmd) &&\n+\t\t    !strncmp(src+1, dst+1, cmd+len-src-1))\n+\t\t\tgoto ok_expand;\n+\n+\t\t/* cmd is foobar,match f*-oobar* */\n+\t\tif (!src && !strncmp(cmd+1, dst+1, len-1))\n+\t\t\tgoto ok_expand;\n+\n+\t\tcontinue;\n+ok_expand:\n+\t\ttrace_printf(\"expand: %s\\n\", main_cmds.names[i]->name);\n+\t\tif (n != -1)\n+\t\t\treturn NULL;\n+\t\tn = i;\n+\t}\n+\n+\tif (n != -1) {\n+\t\tconst char *assumed = main_cmds.names[n]->name;\n+\t\tmain_cmds.names[n] = NULL;\n+\t\tclean_cmdnames(&main_cmds);\n+\t\treturn assumed;\n+\t}\n+\telse\n+\t\treturn NULL;\n+}\n+\n int cmd_version(int argc, const char **argv, const char *prefix)\n {\n \tprintf(\"git version %s\\n\", git_version_string);\n--<--\n-- \nDuy\n"},{"id":"94665","messageId":"alpine.DEB.1.00.0811021706580.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"16109","inReplyTo":"20081102093225.GA32296@laptop","subject":"Re: [PATCH] prepare deprecation of git-revert","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-11-02T16:12:09Z","receivedAt":"2008-11-02T16:12:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 2 Nov 2008, Nguyen Thai Ngoc Duy wrote:\n\n>     Add git command expansion\n>     \n>     This allows git commands to be typed shorter (in shells that do not\n>     support autocompletion). There are three types of expansion:\n>     \n>      - \"foo\" matches \"foo*\" commands (bi -> bisect)\n>      - \"foo\" also matches \"f*-oo*\" (fim -> fast-import)\n>      - \"foo-bar\" (with dash) matches \"foo*-bar*\" (fo-p -> format-patch)\n\nI'd rather have the soft-alias code back to perform this expansion, but \nonly for a limited and explicit set of abbreviations.\n\nCiao,\nDscho\n"}]}