From: "Luke-Jr" <luke-jr@utopios.org>
To: git@vger.kernel.org
Subject: For review: git add --ignore-unmatch
Date: Wed, 12 Aug 2009 17:26:51 -0500 [thread overview]
Message-ID: <200908121726.52121.luke-jr@utopios.org> (raw)
[-- Attachment #1: Type: Text/Plain, Size: 1 bytes --]
[-- Attachment #2: 0001-port-ignore-unmatch-from-git-rm-to-git-add.patch --]
[-- Type: text/x-patch, Size: 2009 bytes --]
From 54768360aa7b1882dd2b76211661abb6014cbf23 Mon Sep 17 00:00:00 2001
From: Luke Dashjr <luke-jr+git@utopios.org>
Date: Wed, 12 Aug 2009 16:26:31 -0500
Subject: [PATCH 1/3] port --ignore-unmatch from "git rm" to "git add"
---
builtin-add.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 581a2a1..0597fb9 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -19,6 +19,7 @@ static const char * const builtin_add_usage[] = {
};
static int patch_interactive, add_interactive, edit_interactive;
static int take_worktree_changes;
+static int ignore_unmatch = 0;
static void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
{
@@ -63,7 +64,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
fill_pathspec_matches(pathspec, seen, specs);
for (i = 0; i < specs; i++) {
- if (!seen[i] && pathspec[i][0] && !file_exists(pathspec[i]))
+ if (!seen[i] && pathspec[i][0] && !file_exists(pathspec[i]) && !ignore_unmatch)
die("pathspec '%s' did not match any files",
pathspec[i]);
}
@@ -108,7 +109,7 @@ static void refresh(int verbose, const char **pathspec)
refresh_index(&the_index, verbose ? REFRESH_SAY_CHANGED : REFRESH_QUIET,
pathspec, seen);
for (i = 0; i < specs; i++) {
- if (!seen[i])
+ if (!seen[i] && !ignore_unmatch)
die("pathspec '%s' did not match any files", pathspec[i]);
}
free(seen);
@@ -226,6 +227,8 @@ static struct option builtin_add_options[] = {
OPT_BOOLEAN('A', "all", &addremove, "add all, noticing removal of tracked files"),
OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"),
OPT_BOOLEAN( 0 , "ignore-errors", &ignore_add_errors, "just skip files which cannot be added because of errors"),
+ OPT_BOOLEAN( 0 , "ignore-unmatch", &ignore_unmatch,
+ "exit with a zero status even if nothing matched"),
OPT_END(),
};
--
1.6.3.3
[-- Attachment #3: 0002-fix-git-add-ignore-errors-to-ignore-pathspec-errors.patch --]
[-- Type: text/x-patch, Size: 761 bytes --]
From c6cd06db8ab3b198eafffd5b0e94d2f338f10072 Mon Sep 17 00:00:00 2001
From: Luke Dashjr <luke-jr+git@utopios.org>
Date: Wed, 12 Aug 2009 16:31:37 -0500
Subject: [PATCH 2/3] fix "git add --ignore-errors" to ignore pathspec errors
---
builtin-add.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 0597fb9..e3132c8 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -280,6 +280,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
add_interactive = 1;
if (add_interactive)
exit(interactive_add(argc - 1, argv + 1, prefix));
+ if (ignore_add_errors)
+ ignore_unmatch = 1;
if (edit_interactive)
return(edit_patch(argc, argv, prefix));
--
1.6.3.3
[-- Attachment #4: 0003-Document-ignore-unmatch-in-git-add.txt.patch --]
[-- Type: text/x-patch, Size: 1217 bytes --]
From 410a93cb61669304a0b1d10b8013d1635432e8a0 Mon Sep 17 00:00:00 2001
From: Luke Dashjr <luke-jr+git@utopios.org>
Date: Wed, 12 Aug 2009 17:23:44 -0500
Subject: [PATCH 3/3] Document --ignore-unmatch in git-add.txt
---
Documentation/git-add.txt | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index ab1943c..6b93b4e 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -10,7 +10,8 @@ SYNOPSIS
[verse]
'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
[--edit | -e] [--all | [--update | -u]] [--intent-to-add | -N]
- [--refresh] [--ignore-errors] [--] <filepattern>...
+ [--refresh] [--ignore-errors] [--ignore-unmatch] [--]
+ <filepattern>...
DESCRIPTION
-----------
@@ -119,6 +120,9 @@ apply.
them, do not abort the operation, but continue adding the
others. The command shall still exit with non-zero status.
+--ignore-unmatch::
+ Exit with a zero status even if no files matched.
+
\--::
This option can be used to separate command-line options from
the list of files, (useful when filenames might be mistaken
--
1.6.3.3
next reply other threads:[~2009-08-12 22:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-12 22:26 Luke-Jr [this message]
2009-08-12 22:57 ` For review: git add --ignore-unmatch Thomas Rast
2009-08-13 3:20 ` [PATCH 1/5] port --ignore-unmatch to "git add" Luke Dashjr
2009-08-13 3:20 ` [PATCH 2/5] fix "git add --ignore-errors" to ignore pathspec errors Luke Dashjr
2009-08-13 3:20 ` [PATCH 3/5] Document --ignore-unmatch in git-add.txt Luke Dashjr
2009-08-13 3:20 ` [PATCH 4/5] implement error_errno and warning_errno Luke Dashjr
2009-08-13 3:20 ` [PATCH 5/5] Convert add_file_to_index's lstat failure from a die to an error Luke Dashjr
2009-08-13 19:38 ` [PATCH 2/5] fix "git add --ignore-errors" to ignore pathspec errors Junio C Hamano
2009-08-13 20:42 ` Luke-Jr
2009-08-13 21:02 ` [PATCH] port --ignore-unmatch to "git add" Luke Dashjr
2009-08-13 21:03 ` [PATCH] Document --ignore-unmatch in git-add.txt Luke Dashjr
2009-08-13 19:36 ` [PATCH 1/5] port --ignore-unmatch to "git add" Junio C Hamano
2009-08-13 20:40 ` Luke-Jr
2009-08-13 21:51 ` Alex Riesen
2009-08-13 21:06 ` Thomas Rast
2009-08-14 19:52 ` Junio C Hamano
2009-08-14 20:39 ` Luke-Jr
2009-08-14 20:47 ` Luke-Jr
2009-08-14 21:39 ` Nanako Shiraishi
2009-08-14 22:54 ` Luke-Jr
2009-10-10 17:23 ` Luke-Jr
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=200908121726.52121.luke-jr@utopios.org \
--to=luke-jr@utopios.org \
--cc=git@vger.kernel.org \
/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).