All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>, Jeff King <peff@peff.net>,
	Thomas Rast <trast@inf.ethz.ch>
Subject: [PATCH 1/2] git add: --ignore-removal is a better named --no-all
Date: Mon, 22 Apr 2013 13:43:54 -0700	[thread overview]
Message-ID: <1366663435-13598-2-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1366663435-13598-1-git-send-email-gitster@pobox.com>

In the historical context of "git add --all ." that tells the
command to pay attention to "all kinds of changes" (implying
"without ignoring removals"), the option "--no-all" to countermand
it may have made some sense, but because we will be making "--all"
the default when a pathspec is given, it makes more sense to rename
the option to a more explicit "--ignore-removal".  The "-all" option
naturally becomes its negation: "--no-ignore-removal".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-add.txt | 10 ++++++----
 builtin/add.c             | 11 +++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 5c501a2..48754cb 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -9,9 +9,9 @@ SYNOPSIS
 --------
 [verse]
 'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
-	  [--edit | -e] [--[no-]all | [--update | -u]] [--intent-to-add | -N]
-	  [--refresh] [--ignore-errors] [--ignore-missing] [--]
-	  [<pathspec>...]
+	  [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
+	  [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing]
+	  [--] [<pathspec>...]
 
 DESCRIPTION
 -----------
@@ -111,6 +111,7 @@ of Git, hence the form without <pathspec> should not be used.
 
 -A::
 --all::
+--no-ignore-removal::
 	Update the index not only where the working tree has a file
 	matching <pathspec> but also where the index already has an
 	entry.	This adds, modifies, and removes index entries to
@@ -122,6 +123,7 @@ and its subdirectories. This default will change in a future version
 of Git, hence the form without <pathspec> should not be used.
 
 --no-all::
+--ignore-removal::
 	Update the index by adding new files that are unknown to the
 	index and files modified in the working tree, but ignore
 	files that have been removed from the working tree.  This
@@ -130,7 +132,7 @@ of Git, hence the form without <pathspec> should not be used.
 This option is primarily to help the current users of Git, whose
 "git add <pathspec>..." ignores removed files.  In future versions
 of Git, "git add <pathspec>..." will be a synonym to "git add -A
-<pathspec>..." and "git add --no-all <pathspec>..." will behave like
+<pathspec>..." and "git add --ignore-removal <pathspec>..." will behave like
 today's "git add <pathspec>...", ignoring removed files.
 
 -N::
diff --git a/builtin/add.c b/builtin/add.c
index 54cd2d4..aefbc45 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -382,6 +382,13 @@ static int ignore_add_errors, intent_to_add, ignore_missing;
 static int addremove = ADDREMOVE_DEFAULT;
 static int addremove_explicit = -1; /* unspecified */
 
+static int ignore_removal_cb(const struct option *opt, const char *arg, int unset)
+{
+	/* if we are told to ignore, we are not adding removals */
+	*(int *)opt->value = !unset ? 0 : 1;
+	return 0;
+}
+
 static struct option builtin_add_options[] = {
 	OPT__DRY_RUN(&show_only, N_("dry run")),
 	OPT__VERBOSE(&verbose, N_("be verbose")),
@@ -393,6 +400,10 @@ static struct option builtin_add_options[] = {
 	OPT_BOOL('u', "update", &take_worktree_changes, N_("update tracked files")),
 	OPT_BOOL('N', "intent-to-add", &intent_to_add, N_("record only the fact that the path will be added later")),
 	OPT_BOOL('A', "all", &addremove_explicit, N_("add changes from all tracked and untracked files")),
+	{ OPTION_CALLBACK, 0, "ignore-removal", &addremove_explicit,
+	  NULL /* takes no arguments */,
+	  N_("ignore paths removed in the working tree (same as --no-all)"),
+	  PARSE_OPT_NOARG, ignore_removal_cb },
 	OPT_BOOL( 0 , "refresh", &refresh_only, N_("don't add, only refresh the index")),
 	OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")),
 	OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")),
-- 
1.8.2.1-683-g39c426e

  reply	other threads:[~2013-04-22 20:44 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 20:28 What's cooking in git.git (Apr 2013, #05; Mon, 15) Junio C Hamano
2013-04-15 22:24 ` Felipe Contreras
2013-04-15 23:14   ` Junio C Hamano
2013-04-15 23:30     ` Felipe Contreras
2013-04-16  4:12       ` Junio C Hamano
2013-04-16  5:32         ` Felipe Contreras
2013-04-16  9:59       ` Thomas Rast
2013-04-16 19:04         ` Felipe Contreras
2013-04-16 19:19           ` Junio C Hamano
2013-04-16 19:48             ` Felipe Contreras
2013-04-16 22:34               ` Phil Hord
2013-04-16 23:50                 ` Felipe Contreras
2013-04-16 22:45           ` Phil Hord
2013-04-17  4:44             ` Junio C Hamano
2013-04-17 18:50             ` Felipe Contreras
2013-04-17 23:56               ` Junio C Hamano
2013-04-18  3:59                 ` Felipe Contreras
2013-04-18  7:44                   ` Matthieu Moy
2013-04-18  9:15                     ` Felipe Contreras
2013-04-18  9:19               ` Ramkumar Ramachandra
2013-04-18  9:53                 ` Felipe Contreras
2013-04-18 10:27                   ` Ramkumar Ramachandra
2013-04-18 10:55                     ` Felipe Contreras
2013-04-18 11:31                       ` Ramkumar Ramachandra
2013-04-18 12:05                         ` Felipe Contreras
2013-04-18 11:46                       ` Ramkumar Ramachandra
2013-04-18 12:16                         ` Felipe Contreras
2013-04-23 18:49                           ` Ramkumar Ramachandra
2013-04-23 19:11                             ` Felipe Contreras
2013-04-18 20:06               ` Phil Hord
2013-04-18 23:48                 ` Felipe Contreras
2013-04-19 21:07                   ` Phil Hord
2013-04-20  1:29                     ` Felipe Contreras
2013-04-15 23:25 ` Jeff King
2013-04-15 23:49   ` Øyvind A. Holm
2013-04-16  0:53     ` Jeff King
2013-04-16  0:30   ` Jeff King
2013-04-16  1:08     ` Eric Sunshine
2013-04-16 17:18     ` Junio C Hamano
2013-04-16  3:21 ` Drew Northup
2013-04-16 23:52 ` "What's cooking" between #05 and #06 Junio C Hamano
2013-04-17  8:40   ` John Keeping
2013-04-17 15:30     ` Junio C Hamano
2013-04-17 21:25   ` Jens Lehmann
2013-04-18  8:49     ` John Keeping
2013-04-17  8:49 ` What's cooking in git.git (Apr 2013, #05; Mon, 15) Lukas Fleischer
2013-04-17 15:11   ` Junio C Hamano
2013-04-17  9:47 ` Thomas Rast
2013-04-17 15:24   ` Junio C Hamano
2013-04-17 15:56     ` Thomas Rast
2013-04-17 17:08       ` Junio C Hamano
2013-04-17 18:14         ` Junio C Hamano
2013-04-17 20:10           ` Jeff King
2013-04-18  1:39             ` Junio C Hamano
2013-04-18  1:47               ` [PATCH] git add <pathspec>... defaults to "-A" Junio C Hamano
2013-04-18 17:27               ` What's cooking in git.git (Apr 2013, #05; Mon, 15) Jeff King
2013-04-18 17:51                 ` Junio C Hamano
2013-04-18 18:00                   ` Jeff King
2013-04-18 18:16                     ` Junio C Hamano
2013-04-18 20:30                       ` Jeff King
2013-04-18 21:37                         ` Junio C Hamano
2013-04-18 21:44                           ` Jeff King
2013-04-18 22:10                             ` Junio C Hamano
2013-04-19  4:14                               ` Jeff King
2013-04-19  4:31                               ` Jonathan Nieder
2013-04-19 17:25                                 ` Junio C Hamano
2013-04-19 21:34                                   ` Jeff King
2013-04-19 21:56                                     ` Junio C Hamano
2013-04-21  7:39                                     ` jc/add-2.0-delete-default (Re: What's cooking in git.git (Apr 2013, #05; Mon, 15)) Jonathan Nieder
2013-04-22  1:51                                       ` Junio C Hamano
2013-04-22  4:54                                         ` Junio C Hamano
2013-04-22 20:43                                           ` [PATCH 0/2] "git add -A/--no-all" finishing touches Junio C Hamano
2013-04-22 20:43                                             ` Junio C Hamano [this message]
2013-04-22 20:43                                             ` [PATCH 2/2] git add: rephrase -A/--no-all warning Junio C Hamano
2013-04-22 22:41                                             ` [PATCH 3/2] git add <pathspec>... defaults to "-A" Junio C Hamano
2013-04-23  0:42                                               ` Eric Sunshine
2013-04-25 23:06                                             ` [PATCH 0/2] "git add -A/--no-all" finishing touches Junio C Hamano
2013-04-25 23:19                                               ` Junio C Hamano
2013-04-25 23:24                                                 ` Jonathan Nieder
2013-04-25 23:41                                                   ` Junio C Hamano
2013-04-25 23:44                                                     ` Junio C Hamano
2013-04-25 23:56                                                       ` Jonathan Nieder
2013-04-26  0:14                                                         ` Junio C Hamano
2013-04-26 20:44                                                           ` Junio C Hamano
2013-04-26 21:30                                                             ` Jonathan Nieder

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=1366663435-13598-2-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=trast@inf.ethz.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.