git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] builtin-commit.c: Remove a redundant assignment.
@ 2008-04-10 11:33 Johannes Sixt
  2008-04-10 11:33 ` [PATCH] Document option --only of git commit Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2008-04-10 11:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Sixt

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
	I noticed this while looking how --only is implemented.

	-- Hannes

 builtin-commit.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 660a345..e3adfdf 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -745,10 +745,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
 		die("No paths with --include/--only does not make sense.");
 	if (argc == 0 && only && amend)
 		only_include_assumed = "Clever... amending the last one with dirty index.";
-	if (argc > 0 && !also && !only) {
+	if (argc > 0 && !also && !only)
 		only_include_assumed = "Explicit paths specified without -i nor -o; assuming --only paths...";
-		also = 0;
-	}
 	if (!cleanup_arg || !strcmp(cleanup_arg, "default"))
 		cleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE;
 	else if (!strcmp(cleanup_arg, "verbatim"))
-- 
1.5.5.33.g376d1

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

* [PATCH] Document option --only of git commit
  2008-04-10 11:33 [PATCH] builtin-commit.c: Remove a redundant assignment Johannes Sixt
@ 2008-04-10 11:33 ` Johannes Sixt
  2008-04-18  9:28   ` Pieter de Bie
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2008-04-10 11:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Sixt

Its documentation was removed by 6c96753df9db7f790a2ac4d95ec2a868394cd5ff,
even though it is referenced from a few places, including builtin-commit.c
(as part of the commentary in the commit message template).

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 Documentation/git-commit.txt |   11 +++++++++++
 builtin-commit.c             |    2 +-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index b4ae61f..4bb51cc 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -139,6 +139,17 @@ but can be used to amend a merge commit.
 	as well.  This is usually not what you want unless you
 	are concluding a conflicted merge.
 
+-o|--only::
+	Make a commit only from the paths specified on the
+	command line, disregarding any contents that have been
+	staged so far. This is the default mode of operation of
+	'git commit' if any paths are given on the command line,
+	in which case this option can be omitted.
+	If this option is specified together with '--amend', then
+	no paths need be specified, which can be used to amend
+	the last commit without committing changes that have
+	already been staged.
+
 -u|--untracked-files::
 	Show all untracked files, also those in uninteresting
 	directories, in the "Untracked files:" section of commit
diff --git a/builtin-commit.c b/builtin-commit.c
index e3adfdf..bcb7aaa 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -98,7 +98,7 @@ static struct option builtin_commit_options[] = {
 	OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
 	OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"),
 	OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"),
-	OPT_BOOLEAN('o', "only", &only, ""),
+	OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
 	OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
 	OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
 	OPT_BOOLEAN(0, "untracked-files", &untracked_files, "show all untracked files"),
-- 
1.5.5.33.g376d1

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

* Re: [PATCH] Document option --only of git commit
  2008-04-10 11:33 ` [PATCH] Document option --only of git commit Johannes Sixt
@ 2008-04-18  9:28   ` Pieter de Bie
  0 siblings, 0 replies; 3+ messages in thread
From: Pieter de Bie @ 2008-04-18  9:28 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

Hi,

On 10 apr 2008, at 13:33, Johannes Sixt wrote:
> Its documentation was removed by  
> 6c96753df9db7f790a2ac4d95ec2a868394cd5ff,
> even though it is referenced from a few places, including builtin- 
> commit.c
> (as part of the commentary in the commit message template).
>
> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>

> +-o|--only::
> +	Make a commit only from the paths specified on the
> +	command line, disregarding any contents that have been
> +	staged so far. This is the default mode of operation of
> +	'git commit' if any paths are given on the command line,
> +	in which case this option can be omitted.
> +	If this option is specified together with '--amend', then
> +	no paths need be specified, which can be used to amend
> +	the last commit without committing changes that have
> +	already been staged.
> +

I find this addition to the manpage very confusing. If -o commits  
paths only from the command line, and it is also the default operation  
when run with paths, why is this text at the -o option? This behaviour  
is already documented in the description of git-commit:

        3. by listing files as arguments to the commit command, in  
which case the commit will
           ignore changes staged in the index, and instead record the  
current content of the
           listed files;

I'd suggest only using the second part (about --amend), or optionally  
adding something about what happens if you specify -o without --amend  
and without paths.

- Pieter

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

end of thread, other threads:[~2008-04-18  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-10 11:33 [PATCH] builtin-commit.c: Remove a redundant assignment Johannes Sixt
2008-04-10 11:33 ` [PATCH] Document option --only of git commit Johannes Sixt
2008-04-18  9:28   ` Pieter de Bie

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

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

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