git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v2 4/4] commit: remove commit.ignoreIntentToAdd, assume it's always true
Date: Tue,  7 Feb 2012 19:46:44 +0700	[thread overview]
Message-ID: <1328618804-31796-5-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1328618804-31796-1-git-send-email-pclouds@gmail.com>


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/config.txt |   13 -------------
 builtin/commit.c         |   35 +----------------------------------
 t/t2203-add-intent.sh    |    4 ++--
 3 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index fa56753..abeb82b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -831,19 +831,6 @@ commit.template::
 	"{tilde}/" is expanded to the value of `$HOME` and "{tilde}user/" to the
 	specified user's home directory.
 
-commit.ignoreIntentToAdd::
-	When set to `false`, prevent `git commit` from creating a
-	commit from an index that has entries that were added with
-	`git add -N` but have not been updated with real contents, as
-	the user may have forgotten to tell the final contents for
-	these entries.  Setting this to `true` makes `git commit`
-	pretend as if these entries do not exist in the index.
-+
-The default for this variable is `true`. You are discouraged to set it
-to `false` to keep the old behaviour a bit longer because support
-setting this to `false` will be removed in future releases without
-warning.
-
 credential.helper::
 	Specify an external helper to be called when a username or
 	password credential is needed; the helper may consult external
diff --git a/builtin/commit.c b/builtin/commit.c
index cd28081..491cae1 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -118,8 +118,6 @@ static enum {
 } status_format = STATUS_FORMAT_LONG;
 static int status_show_branch;
 
-static int set_commit_ignoreintenttoadd;
-
 static int opt_parse_m(const struct option *opt, const char *arg, int unset)
 {
 	struct strbuf *buf = opt->value;
@@ -423,20 +421,6 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
 	if (!pathspec || !*pathspec) {
 		fd = hold_locked_index(&index_lock, 1);
 		refresh_cache_or_die(refresh_flags);
-		if (!(cache_tree_flags & WRITE_TREE_IGNORE_INTENT_TO_ADD)) {
-			int i;
-			for (i = 0; i < active_nr; i++)
-				if (active_cache[i]->ce_flags & CE_INTENT_TO_ADD)
-					break;
-			if (i < active_nr) {
-				error(_("you intended to add \"%s\" but did not add it; not committing\n"
-					"this behavior is deprecated, please set commit.ignoreIntentToAdd\n"
-					"to true or remove the configuration variable. See the configuration\n"
-					"variable documentation for more information."),
-				      active_cache[i]->name);
-				exit(128); /* die() */
-			}
-		}
 		if (active_cache_changed) {
 			update_main_cache_tree(cache_tree_flags | WRITE_TREE_SILENT);
 			if (write_cache(fd, active_cache, active_nr) ||
@@ -1355,13 +1339,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
 		include_status = git_config_bool(k, v);
 		return 0;
 	}
-	if (!strcmp(k, "commit.ignoreintenttoadd")) {
-		set_commit_ignoreintenttoadd = 1;
-		if (git_config_bool(k, v))
-			cache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;
-		else
-			cache_tree_flags &= ~WRITE_TREE_IGNORE_INTENT_TO_ADD;
-	}
 
 	status = git_gpg_config(k, v, NULL);
 	if (status)
@@ -1425,8 +1402,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	git_config(git_commit_config, &s);
 	determine_whence(&s);
 
-	if (!set_commit_ignoreintenttoadd)
-		cache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;
+	cache_tree_flags |= WRITE_TREE_IGNORE_INTENT_TO_ADD;
 
 	if (get_sha1("HEAD", sha1))
 		current_head = NULL;
@@ -1587,14 +1563,5 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	if (!quiet)
 		print_summary(prefix, sha1, !current_head);
 
-	if (set_commit_ignoreintenttoadd) {
-		if (cache_tree_flags & WRITE_TREE_IGNORE_INTENT_TO_ADD)
-			warning(_("commit.ignoreIntentToAdd = true is not needed anymore.\n"
-				  "Please remove it."));
-		else
-			warning(_("commit.ignoreIntentToAdd = false is deprecated.\n"
-				  "Please see the commit.ignoreIntentToAdd documentation for\n"
-				  "more information and remove the configuration variable."));
-	}
 	return 0;
 }
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index 09b8bbf..6dbfb74 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -44,13 +44,13 @@ test_expect_success 'cannot commit with i-t-a entry' '
 	git commit -minitial
 '
 
-test_expect_success 'can commit tree with i-t-a entry' '
+test_expect_success 'commit.ignoreIntentToAdd = false is ignored' '
 	git reset --hard HEAD^ &&
 	echo xyzzy >rezrov &&
 	echo frotz >nitfol &&
 	git add rezrov &&
 	git add -N nitfol &&
-	git config commit.ignoreIntentToAdd true &&
+	git config commit.ignoreIntentToAdd false &&
 	git commit -m initial &&
 	git ls-tree -r HEAD >actual &&
 	cat >expected <<EOF &&
-- 
1.7.8.36.g69ee2

  parent reply	other threads:[~2012-02-07 12:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07 12:46 [PATCH v2 0/4] Deprecate "not allow as-is commit with i-t-a entries" Nguyễn Thái Ngọc Duy
2012-02-07 12:46 ` [PATCH v2 1/4] cache-tree: update API to take abitrary flags Nguyễn Thái Ngọc Duy
2012-02-07 12:46 ` [PATCH v2 2/4] commit: introduce a config key to allow as-is commit with i-t-a entries Nguyễn Thái Ngọc Duy
2012-02-07 12:46 ` [PATCH v2 3/4] commit: turn commit.ignoreIntentToAdd to true by default Nguyễn Thái Ngọc Duy
2012-02-07 12:46 ` Nguyễn Thái Ngọc Duy [this message]
2012-02-07 16:41 ` [PATCH v2 0/4] Deprecate "not allow as-is commit with i-t-a entries" Junio C Hamano
2012-02-07 19:55   ` Junio C Hamano
2012-02-08  4:03   ` Nguyen Thai Ngoc Duy
2012-02-08 17:34     ` Junio C Hamano
2012-02-09  2:23       ` Nguyen Thai Ngoc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328618804-31796-5-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).