git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] commit: add --skip-intent-to-add to allow commit with i-t-a entries in index

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 11, 2012, 23:55 UTC
Message-ID
<7vipkh6bg8.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1326275982-29866-3-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 24 quoted lines
> ---
>  builtin/commit.c      |   10 +++++++---
>  cache-tree.c          |    8 +++++---
>  cache-tree.h          |    1 +
>  t/t2203-add-intent.sh |   17 +++++++++++++++++
>  4 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index bf42bb3..021206e 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -86,6 +86,7 @@ static int all, also, interactive, patch_interactive, only, amend, signoff;
>  static int edit_flag = -1; /* unspecified */
>  static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
>  static int no_post_rewrite, allow_empty_message;
> +static int cache_tree_flags, skip_intent_to_add;
>  static char *untracked_files_arg, *force_date, *ignore_submodule_arg;
>  static char *sign_commit;
>  
> @@ -170,6 +171,7 @@ static struct option builtin_commit_options[] = {
>  	OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
>  	OPT_BOOLEAN(0, "no-post-rewrite", &no_post_rewrite, "bypass post-rewrite hook"),
>  	{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, "mode", "show untracked files, optional modes: all, normal, no. (Default: all)", PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
> +	OPT_BOOL(0, "skip-intent-to-add", &skip_intent_to_add, "allow intent-to-add entries in index"),

This is more like "ignore", not "allow", from end user's point of view, no? The user earlier said "I cannot decide what contents to put in the commit yet for this path", and normally we catch it and remind the user that she needs to decide. This option gives her a quick way to say "I decide that I do not want to add this path at all to this commit I am creating, so please ignore it in the meantime."

Show 6 quoted lines
> @@ -1088,6 +1090,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
>  		cleanup_mode = CLEANUP_ALL;
>  	else
>  		die(_("Invalid cleanup mode %s"), cleanup_arg);
> +	if (skip_intent_to_add)
> +		cache_tree_flags = WRITE_TREE_INTENT_TO_ADD_OK;

The name WRITE_TREE_INTENT_TO_ADD_OK says "it is OK to call write-tree with i-t-a entries in the index, please do not barf", but I think "when writing a tree, ignore i-t-a entries" would be a more appropriate way to say the same thing, i.e. WRITE_TREE_IGNORE_INTENT_TO_ADD.

Other than that, I do not see an issue in the implementation of the patch. It is a separate design level issue if we want to worsen proliferation of the options, though.

Thanks.
Previous: Nguyễn Thái Ngọc Duy
Message 12 of 12 in “commit: allow to commit even if there are intent-to-add entries”
  1. commit: allow to commit even if there are intent-to-add entriesNguyễn Thái Ngọc Duy, Jan 11, 2012
  2. Junio C HamanoJan 11, 2012
  3. Jonathan NiederJan 11, 2012
  4. Junio C HamanoJan 11, 2012
  5. Nguyen Thai Ngoc DuyJan 12, 2012
  6. Junio C HamanoJan 12, 2012
  7. Nguyễn Thái Ngọc DuyJan 11, 2012
  8. 1/2 cache-tree: update API to take abitrary flagsNguyễn Thái Ngọc Duy, Jan 11, 2012
  9. Junio C HamanoJan 11, 2012
  10. Nguyen Thai Ngoc DuyJan 12, 2012
  11. 2/2 commit: add --skip-intent-to-add to allow commit with i-t-a entries in indexNguyễn Thái Ngọc Duy, Jan 11, 2012
  12. Junio C HamanoJan 11, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.