{"thread":{"id":"7085","subject":"[PATCH, properly formatted] git-commit: add a --interactive option","startedAt":"2007-03-05T07:57:53Z","lastAt":"2007-03-05T08:54:02Z","messageCount":2,"participants":["Paolo Bonzini","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"36288","messageId":"45EBCD81.8020605@lu.unisi.ch","threadId":"7085","inReplyTo":null,"subject":"[PATCH, properly formatted] git-commit: add a --interactive option","fromName":"Paolo Bonzini","fromEmail":"paolo.bonzini@lu.unisi.ch","sentAt":"2007-03-05T07:57:53Z","receivedAt":"2007-03-05T07:57:53Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"The --interactive option behaves like \"git commit\", except that\n\"git add --interactive\" is executed before committing.  It is\nincompatible with -a and -i.\n\nSigned-off-by: Paolo Bonzini  <bonzini@gnu.org>\n\n---\nWhile I agree with the point you make, I suggest that the flow\nindicated in your message (stash, pick, test, commit, repeat) could be\nactivated exactly by a \"commit --interactive\" command.  Since\ninteractive stuff does not require backward compatibility in general,\nI would ask to commit my patch anyway, assuming that in the future the\nfeature is rewritten to conform to the flow you indicate -- and at the\nsame time, \"add --interactive\" is deprecated or even removed.\n\n Documentation/git-commit.txt |    9 +++++++--\n git-commit.sh                |   21 ++++++++++++++++-----\n 2 files changed, 23 insertions(+), 7 deletions(-)\n\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 2187eee..3a4d456 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -8,8 +8,9 @@ git-commit - Record changes to the repository\n SYNOPSIS\n --------\n [verse]\n-'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg> |\n-\t    --amend] [--no-verify] [-e] [--author <author>]\n+'git-commit' [-a | --interactive] [-s] [-v]\n+\t   [(-c | -C) <commit> | -F <file> | -m <msg> | --amend]\n+\t   [--no-verify] [-e] [--author <author>]\n \t   [--] [[-i | -o ]<file>...]\n \n DESCRIPTION\n@@ -35,6 +36,10 @@ methods:\n    before, and to automatically \"rm\" files that have been\n    removed from the working tree, and perform the actual commit.\n \n+5. by using the --interactive switch with the 'commit' command to decide one\n+   by one which files should be part of the commit, before finalizing the\n+   operation.  Currently, this is done by invoking `git-add --interactive`.\n+\n The gitlink:git-status[1] command can be used to obtain a\n summary of what is included by any of the above for the next\n commit by giving the same set of parameters you would give to\ndiff --git a/git-commit.sh b/git-commit.sh\nindex be3677c..e8ec3b9 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -3,7 +3,7 @@\n # Copyright (c) 2005 Linus Torvalds\n # Copyright (c) 2006 Junio C Hamano\n \n-USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'\n+USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n require_work_tree\n@@ -71,6 +71,7 @@ trap '\n \n all=\n also=\n+interactive=\n only=\n logfile=\n use_commit=\n@@ -131,6 +132,11 @@ do\n \t\talso=t\n \t\tshift\n \t\t;;\n+\t--int|--inte|--inter|--intera|--interac|--interact|--interacti|\\\n+\t--interactiv|--interactive)\n+\t\tinteractive=t\n+\t\tshift\n+\t\t;;\n \t-o|--o|--on|--onl|--only)\n \t\tonly=t\n \t\tshift\n@@ -304,12 +310,14 @@ case \"$#,$also,$only,$amend\" in\n \t;;\n esac\n unset only\n-case \"$all,$also,$#\" in\n-t,t,*)\n-\tdie \"Cannot use -a and -i at the same time.\" ;;\n+case \"$all,$interactive,$also,$#\" in\n+*t,*t,*)\n+\tdie \"Cannot use -a, --interactive or -i at the same time.\" ;;\n t,,[1-9]*)\n \tdie \"Paths with -a does not make sense.\" ;;\n-,t,0)\n+,t,[1-9]*)\n+\tdie \"Paths with --interactive does not make sense.\" ;;\n+,,t,0)\n \tdie \"No paths with -i does not make sense.\" ;;\n esac\n \n@@ -344,6 +352,9 @@ t,)\n \t) || exit\n \t;;\n ,)\n+\tif test \"$interactive\" = t; then\n+\t\tgit add --interactive || exit\n+\tfi\n \tcase \"$#\" in\n \t0)\n \t\t;; # commit as-is\n"},{"id":"36304","messageId":"7v4pp0136d.fsf@assigned-by-dhcp.cox.net","threadId":"7085","inReplyTo":"45EBCD81.8020605@lu.unisi.ch","subject":"Re: [PATCH, properly formatted] git-commit: add a --interactive option","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-05T08:54:02Z","receivedAt":"2007-03-05T08:54:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo Bonzini <paolo.bonzini@lu.unisi.ch> writes:\n\n> ... Since\n> interactive stuff does not require backward compatibility in general,\n> I would ask to commit my patch anyway, assuming that in the future the\n> feature is rewritten to conform to the flow you indicate...\n\nI think people feel changes to interactive workflow is a big\ndeal.\n\n> diff --git a/git-commit.sh b/git-commit.sh\n> index be3677c..e8ec3b9 100755\n> --- a/git-commit.sh\n> +++ b/git-commit.sh\n> ...\n>  esac\n>  unset only\n> +case \"$all,$interactive,$also,$#\" in\n> +*t,*t,*)\n> +\tdie \"Cannot use -a, --interactive or -i at the same time.\" ;;\n>  t,,[1-9]*)\n>  \tdie \"Paths with -a does not make sense.\" ;;\n> +,t,[1-9]*)\n> +\tdie \"Paths with --interactive does not make sense.\" ;;\n> +,,t,0)\n>  \tdie \"No paths with -i does not make sense.\" ;;\n>  esac\n\nClever.\n\n> @@ -344,6 +352,9 @@ t,)\n>  \t) || exit\n>  \t;;\n>  ,)\n> +\tif test \"$interactive\" = t; then\n> +\t\tgit add --interactive || exit\n> +\tfi\n>  \tcase \"$#\" in\n>  \t0)\n>  \t\t;; # commit as-is\n\nIf we were to do this, we probably would want a way to exit\nnon-zero from \"git-add -i\", but I guess we can say we already\nhave that way via ^C.\n\nWill queue for 'next', but it's getting late here so it probably\nwould not appear on the public repository tonight.\n\nThanks.\n"}]}