{"thread":{"id":"13046","subject":"[PATCH] Document option --only of git commit","startedAt":"2008-04-10T11:33:08Z","lastAt":"2008-04-18T09:28:54Z","messageCount":3,"participants":["Johannes Sixt","Pieter de Bie"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"74057","messageId":"1207827189-7509-1-git-send-email-johannes.sixt@telecom.at","threadId":"13046","inReplyTo":null,"subject":"[PATCH] builtin-commit.c: Remove a redundant assignment.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-04-10T11:33:08Z","receivedAt":"2008-04-10T11:33:08Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n\tI noticed this while looking how --only is implemented.\n\n\t-- Hannes\n\n builtin-commit.c |    4 +---\n 1 files changed, 1 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 660a345..e3adfdf 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -745,10 +745,8 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \t\tdie(\"No paths with --include/--only does not make sense.\");\n \tif (argc == 0 && only && amend)\n \t\tonly_include_assumed = \"Clever... amending the last one with dirty index.\";\n-\tif (argc > 0 && !also && !only) {\n+\tif (argc > 0 && !also && !only)\n \t\tonly_include_assumed = \"Explicit paths specified without -i nor -o; assuming --only paths...\";\n-\t\talso = 0;\n-\t}\n \tif (!cleanup_arg || !strcmp(cleanup_arg, \"default\"))\n \t\tcleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE;\n \telse if (!strcmp(cleanup_arg, \"verbatim\"))\n-- \n1.5.5.33.g376d1\n"},{"id":"74056","messageId":"1207827189-7509-2-git-send-email-johannes.sixt@telecom.at","threadId":"13046","inReplyTo":"1207827189-7509-1-git-send-email-johannes.sixt@telecom.at","subject":"[PATCH] Document option --only of git commit","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-04-10T11:33:09Z","receivedAt":"2008-04-10T11:33:09Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Its documentation was removed by 6c96753df9db7f790a2ac4d95ec2a868394cd5ff,\neven though it is referenced from a few places, including builtin-commit.c\n(as part of the commentary in the commit message template).\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n Documentation/git-commit.txt |   11 +++++++++++\n builtin-commit.c             |    2 +-\n 2 files changed, 12 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex b4ae61f..4bb51cc 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -139,6 +139,17 @@ but can be used to amend a merge commit.\n \tas well.  This is usually not what you want unless you\n \tare concluding a conflicted merge.\n \n+-o|--only::\n+\tMake a commit only from the paths specified on the\n+\tcommand line, disregarding any contents that have been\n+\tstaged so far. This is the default mode of operation of\n+\t'git commit' if any paths are given on the command line,\n+\tin which case this option can be omitted.\n+\tIf this option is specified together with '--amend', then\n+\tno paths need be specified, which can be used to amend\n+\tthe last commit without committing changes that have\n+\talready been staged.\n+\n -u|--untracked-files::\n \tShow all untracked files, also those in uninteresting\n \tdirectories, in the \"Untracked files:\" section of commit\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex e3adfdf..bcb7aaa 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -98,7 +98,7 @@ static struct option builtin_commit_options[] = {\n \tOPT_BOOLEAN('a', \"all\", &all, \"commit all changed files\"),\n \tOPT_BOOLEAN('i', \"include\", &also, \"add specified files to index for commit\"),\n \tOPT_BOOLEAN(0, \"interactive\", &interactive, \"interactively add files\"),\n-\tOPT_BOOLEAN('o', \"only\", &only, \"\"),\n+\tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n \tOPT_BOOLEAN(0, \"untracked-files\", &untracked_files, \"show all untracked files\"),\n-- \n1.5.5.33.g376d1\n"},{"id":"74717","messageId":"9CE1A95F-941C-474F-9F18-1B01B73113B2@ai.rug.nl","threadId":"13046","inReplyTo":"1207827189-7509-2-git-send-email-johannes.sixt@telecom.at","subject":"Re: [PATCH] Document option --only of git commit","fromName":"Pieter de Bie","fromEmail":"pdebie@ai.rug.nl","sentAt":"2008-04-18T09:28:54Z","receivedAt":"2008-04-18T09:28:54Z","isPatch":true,"sender":{"key":"pdebie@ai.rug.nl","avatar":null},"body":"Hi,\n\nOn 10 apr 2008, at 13:33, Johannes Sixt wrote:\n> Its documentation was removed by  \n> 6c96753df9db7f790a2ac4d95ec2a868394cd5ff,\n> even though it is referenced from a few places, including builtin- \n> commit.c\n> (as part of the commentary in the commit message template).\n>\n> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n\n> +-o|--only::\n> +\tMake a commit only from the paths specified on the\n> +\tcommand line, disregarding any contents that have been\n> +\tstaged so far. This is the default mode of operation of\n> +\t'git commit' if any paths are given on the command line,\n> +\tin which case this option can be omitted.\n> +\tIf this option is specified together with '--amend', then\n> +\tno paths need be specified, which can be used to amend\n> +\tthe last commit without committing changes that have\n> +\talready been staged.\n> +\n\nI find this addition to the manpage very confusing. If -o commits  \npaths only from the command line, and it is also the default operation  \nwhen run with paths, why is this text at the -o option? This behaviour  \nis already documented in the description of git-commit:\n\n        3. by listing files as arguments to the commit command, in  \nwhich case the commit will\n           ignore changes staged in the index, and instead record the  \ncurrent content of the\n           listed files;\n\nI'd suggest only using the second part (about --amend), or optionally  \nadding something about what happens if you specify -o without --amend  \nand without paths.\n\n- Pieter\n"}]}