{"thread":{"id":"29561","subject":"[PATCH 0/4] Deprecate \"not allow as-is commit with i-t-a entries\"","startedAt":"2012-02-06T10:57:31Z","lastAt":"2012-02-07T07:57:43Z","messageCount":20,"participants":["Nguyễn Thái Ngọc Duy","Junio C Hamano","Jonathan Nieder","Nguyen Thai Ngoc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"184017","messageId":"1328525855-2547-1-git-send-email-pclouds@gmail.com","threadId":"29561","inReplyTo":null,"subject":"[PATCH 0/4] Deprecate \"not allow as-is commit with i-t-a entries\"","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-06T10:57:31Z","receivedAt":"2012-02-06T10:57:31Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"By the end of this series \"git commit -m foo\" will proceed regardless\nintent-to-add (aka \"git add -N\") entries. commit.ignoreIntentToAdd is\nused as transitiono config key.\n\nThe plan is in 2/4. I set 1.8.0 as the first deprecation date, but of\ncourse it's just a suggestion. The second deprecation date might be\n1.8.5, long enough for users to adapt to the new behavior.\n\n..or we switch back half way because we find current behavior does\nmake more sense.\n\nNguyễn Thái Ngọc Duy (4):\n  cache-tree: update API to take abitrary flags\n  commit: introduce a config key to allow as-is commit with i-t-a\n    entries\n  commit: turn commit.ignoreIntentToAdd to true by default\n  commit: remove commit.ignoreIntentToAdd, assume it's always true\n\n Documentation/git-add.txt |   12 ++++++++++--\n builtin/commit.c          |    9 ++++++---\n cache-tree.c              |   35 +++++++++++++++++------------------\n cache-tree.h              |    5 ++++-\n merge-recursive.c         |    2 +-\n t/t2203-add-intent.sh     |   21 ++++++++++++++++++++-\n test-dump-cache-tree.c    |    2 +-\n 7 files changed, 59 insertions(+), 27 deletions(-)\n\n-- \n1.7.8.36.g69ee2\n"},{"id":"184018","messageId":"1328525855-2547-2-git-send-email-pclouds@gmail.com","threadId":"29561","inReplyTo":"1328525855-2547-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 1/4] cache-tree: update API to take abitrary flags","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-06T10:57:32Z","receivedAt":"2012-02-06T10:57:32Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/commit.c       |    4 ++--\n cache-tree.c           |   27 ++++++++++++---------------\n cache-tree.h           |    4 +++-\n merge-recursive.c      |    2 +-\n test-dump-cache-tree.c |    2 +-\n 5 files changed, 19 insertions(+), 20 deletions(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex eba1377..bf42bb3 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -400,7 +400,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \t\tfd = hold_locked_index(&index_lock, 1);\n \t\tadd_files_to_cache(also ? prefix : NULL, pathspec, 0);\n \t\trefresh_cache_or_die(refresh_flags);\n-\t\tupdate_main_cache_tree(1);\n+\t\tupdate_main_cache_tree(WRITE_TREE_SILENT);\n \t\tif (write_cache(fd, active_cache, active_nr) ||\n \t\t    close_lock_file(&index_lock))\n \t\t\tdie(_(\"unable to write new_index file\"));\n@@ -421,7 +421,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \t\tfd = hold_locked_index(&index_lock, 1);\n \t\trefresh_cache_or_die(refresh_flags);\n \t\tif (active_cache_changed) {\n-\t\t\tupdate_main_cache_tree(1);\n+\t\t\tupdate_main_cache_tree(WRITE_TREE_SILENT);\n \t\t\tif (write_cache(fd, active_cache, active_nr) ||\n \t\t\t    commit_locked_index(&index_lock))\n \t\t\t\tdie(_(\"unable to write new_index file\"));\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 8de3959..16355d6 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -150,9 +150,10 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)\n }\n \n static int verify_cache(struct cache_entry **cache,\n-\t\t\tint entries, int silent)\n+\t\t\tint entries, int flags)\n {\n \tint i, funny;\n+\tint silent = flags & WRITE_TREE_SILENT;\n \n \t/* Verify that the tree is merged */\n \tfunny = 0;\n@@ -241,10 +242,11 @@ static int update_one(struct cache_tree *it,\n \t\t      int entries,\n \t\t      const char *base,\n \t\t      int baselen,\n-\t\t      int missing_ok,\n-\t\t      int dryrun)\n+\t\t      int flags)\n {\n \tstruct strbuf buffer;\n+\tint missing_ok = flags & WRITE_TREE_MISSING_OK;\n+\tint dryrun = flags & WRITE_TREE_DRY_RUN;\n \tint i;\n \n \tif (0 <= it->entry_count && has_sha1_file(it->sha1))\n@@ -288,8 +290,7 @@ static int update_one(struct cache_tree *it,\n \t\t\t\t    cache + i, entries - i,\n \t\t\t\t    path,\n \t\t\t\t    baselen + sublen + 1,\n-\t\t\t\t    missing_ok,\n-\t\t\t\t    dryrun);\n+\t\t\t\t    flags);\n \t\tif (subcnt < 0)\n \t\t\treturn subcnt;\n \t\ti += subcnt - 1;\n@@ -371,15 +372,13 @@ static int update_one(struct cache_tree *it,\n int cache_tree_update(struct cache_tree *it,\n \t\t      struct cache_entry **cache,\n \t\t      int entries,\n-\t\t      int missing_ok,\n-\t\t      int dryrun,\n-\t\t      int silent)\n+\t\t      int flags)\n {\n \tint i;\n-\ti = verify_cache(cache, entries, silent);\n+\ti = verify_cache(cache, entries, flags);\n \tif (i)\n \t\treturn i;\n-\ti = update_one(it, cache, entries, \"\", 0, missing_ok, dryrun);\n+\ti = update_one(it, cache, entries, \"\", 0, flags);\n \tif (i < 0)\n \t\treturn i;\n \treturn 0;\n@@ -572,11 +571,9 @@ int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix)\n \n \twas_valid = cache_tree_fully_valid(active_cache_tree);\n \tif (!was_valid) {\n-\t\tint missing_ok = flags & WRITE_TREE_MISSING_OK;\n-\n \t\tif (cache_tree_update(active_cache_tree,\n \t\t\t\t      active_cache, active_nr,\n-\t\t\t\t      missing_ok, 0, 0) < 0)\n+\t\t\t\t      flags) < 0)\n \t\t\treturn WRITE_TREE_UNMERGED_INDEX;\n \t\tif (0 <= newfd) {\n \t\t\tif (!write_cache(newfd, active_cache, active_nr) &&\n@@ -672,10 +669,10 @@ int cache_tree_matches_traversal(struct cache_tree *root,\n \treturn 0;\n }\n \n-int update_main_cache_tree (int silent)\n+int update_main_cache_tree (int flags)\n {\n \tif (!the_index.cache_tree)\n \t\tthe_index.cache_tree = cache_tree();\n \treturn cache_tree_update(the_index.cache_tree,\n-\t\t\t\t the_index.cache, the_index.cache_nr, 0, 0, silent);\n+\t\t\t\t the_index.cache, the_index.cache_nr, flags);\n }\ndiff --git a/cache-tree.h b/cache-tree.h\nindex 0ec0b2a..d8cb2e9 100644\n--- a/cache-tree.h\n+++ b/cache-tree.h\n@@ -29,13 +29,15 @@ void cache_tree_write(struct strbuf *, struct cache_tree *root);\n struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);\n \n int cache_tree_fully_valid(struct cache_tree *);\n-int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int, int);\n+int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int);\n \n int update_main_cache_tree(int);\n \n /* bitmasks to write_cache_as_tree flags */\n #define WRITE_TREE_MISSING_OK 1\n #define WRITE_TREE_IGNORE_CACHE_TREE 2\n+#define WRITE_TREE_DRY_RUN 4\n+#define WRITE_TREE_SILENT 8\n \n /* error return codes */\n #define WRITE_TREE_UNREADABLE_INDEX (-1)\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex d83cd6c..6479a60 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -264,7 +264,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)\n \n \tif (!cache_tree_fully_valid(active_cache_tree) &&\n \t    cache_tree_update(active_cache_tree,\n-\t\t\t      active_cache, active_nr, 0, 0, 0) < 0)\n+\t\t\t      active_cache, active_nr, 0) < 0)\n \t\tdie(\"error building trees\");\n \n \tresult = lookup_tree(active_cache_tree->sha1);\ndiff --git a/test-dump-cache-tree.c b/test-dump-cache-tree.c\nindex e6c2923..a6ffdf3 100644\n--- a/test-dump-cache-tree.c\n+++ b/test-dump-cache-tree.c\n@@ -59,6 +59,6 @@ int main(int ac, char **av)\n \tstruct cache_tree *another = cache_tree();\n \tif (read_cache() < 0)\n \t\tdie(\"unable to read index file\");\n-\tcache_tree_update(another, active_cache, active_nr, 0, 1, 0);\n+\tcache_tree_update(another, active_cache, active_nr, WRITE_TREE_DRY_RUN);\n \treturn dump_cache_tree(active_cache_tree, another, \"\");\n }\n-- \n1.7.8.36.g69ee2\n"},{"id":"184019","messageId":"1328525855-2547-3-git-send-email-pclouds@gmail.com","threadId":"29561","inReplyTo":"1328525855-2547-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-06T10:57:33Z","receivedAt":"2012-02-06T10:57:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This is the start of deprecating current commit behavior (do not allow\ncommit as-is when there are i-t-a entries in index). Users will be\nannoyed by a warning saying the behavior will change in 1.8.0 and asked\nto set commit.ignoreIntentToAdd properly.\n\nThe plan after that is:\n\n - Keep it this way until 1.8.0\n\n - In 1.8.0, we consider the lack of commit.ignoreIntentToAdd means\n   \"true\". A deprecation date is set. The warning message is updated\n   stating that from that day, this config key will be ignored. The\n   behavior will be as if this config key is always \"true\".\n\n - In the chosen release, remove support for this config key.\n   WRITE_TREE_IGNORE_INTENT_TO_ADD is set unconditionally.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/config.txt  |   10 ++++++++++\n Documentation/git-add.txt |   12 ++++++++++--\n builtin/commit.c          |   28 +++++++++++++++++++++++++---\n cache-tree.c              |    8 +++++---\n cache-tree.h              |    1 +\n t/t2203-add-intent.sh     |   21 ++++++++++++++++++++-\n 6 files changed, 71 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex abeb82b..6ec81a8 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -831,6 +831,16 @@ commit.template::\n \t\"{tilde}/\" is expanded to the value of `$HOME` and \"{tilde}user/\" to the\n \tspecified user's home directory.\n \n+commit.ignoreIntentToAdd::\n+\tAllow to commit the index as-is even if there are\n+\tintent-to-add entries (see option `-N` in linkgit:git-add[1])\n+\tin index. Set to `false` to disallow commit in this acase, or `true`\n+\tto allow it.\n++\n+By default, `git commit` refuses to commit as-is when you have intent-to-add\n+entries. This will change in 1.8.0, where `git commit` allows it. If you\n+prefer current behavior, please set it to `false`.\n+\n credential.helper::\n \tSpecify an external helper to be called when a username or\n \tpassword credential is needed; the helper may consult external\ndiff --git a/Documentation/git-add.txt b/Documentation/git-add.txt\nindex 9c1d395..ec548ea 100644\n--- a/Documentation/git-add.txt\n+++ b/Documentation/git-add.txt\n@@ -123,8 +123,16 @@ subdirectories.\n \tRecord only the fact that the path will be added later. An entry\n \tfor the path is placed in the index with no content. This is\n \tuseful for, among other things, showing the unstaged content of\n-\tsuch files with `git diff` and committing them with `git commit\n-\t-a`.\n+\tsuch files with `git diff`.\n++\n+Paths added with this option have intent-to-add flag in index. The\n+flag is removed once real content is added or updated. By default you\n+cannot commit the index as-is from until this flag is removed from all\n+entries (i.e. all entries have real content). See commit.ignoreIntentToAdd\n+regardless the flag.\n++\n+Committing with `git commit -a` or with selected paths works\n+regardless the config key and the flag.\n \n --refresh::\n \tDon't add the file(s), but only refresh their stat()\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex bf42bb3..af3250c 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -86,6 +86,7 @@ static int all, also, interactive, patch_interactive, only, amend, signoff;\n static int edit_flag = -1; /* unspecified */\n static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;\n static int no_post_rewrite, allow_empty_message;\n+static int cache_tree_flags;\n static char *untracked_files_arg, *force_date, *ignore_submodule_arg;\n static char *sign_commit;\n \n@@ -117,6 +118,8 @@ static enum {\n } status_format = STATUS_FORMAT_LONG;\n static int status_show_branch;\n \n+static int set_commit_ignoreintenttoadd;\n+\n static int opt_parse_m(const struct option *opt, const char *arg, int unset)\n {\n \tstruct strbuf *buf = opt->value;\n@@ -400,7 +403,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \t\tfd = hold_locked_index(&index_lock, 1);\n \t\tadd_files_to_cache(also ? prefix : NULL, pathspec, 0);\n \t\trefresh_cache_or_die(refresh_flags);\n-\t\tupdate_main_cache_tree(WRITE_TREE_SILENT);\n+\t\tupdate_main_cache_tree(cache_tree_flags | WRITE_TREE_SILENT);\n \t\tif (write_cache(fd, active_cache, active_nr) ||\n \t\t    close_lock_file(&index_lock))\n \t\t\tdie(_(\"unable to write new_index file\"));\n@@ -420,8 +423,20 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \tif (!pathspec || !*pathspec) {\n \t\tfd = hold_locked_index(&index_lock, 1);\n \t\trefresh_cache_or_die(refresh_flags);\n+\t\tif (!set_commit_ignoreintenttoadd) {\n+\t\t\tint i;\n+\t\t\tfor (i = 0; i < active_nr; i++)\n+\t\t\t\tif (active_cache[i]->ce_flags & CE_INTENT_TO_ADD)\n+\t\t\t\t\tbreak;\n+\t\t\tif (i < active_nr)\n+\t\t\t\twarning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n+\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case. This will change in\\n\"\n+\t\t\t\t\t  \"1.8.0 where intent-to-add entries are simply ignored when committing\\n\"\n+\t\t\t\t\t  \"as-is. Please look up document and set commit.ignoreIntentToAdd\\n\"\n+\t\t\t\t\t  \"properly to stop this warning.\"));\n+\t\t}\n \t\tif (active_cache_changed) {\n-\t\t\tupdate_main_cache_tree(WRITE_TREE_SILENT);\n+\t\t\tupdate_main_cache_tree(cache_tree_flags | WRITE_TREE_SILENT);\n \t\t\tif (write_cache(fd, active_cache, active_nr) ||\n \t\t\t    commit_locked_index(&index_lock))\n \t\t\t\tdie(_(\"unable to write new_index file\"));\n@@ -870,7 +885,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,\n \t */\n \tdiscard_cache();\n \tread_cache_from(index_file);\n-\tif (update_main_cache_tree(0)) {\n+\tif (update_main_cache_tree(cache_tree_flags)) {\n \t\terror(_(\"Error building trees\"));\n \t\treturn 0;\n \t}\n@@ -1338,6 +1353,13 @@ static int git_commit_config(const char *k, const char *v, void *cb)\n \t\tinclude_status = git_config_bool(k, v);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"commit.ignoreintenttoadd\")) {\n+\t\tset_commit_ignoreintenttoadd = 1;\n+\t\tif (git_config_bool(k, v))\n+\t\t\tcache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;\n+\t\telse\n+\t\t\tcache_tree_flags &= ~WRITE_TREE_IGNORE_INTENT_TO_ADD;\n+\t}\n \n \tstatus = git_gpg_config(k, v, NULL);\n \tif (status)\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 16355d6..d0be159 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -159,7 +159,9 @@ static int verify_cache(struct cache_entry **cache,\n \tfunny = 0;\n \tfor (i = 0; i < entries; i++) {\n \t\tstruct cache_entry *ce = cache[i];\n-\t\tif (ce_stage(ce) || (ce->ce_flags & CE_INTENT_TO_ADD)) {\n+\t\tif (ce_stage(ce) ||\n+\t\t    ((flags & WRITE_TREE_IGNORE_INTENT_TO_ADD) == 0 &&\n+\t\t     (ce->ce_flags & CE_INTENT_TO_ADD))) {\n \t\t\tif (silent)\n \t\t\t\treturn -1;\n \t\t\tif (10 < ++funny) {\n@@ -339,8 +341,8 @@ static int update_one(struct cache_tree *it,\n \t\t\t\tmode, sha1_to_hex(sha1), entlen+baselen, path);\n \t\t}\n \n-\t\tif (ce->ce_flags & CE_REMOVE)\n-\t\t\tcontinue; /* entry being removed */\n+\t\tif (ce->ce_flags & (CE_REMOVE | CE_INTENT_TO_ADD))\n+\t\t\tcontinue; /* entry being removed or placeholder */\n \n \t\tstrbuf_grow(&buffer, entlen + 100);\n \t\tstrbuf_addf(&buffer, \"%o %.*s%c\", mode, entlen, path + baselen, '\\0');\ndiff --git a/cache-tree.h b/cache-tree.h\nindex d8cb2e9..af3b917 100644\n--- a/cache-tree.h\n+++ b/cache-tree.h\n@@ -38,6 +38,7 @@ int update_main_cache_tree(int);\n #define WRITE_TREE_IGNORE_CACHE_TREE 2\n #define WRITE_TREE_DRY_RUN 4\n #define WRITE_TREE_SILENT 8\n+#define WRITE_TREE_IGNORE_INTENT_TO_ADD 16\n \n /* error return codes */\n #define WRITE_TREE_UNREADABLE_INDEX (-1)\ndiff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh\nindex 58a3299..88a508e 100755\n--- a/t/t2203-add-intent.sh\n+++ b/t/t2203-add-intent.sh\n@@ -41,7 +41,26 @@ test_expect_success 'cannot commit with i-t-a entry' '\n \techo frotz >nitfol &&\n \tgit add rezrov &&\n \tgit add -N nitfol &&\n-\ttest_must_fail git commit\n+\ttest_must_fail git commit -minitial\n+'\n+\n+test_expect_success 'can commit tree with i-t-a entry' '\n+\tgit reset --hard &&\n+\techo xyzzy >rezrov &&\n+\techo frotz >nitfol &&\n+\tgit add rezrov &&\n+\tgit add -N nitfol &&\n+\tgit config commit.ignoreIntentToAdd true &&\n+\tgit commit -m initial &&\n+\tgit ls-tree -r HEAD >actual &&\n+\tcat >expected <<EOF &&\n+100644 blob ce013625030ba8dba906f756967f9e9ca394464a\telif\n+100644 blob ce013625030ba8dba906f756967f9e9ca394464a\tfile\n+100644 blob cf7711b63209d0dbc2d030f7fe3513745a9880e4\trezrov\n+EOF\n+\ttest_cmp expected actual &&\n+\tgit config commit.ignoreIntentToAdd false &&\n+\tgit reset HEAD^\n '\n \n test_expect_success 'can commit with an unrelated i-t-a entry in index' '\n-- \n1.7.8.36.g69ee2\n"},{"id":"184020","messageId":"1328525855-2547-4-git-send-email-pclouds@gmail.com","threadId":"29561","inReplyTo":"1328525855-2547-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 3/4] commit: turn commit.ignoreIntentToAdd to true by default","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-06T10:57:34Z","receivedAt":"2012-02-06T10:57:34Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"From now on, those who has not set commit.ignoreIntentToAdd can commit\nas-is even if there are intent-to-add entries. Users are advised/annoyed\nto switch to new behavior.\n\nSupport for \"commit.ignoreIntentToAdd = true\" will be dropped in future.\nThe placeholder \"FIXME\" needs to be replaced when it's decided what\nrelease will drop config support.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/config.txt |    5 ++---\n builtin/commit.c         |   13 ++++++++-----\n t/t2203-add-intent.sh    |    4 ++--\n 3 files changed, 12 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 6ec81a8..f9a05ac 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -837,9 +837,8 @@ commit.ignoreIntentToAdd::\n \tin index. Set to `false` to disallow commit in this acase, or `true`\n \tto allow it.\n +\n-By default, `git commit` refuses to commit as-is when you have intent-to-add\n-entries. This will change in 1.8.0, where `git commit` allows it. If you\n-prefer current behavior, please set it to `false`.\n+By default, `git commit` allows to commit as-is when you have intent-to-add\n+entries. Support for this configuration variable will be dropped in FIXME.\n \n credential.helper::\n \tSpecify an external helper to be called when a username or\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex af3250c..eb0ca49 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -423,17 +423,17 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \tif (!pathspec || !*pathspec) {\n \t\tfd = hold_locked_index(&index_lock, 1);\n \t\trefresh_cache_or_die(refresh_flags);\n-\t\tif (!set_commit_ignoreintenttoadd) {\n+\t\tif (!(cache_tree_flags & WRITE_TREE_IGNORE_INTENT_TO_ADD)) {\n \t\t\tint i;\n \t\t\tfor (i = 0; i < active_nr; i++)\n \t\t\t\tif (active_cache[i]->ce_flags & CE_INTENT_TO_ADD)\n \t\t\t\t\tbreak;\n \t\t\tif (i < active_nr)\n \t\t\t\twarning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n-\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case. This will change in\\n\"\n-\t\t\t\t\t  \"1.8.0 where intent-to-add entries are simply ignored when committing\\n\"\n-\t\t\t\t\t  \"as-is. Please look up document and set commit.ignoreIntentToAdd\\n\"\n-\t\t\t\t\t  \"properly to stop this warning.\"));\n+\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case. But this is deprecated\\n\"\n+\t\t\t\t\t  \"support for this behavior will be dropped in FIXME.\\n\"\n+\t\t\t\t\t  \"Please look up document and set commit.ignoreIntentToAdd to true\\n\"\n+\t\t\t\t\t  \"or remove it.\"));\n \t\t}\n \t\tif (active_cache_changed) {\n \t\t\tupdate_main_cache_tree(cache_tree_flags | WRITE_TREE_SILENT);\n@@ -1423,6 +1423,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tgit_config(git_commit_config, &s);\n \tdetermine_whence(&s);\n \n+\tif (!set_commit_ignoreintenttoadd)\n+\t\tcache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;\n+\n \tif (get_sha1(\"HEAD\", sha1))\n \t\tcurrent_head = NULL;\n \telse {\ndiff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh\nindex 88a508e..09b8bbf 100755\n--- a/t/t2203-add-intent.sh\n+++ b/t/t2203-add-intent.sh\n@@ -41,11 +41,11 @@ test_expect_success 'cannot commit with i-t-a entry' '\n \techo frotz >nitfol &&\n \tgit add rezrov &&\n \tgit add -N nitfol &&\n-\ttest_must_fail git commit -minitial\n+\tgit commit -minitial\n '\n \n test_expect_success 'can commit tree with i-t-a entry' '\n-\tgit reset --hard &&\n+\tgit reset --hard HEAD^ &&\n \techo xyzzy >rezrov &&\n \techo frotz >nitfol &&\n \tgit add rezrov &&\n-- \n1.7.8.36.g69ee2\n"},{"id":"184021","messageId":"1328525855-2547-5-git-send-email-pclouds@gmail.com","threadId":"29561","inReplyTo":"1328525855-2547-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 4/4] commit: remove commit.ignoreIntentToAdd, assume it's always true","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-06T10:57:35Z","receivedAt":"2012-02-06T10:57:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/config.txt |    9 ---------\n builtin/commit.c         |   24 +-----------------------\n t/t2203-add-intent.sh    |    2 +-\n 3 files changed, 2 insertions(+), 33 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f9a05ac..abeb82b 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -831,15 +831,6 @@ commit.template::\n \t\"{tilde}/\" is expanded to the value of `$HOME` and \"{tilde}user/\" to the\n \tspecified user's home directory.\n \n-commit.ignoreIntentToAdd::\n-\tAllow to commit the index as-is even if there are\n-\tintent-to-add entries (see option `-N` in linkgit:git-add[1])\n-\tin index. Set to `false` to disallow commit in this acase, or `true`\n-\tto allow it.\n-+\n-By default, `git commit` allows to commit as-is when you have intent-to-add\n-entries. Support for this configuration variable will be dropped in FIXME.\n-\n credential.helper::\n \tSpecify an external helper to be called when a username or\n \tpassword credential is needed; the helper may consult external\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex eb0ca49..491cae1 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -118,8 +118,6 @@ static enum {\n } status_format = STATUS_FORMAT_LONG;\n static int status_show_branch;\n \n-static int set_commit_ignoreintenttoadd;\n-\n static int opt_parse_m(const struct option *opt, const char *arg, int unset)\n {\n \tstruct strbuf *buf = opt->value;\n@@ -423,18 +421,6 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,\n \tif (!pathspec || !*pathspec) {\n \t\tfd = hold_locked_index(&index_lock, 1);\n \t\trefresh_cache_or_die(refresh_flags);\n-\t\tif (!(cache_tree_flags & WRITE_TREE_IGNORE_INTENT_TO_ADD)) {\n-\t\t\tint i;\n-\t\t\tfor (i = 0; i < active_nr; i++)\n-\t\t\t\tif (active_cache[i]->ce_flags & CE_INTENT_TO_ADD)\n-\t\t\t\t\tbreak;\n-\t\t\tif (i < active_nr)\n-\t\t\t\twarning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n-\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case. But this is deprecated\\n\"\n-\t\t\t\t\t  \"support for this behavior will be dropped in FIXME.\\n\"\n-\t\t\t\t\t  \"Please look up document and set commit.ignoreIntentToAdd to true\\n\"\n-\t\t\t\t\t  \"or remove it.\"));\n-\t\t}\n \t\tif (active_cache_changed) {\n \t\t\tupdate_main_cache_tree(cache_tree_flags | WRITE_TREE_SILENT);\n \t\t\tif (write_cache(fd, active_cache, active_nr) ||\n@@ -1353,13 +1339,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)\n \t\tinclude_status = git_config_bool(k, v);\n \t\treturn 0;\n \t}\n-\tif (!strcmp(k, \"commit.ignoreintenttoadd\")) {\n-\t\tset_commit_ignoreintenttoadd = 1;\n-\t\tif (git_config_bool(k, v))\n-\t\t\tcache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;\n-\t\telse\n-\t\t\tcache_tree_flags &= ~WRITE_TREE_IGNORE_INTENT_TO_ADD;\n-\t}\n \n \tstatus = git_gpg_config(k, v, NULL);\n \tif (status)\n@@ -1423,8 +1402,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)\n \tgit_config(git_commit_config, &s);\n \tdetermine_whence(&s);\n \n-\tif (!set_commit_ignoreintenttoadd)\n-\t\tcache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;\n+\tcache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;\n \n \tif (get_sha1(\"HEAD\", sha1))\n \t\tcurrent_head = NULL;\ndiff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh\nindex 09b8bbf..7c7ab54 100755\n--- a/t/t2203-add-intent.sh\n+++ b/t/t2203-add-intent.sh\n@@ -50,7 +50,7 @@ test_expect_success 'can commit tree with i-t-a entry' '\n \techo frotz >nitfol &&\n \tgit add rezrov &&\n \tgit add -N nitfol &&\n-\tgit config commit.ignoreIntentToAdd true &&\n+\tgit config commit.ignoreIntentToAdd false &&\n \tgit commit -m initial &&\n \tgit ls-tree -r HEAD >actual &&\n \tcat >expected <<EOF &&\n-- \n1.7.8.36.g69ee2\n"},{"id":"184045","messageId":"7vhaz37nce.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"1328525855-2547-3-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-06T19:50:41Z","receivedAt":"2012-02-06T19:50:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> +commit.ignoreIntentToAdd::\n> +\tAllow to commit the index as-is even if there are\n> +\tintent-to-add entries (see option `-N` in linkgit:git-add[1])\n> +\tin index. Set to `false` to disallow commit in this acase, or `true`\n> +\tto allow it.\n> ++\n> +By default, `git commit` refuses to commit as-is when you have intent-to-add\n> +entries. This will change in 1.8.0, where `git commit` allows it. If you\n> +prefer current behavior, please set it to `false`.\n\ns/acase/case/;\n\nMore importantly, if we allow it, what would be included and what would be\nomitted from the final commit?  What happens if we allow it is much more\nimportant information than \"we allow it even if there are\".\n\n\tWhen set to `true`, prevent `git commit` from creating a commit\n\tfrom an index that has entries that were added with `git add -N`\n\tbut have not been updated with real contents, as the user may have\n\tforgotten to tell the final contents for these entries.  Setting\n\tthis to `false` makes `git commit` pretend as if these entries do\n\tnot exist in the index.\n\n\tThe default for this variable is `false`, but it will change to\n\t`true` in later releases of git (perhaps 1.8.0). To ease the\n\ttransition, you may want to set it to `true` now and get used to\n\tthe new behaviour early, or you may want to set it to `false` to\n\tkeep the old behaviour a bit longer. We however expect to support\n\tsetting this to `false` (to keep the current behaviour) only for a\n\tlimited time after the default is changed to `true`.\n\nNow, I removed the \"intent to add\" jargon from the above paragraph, the\ndescription below can lose it as well.\n\n> diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt\n> index 9c1d395..ec548ea 100644\n> --- a/Documentation/git-add.txt\n> +++ b/Documentation/git-add.txt\n> @@ -123,8 +123,16 @@ subdirectories.\n>  \tRecord only the fact that the path will be added later. An entry\n>  \tfor the path is placed in the index with no content. This is\n>  \tuseful for, among other things, showing the unstaged content of\n> -\tsuch files with `git diff` and committing them with `git commit\n> -\t-a`.\n> +\tsuch files with `git diff`.\n> ++\n> +Paths added with this option have intent-to-add flag in index. The\n> +flag is removed once real content is added or updated. By default you\n> +cannot commit the index as-is from until this flag is removed from all\n> +entries (i.e. all entries have real content). See commit.ignoreIntentToAdd\n> +regardless the flag.\n\nI cannot understand \"regardlessthe flag\" in the last sentence.\n\n> ++\n> +Committing with `git commit -a` or with selected paths works\n> +regardless the config key and the flag.\n\nJust an aside, not suggesting to change anything to the final text.\n\nThis is interesting in that the reason why \"selected paths\" works is a bit\nsubtle.  You may have entries added with `-N` that are covered by the\npathspec, and those that are not covered by the pathspec.  For the former\n(i.e. those the user said \"I'll decide the final contents later\" but are\ncovered by pathspec), the user is telling the final contents to be in the\ncommit, so we know the final contents for them.  For the latter (i.e.\nthose outside the pathspec), they are excluded and made to match the\nversion in the HEAD commit, so we know the final contents for them, too.\n\n> +\t\t\tif (i < active_nr)\n> +\t\t\t\twarning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n> +\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case.\n\nCan we phrase this a bit better?\n\nIt is not like \"forbids\", but is \"giving up because you didn't tell me\nwhat content to include in the commit, even though you said you will tell\nme later\".\n"},{"id":"184046","messageId":"7vd39r7nbo.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"1328525855-2547-2-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 1/4] cache-tree: update API to take abitrary flags","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-06T19:51:07Z","receivedAt":"2012-02-06T19:51:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n>  int cache_tree_update(struct cache_tree *it,\n>  \t\t      struct cache_entry **cache,\n>  \t\t      int entries,\n> -\t\t      int missing_ok,\n> -\t\t      int dryrun,\n> -\t\t      int silent)\n> +\t\t      int flags)\n\nVery nice ;-)\n"},{"id":"184047","messageId":"7v8vkf7mrn.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"1328525855-2547-4-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 3/4] commit: turn commit.ignoreIntentToAdd to true by default","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-06T20:03:08Z","receivedAt":"2012-02-06T20:03:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> -\t\tif (!set_commit_ignoreintenttoadd) {\n\nNow no warning() is associated with testing of this flag, which means that\npeople who didn't get around to read the doc and react to the warnings in\nthe earlier releases will get _nothing_ when the real change hits them?\n\nThat sounds strangely bad.  What am I missing?\n\n> +\t\tif (!(cache_tree_flags & WRITE_TREE_IGNORE_INTENT_TO_ADD)) {\n>  \t\t\tint i;\n>  \t\t\tfor (i = 0; i < active_nr; i++)\n>  \t\t\t\tif (active_cache[i]->ce_flags & CE_INTENT_TO_ADD)\n>  \t\t\t\t\tbreak;\n>  \t\t\tif (i < active_nr)\n>  \t\t\t\twarning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n> -\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case. This will change in\\n\"\n> -\t\t\t\t\t  \"1.8.0 where intent-to-add entries are simply ignored when committing\\n\"\n> -\t\t\t\t\t  \"as-is. Please look up document and set commit.ignoreIntentToAdd\\n\"\n> -\t\t\t\t\t  \"properly to stop this warning.\"));\n> +\t\t\t\t\t  \"\\\"git add -N\\\". Git currently forbids this case. But this is deprecated\\n\"\n> +\t\t\t\t\t  \"support for this behavior will be dropped in FIXME.\\n\"\n> +\t\t\t\t\t  \"Please look up document and set commit.ignoreIntentToAdd to true\\n\"\n> +\t\t\t\t\t  \"or remove it.\"));\n\nAs this is marked with FIXME ;-)\n\nAt this point in the deprecation cycle, \"currently forbids this case.\" is\nnot true at all. \"You asked me to punt when you forgot to tell me the\nfinal contents for i-t-a entries, so I am honoring your wish\" is what is\nhappening here.  Perhaps...\n\n\tGit currently allows you to set commit.ignoreIntentToAdd to false\n        to remind you about the paths you may have forgotten to add the\n        real contents to before committing, but this support will be\n        removed in future versions of Git.  Set commit.ignoreIntentToAdd\n        to `false` or remove the variable, and get used to the new\n        behaviour, to squelch this message.\n"},{"id":"184048","messageId":"7v4nv37mnb.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"1328525855-2547-5-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 4/4] commit: remove commit.ignoreIntentToAdd, assume it's always true","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-06T20:05:44Z","receivedAt":"2012-02-06T20:05:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n\n> diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh\n> index 09b8bbf..7c7ab54 100755\n> --- a/t/t2203-add-intent.sh\n> +++ b/t/t2203-add-intent.sh\n> @@ -50,7 +50,7 @@ test_expect_success 'can commit tree with i-t-a entry' '\n>  \techo frotz >nitfol &&\n>  \tgit add rezrov &&\n>  \tgit add -N nitfol &&\n> -\tgit config commit.ignoreIntentToAdd true &&\n> +\tgit config commit.ignoreIntentToAdd false &&\n\nThis deserves a comment to the effect that the variable is now *ignored*.\n\n>  \tgit commit -m initial &&\n>  \tgit ls-tree -r HEAD >actual &&\n>  \tcat >expected <<EOF &&\n"},{"id":"184059","messageId":"7vwr7z653f.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"1328525855-2547-3-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-06T21:10:12Z","receivedAt":"2012-02-06T21:10:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt\n> index 9c1d395..ec548ea 100644\n> --- a/Documentation/git-add.txt\n> +++ b/Documentation/git-add.txt\n> @@ -123,8 +123,16 @@ subdirectories.\n>  \tRecord only the fact that the path will be added later. An entry\n>  \tfor the path is placed in the index with no content. This is\n>  \tuseful for, among other things, showing the unstaged content of\n> -\tsuch files with `git diff` and committing them with `git commit\n> -\t-a`.\n> +\tsuch files with `git diff`.\n> ++\n> +Paths added with this option have intent-to-add flag in index. The\n> +flag is removed once real content is added or updated. By default you\n> +cannot commit the index as-is from until this flag is removed from all\n> +entries (i.e. all entries have real content). See commit.ignoreIntentToAdd\n> +regardless the flag.\n> ++\n> +Committing with `git commit -a` or with selected paths works\n> +regardless the config key and the flag.\n\nIt still is not clear to me how best to sell this change to the end-user\ncommunity.\n\nIIRC, the original motivation of intent-to-add \"add -N\" was in response to\nusers who curse Git because they often forget to add new files before\ncommitting, and they wanted to say \"Here I have a new file, it is not\ncomplete yet, but I do not want it left out of the commit. While my memory\nis fresh, let me tell Git to keep an eye on it, so that it can remind me\nif I forget to add the final contents.\"  For them, the current \"did you\nforget to add them?  If so tell me the final contents for at least the\npaths you will be changing with this commit\" error was a perfect safety\nsolution.\n\nIt turned out that the benefits described we see above in the context,\n\"This is useful, among other things, ...\", were of more value, and for\nthese use cases, i-t-a entries ceased to mean \"I may forget, so I am\ntelling you now, please remind me when I say commit.\"  And \"did you\nforget?\" error is hinderance for them.\n\nBut does that mean nobody will ever need \"please remind me lest I forget\"?\nJust the original requestor of the \"add -N\" feature may still be using\ngit, but more importantly, isn't it the case that those who have been\nusing it merely for the other side effect (e.g. 'git diff') sometimes want\nthe \"please remind me\" safety?\n\nI suspect that some among 1 million Git users would want the \"please\nremind me\", so a solution with configuration variable without command line\noverride is not ideal (command line without any configurability is fine as\nlong as we have a good default).\n\nI am beginning to think \"safety by default, which can be turned off by\nlearned users, but still can be turned on on demand\" may be a lot easier\nto sell this.  That is:\n\n - commit.ignoreIntentToAdd defaults to `false`; the default will never\n   change.  The users can set it to `true`.\n\n - \"commit --ignore-intent-to-add\" can be used without setting the\n   configuration or to defeat an explicit `false`, for a one-shot request.\n\n - \"commit --honor-intent-to-add\" can be used to defeat an explicit\n   `true`, for a one-shot request.\n\nThe third one is a bit funny, as it is a way to bring back safety when the\nuser earlier decided that he does not need that kind of safety (i.e. \"I\nonly say 'add -N' for `diff` and stuff, I will never forget to add real\ncontents before committing\"), so it will almost never be used, because\nthese users who set 'ignoreIntentToAdd = true' do _not_ expect Git to help\nthem in remembering to add the real contents.  And having to add a funny\noption just for the sake of completeness is often an indication that there\nis something fundamentally wrong in the system that the option tries to\nexpress an interface into it.\n\nWithout conclusion... Sigh...\n"},{"id":"184060","messageId":"20120206211321.GA2949@burratino","threadId":"29561","inReplyTo":"7vwr7z653f.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-02-06T21:13:21Z","receivedAt":"2012-02-06T21:13:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJunio C Hamano wrote:\n\n> IIRC, the original motivation of intent-to-add \"add -N\" was in response to\n> users who curse Git because they often forget to add new files before\n> committing, and they wanted to say \"Here I have a new file, it is not\n> complete yet, but I do not want it left out of the commit. While my memory\n> is fresh, let me tell Git to keep an eye on it, so that it can remind me\n> if I forget to add the final contents.\"\n\nI agree with everything up to here.  But I believe these people were\n_already_ paying attention to \"git status\" output from the commandline\nand in the editor window when they run \"git commit\", to notice other\nchanges they forgot to add, too.  I don't think this series would\ninconvenience them.\n\nHoping I can find time to look over the other changes soon.\n\nThanks,\nJonathan\n"},{"id":"184065","messageId":"7vpqdr63b5.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"20120206211321.GA2949@burratino","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-06T21:48:46Z","receivedAt":"2012-02-06T21:48:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>\n>> IIRC, the original motivation of intent-to-add \"add -N\" was in response to\n>> users who curse Git because they often forget to add new files before\n>> committing, and they wanted to say \"Here I have a new file, it is not\n>> complete yet, but I do not want it left out of the commit. While my memory\n>> is fresh, let me tell Git to keep an eye on it, so that it can remind me\n>> if I forget to add the final contents.\"\n>\n> I agree with everything up to here.  But I believe these people were\n> _already_ paying attention to \"git status\" output from the commandline\n> and in the editor window when they run \"git commit\", to notice other\n> changes they forgot to add, too.  I don't think this series would\n> inconvenience them.\n\nThat means that you are willing to declare that nobody will ever need\n\"please remind me lest I forget\".  Not just the original requestor of the\n\"add -N\" feature, but absolutely nobody else.\n\nThen the deprecation sequence presented in this series is fine.  The\nwording to sell that \"removal of misfeature\" to the end user community\nneeds to be well thought out, though.\n"},{"id":"184080","messageId":"CACsJy8Be=WLv1Zz5CqQMYfi8dJN6M980kVuckAQKAujVo8xFkQ@mail.gmail.com","threadId":"29561","inReplyTo":"7vhaz37nce.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-07T00:43:14Z","receivedAt":"2012-02-07T00:43:14Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2012/2/7 Junio C Hamano <gitster@pobox.com>:\n>> +                     if (i < active_nr)\n>> +                             warning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n>> +                                       \"\\\"git add -N\\\". Git currently forbids this case.\n>\n> Can we phrase this a bit better?\n>\n> It is not like \"forbids\", but is \"giving up because you didn't tell me\n> what content to include in the commit, even though you said you will tell\n> me later\".\n\n\"rejects\"? I would rather say \"see `git add -N` man page for more\nexplanation\" than putting it here. The warning is quite long as it is\nright now.\n-- \nDuy\n"},{"id":"184081","messageId":"CACsJy8C5=JKHsjyaSFsxxyScb1CCQZmh4gXSAgsyJ8DFkjfQ0g@mail.gmail.com","threadId":"29561","inReplyTo":"7vwr7z653f.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-07T00:58:12Z","receivedAt":"2012-02-07T00:58:12Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2012/2/7 Junio C Hamano <gitster@pobox.com>:\n> It still is not clear to me how best to sell this change to the end-user\n> community.\n>\n> IIRC, the original motivation of intent-to-add \"add -N\" was in response to\n> users who curse Git because they often forget to add new files before\n> committing, and they wanted to say \"Here I have a new file, it is not\n> complete yet, but I do not want it left out of the commit. While my memory\n> is fresh, let me tell Git to keep an eye on it, so that it can remind me\n> if I forget to add the final contents.\"  For them, the current \"did you\n> forget to add them?  If so tell me the final contents for at least the\n> paths you will be changing with this commit\" error was a perfect safety\n> solution.\n>\n> It turned out that the benefits described we see above in the context,\n> \"This is useful, among other things, ...\", were of more value, and for\n> these use cases, i-t-a entries ceased to mean \"I may forget, so I am\n> telling you now, please remind me when I say commit.\"  And \"did you\n> forget?\" error is hinderance for them.\n>\n> But does that mean nobody will ever need \"please remind me lest I forget\"?\n> Just the original requestor of the \"add -N\" feature may still be using\n> git, but more importantly, isn't it the case that those who have been\n> using it merely for the other side effect (e.g. 'git diff') sometimes want\n> the \"please remind me\" safety?\n>\n> I suspect that some among 1 million Git users would want the \"please\n> remind me\", so a solution with configuration variable without command line\n> override is not ideal (command line without any configurability is fine as\n> long as we have a good default).\n\nWhich is why I prefer adding a new configuration variable (and\noptionally a command line option) instead of deprecating current\nbehavior, because (being lazy) I never be able to find \"some among 1\nmillion\" so I'm fine with assuming there are some among 1 million that\nfavors safety over convenience.\n\n> I am beginning to think \"safety by default, which can be turned off by\n> learned users, but still can be turned on on demand\" may be a lot easier\n> to sell this.  That is:\n>\n>  - commit.ignoreIntentToAdd defaults to `false`; the default will never\n>   change.  The users can set it to `true`.\n>\n>  - \"commit --ignore-intent-to-add\" can be used without setting the\n>   configuration or to defeat an explicit `false`, for a one-shot request.\n>\n>  - \"commit --honor-intent-to-add\" can be used to defeat an explicit\n>   `true`, for a one-shot request.\n>\n> The third one is a bit funny, as it is a way to bring back safety when the\n> user earlier decided that he does not need that kind of safety (i.e. \"I\n> only say 'add -N' for `diff` and stuff, I will never forget to add real\n> contents before committing\"), so it will almost never be used, because\n> these users who set 'ignoreIntentToAdd = true' do _not_ expect Git to help\n> them in remembering to add the real contents.  And having to add a funny\n> option just for the sake of completeness is often an indication that there\n> is something fundamentally wrong in the system that the option tries to\n> express an interface into it.\n\nWell, that --honor-intent-to-add could be renamed as\n--no-ignore-intent-to-add. The --[no-]ignore-intent-to-add pair\nfunctions as a way to override default behavior/config var. No extra\ncould required. \"git commit -h\" just does not show it.\n\nWe need better option/config names though, --ignore-intent-to-add\nlooks way too long to type and it's not clear what it does without\nlooking up \"git add -N\".\n-- \nDuy\n"},{"id":"184082","messageId":"20120207005943.GA2149@burratino","threadId":"29561","inReplyTo":"CACsJy8Be=WLv1Zz5CqQMYfi8dJN6M980kVuckAQKAujVo8xFkQ@mail.gmail.com","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-02-07T00:59:43Z","receivedAt":"2012-02-07T00:59:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n> 2012/2/7 Junio C Hamano <gitster@pobox.com>:\n\n>>> +                     if (i < active_nr)\n>>> +                             warning(_(\"You are committing as-is with intent-to-add entries as the result of\\n\"\n>>> +                                       \"\\\"git add -N\\\". Git currently forbids this case.\n>>\n>> Can we phrase this a bit better?\n>>\n>> It is not like \"forbids\", but is \"giving up because you didn't tell me\n>> what content to include in the commit, even though you said you will tell\n>> me later\".\n>\n> \"rejects\"? I would rather say \"see `git add -N` man page for more\n> explanation\" than putting it here. The warning is quite long as it is\n> right now.\n\nIf I ruled the world, it would say something like this:\n\n\terror: you intended to add \"foo.c\" but did not add it; not committing\n\thint: to commit all changes to tracked files, use \"commit -a\"\n\thint: to commit without adding \"foo.c\", use \"commit --ignore-intent-to-add\", which may become the default in future versions of git\n\nBut without the long line. ;-)\n"},{"id":"184083","messageId":"CACsJy8BrieY3btxbQLiRtm2bxtN3ECaFEs5QVEi=bBOFofbkgA@mail.gmail.com","threadId":"29561","inReplyTo":"7v8vkf7mrn.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/4] commit: turn commit.ignoreIntentToAdd to true by default","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-07T01:03:13Z","receivedAt":"2012-02-07T01:03:13Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2012/2/7 Junio C Hamano <gitster@pobox.com>:\n> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:\n>\n>> -             if (!set_commit_ignoreintenttoadd) {\n>\n> Now no warning() is associated with testing of this flag, which means that\n> people who didn't get around to read the doc and react to the warnings in\n> the earlier releases will get _nothing_ when the real change hits them?\n>\n> That sounds strangely bad.  What am I missing?\n\nWell if they stumble upon this case during the previous deprecation\nphase, they ought to set commit.ignoreIntentToAdd. If it's not set,\nthey probably do not have prior experience with this feature. With\ntheir fresh mind, they hopefully learn the new default behavior via\nto-be-updated git-add.txt so no warnings for them.\n-- \nDuy\n"},{"id":"184084","messageId":"7vmx8v4f9f.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"CACsJy8C5=JKHsjyaSFsxxyScb1CCQZmh4gXSAgsyJ8DFkjfQ0g@mail.gmail.com","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-07T01:13:32Z","receivedAt":"2012-02-07T01:13:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> 2012/2/7 Junio C Hamano <gitster@pobox.com>:\n>\n>> I suspect that some among 1 million Git users would want the \"please\n>> remind me\", so a solution with configuration variable without command line\n>> override is not ideal (command line without any configurability is fine as\n>> long as we have a good default).\n>\n> Which is why I prefer adding a new configuration variable (and\n> optionally a command line option) instead of deprecating current\n> behavior, because (being lazy) I never be able to find \"some among 1\n> million\" so I'm fine with assuming there are some among 1 million that\n> favors safety over convenience.\n\nIf there is one thing I want to absolutely avoid, it is to split the\nuserbase into many pieces by giving sticky configuration variables, so\nthe above argument is not a good starting point.\n\n>> The third one is a bit funny, as it is a way to bring back safety when the\n>> ....  And having to add a funny\n>> option just for the sake of completeness is often an indication that there\n>> is something fundamentally wrong in the system that the option tries to\n>> express an interface into it.\n>\n> Well, that --honor-intent-to-add could be renamed as\n> --no-ignore-intent-to-add.\n\nI wasn't talking about the name at all.  What is _funny_ is the semantics.\n\nA \"by default unsafe\" configuration introduces a need for an option to be\nextra careful only when matters, but \"an option\" to be extra careful by\ndefinition is easy to forget, so it is no longer a safety at all, iow,\npeople who want \"by default unsafe\" will get \"always unsafe\".  And it\nprobably is perfectly fine because to them, forgetting to add 'add -N'\nentries is not a mistake at all, but always is a deliberate act.\n\nAnother thing I am somewhat worried about is if there are existing scripts\nthat create commits and relies on the current \"we cannot commit because\nthe final contents is not known yet\".  I didn't check but for example how\nwell does \"git stash\" work when the default is flipped to \"just ignore\"?\n"},{"id":"184098","messageId":"7v1uq741ip.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"7vwr7z653f.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-07T06:10:22Z","receivedAt":"2012-02-07T06:10:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> It still is not clear to me how best to sell this change to the end-user\n> community.\n\nOK, sorry for wavering.\n\nUnless you are doing \"commit -a\" or \"commit pathspec\", you are responsible\nfor adding all contents you want to have in the commit before you run the\n\"git commit\" command (and for the purpose of this statement, \"add -N\" to\ntell Git to keey an eye on a path does _not_ add contents). A change to\nthe file in the working tree that is left unadded is what you decided to\ndeliberately leave out of the commit, be it a change to a path already in\nHEAD, or a path marked with \"add -N\".  Forgetting to add modified file and\nforgetting to add a file you earlier used \"add -N\" amount to the same kind\nof risk, and \"git status\" is the way to make sure your partial commit has\nexactly what you want (if you are not worried about partial commit, you\nwould be doing \"commit -a\", so the \"safety\" is a moot point).\n\nI was worried too much about backward compatibility and was blind to the\nabove, and was mistakenly defending a false \"safety\" that did not exist at\nall.  Sorry for wasting everybody's time.\n\nSo let's bite the bullet and admit in the Release Notes that the current\nbehaviour was a UI mistake based on the misguided assumption that we can\ngive some kind of \"safety\" by committing when there are \"add -N\" entries\nin the index, which is untrue, and we are fixing it in the new release.\nWe do not need configuration nor command line options.\n\nLet me try to reroll your patch tomorrow (unless you beat me to it) and\nsee if I can come up with an easy-to-understand explanation to it.\n\nThanks.\n"},{"id":"184100","messageId":"CACsJy8CaFhyzgh6N4ov49Tf0mA8qV5uQESFP2u8U7AduOd59PA@mail.gmail.com","threadId":"29561","inReplyTo":"7v1uq741ip.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-02-07T06:26:50Z","receivedAt":"2012-02-07T06:26:50Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2012/2/7 Junio C Hamano <gitster@pobox.com>:\n> Unless you are doing \"commit -a\" or \"commit pathspec\", you are responsible\n> for adding all contents you want to have in the commit before you run the\n> \"git commit\" command (and for the purpose of this statement, \"add -N\" to\n> tell Git to keey an eye on a path does _not_ add contents). A change to\n> the file in the working tree that is left unadded is what you decided to\n> deliberately leave out of the commit, be it a change to a path already in\n> HEAD, or a path marked with \"add -N\".  Forgetting to add modified file and\n> forgetting to add a file you earlier used \"add -N\" amount to the same kind\n> of risk, and \"git status\" is the way to make sure your partial commit has\n> exactly what you want (if you are not worried about partial commit, you\n> would be doing \"commit -a\", so the \"safety\" is a moot point).\n\nWe need something in the commit message so that 5 years from now, when\nsomeone raises the issue again, (s)he does not have to search the mail\narchive. May I steal the above paragraph, maybe rephrase a little bit,\nfor commit message?\n-- \nDuy\n"},{"id":"184106","messageId":"7vwr7z2hzc.fsf@alter.siamese.dyndns.org","threadId":"29561","inReplyTo":"CACsJy8CaFhyzgh6N4ov49Tf0mA8qV5uQESFP2u8U7AduOd59PA@mail.gmail.com","subject":"Re: [PATCH 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-07T07:57:43Z","receivedAt":"2012-02-07T07:57:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> 2012/2/7 Junio C Hamano <gitster@pobox.com>:\n>> Unless you are doing \"commit -a\" or \"commit pathspec\", you are responsible\n>> for adding all contents you want to have in the commit before you run the\n>> \"git commit\" command (and for the purpose of this statement, \"add -N\" to\n>> tell Git to keey an eye on a path does _not_ add contents). A change to\n>> the file in the working tree that is left unadded is what you decided to\n>> deliberately leave out of the commit, be it a change to a path already in\n>> HEAD, or a path marked with \"add -N\".  Forgetting to add modified file and\n>> forgetting to add a file you earlier used \"add -N\" amount to the same kind\n>> of risk, and \"git status\" is the way to make sure your partial commit has\n>> exactly what you want (if you are not worried about partial commit, you\n>> would be doing \"commit -a\", so the \"safety\" is a moot point).\n>\n> We need something in the commit message so that 5 years from now, when\n> someone raises the issue again, (s)he does not have to search the mail\n> archive. May I steal the above paragraph, maybe rephrase a little bit,\n> for commit message?\n\nSurely, and thanks.\n"}]}