From: Petr Baudis <pasky@ucw.cz>
To: torvalds@osdl.org
Cc: git@vger.kernel.org
Subject: [PATCH] Make git-update-cache --force-remove regular
Date: Tue, 31 May 2005 18:52:43 +0200 [thread overview]
Message-ID: <20050531165243.GD7013@pasky.ji.cz> (raw)
Make the --force-remove flag behave same as --add, --remove and
--replace. This means I can do
git-update-cache --force-remove -- file1.c file2.c
which is probably saner and also makes it easier to use in cg-rm.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
---
commit 2cd99acef0c74c6218b51e058a3e045e1a8b7b66
tree 4e25708b4fd3ca1589833245a8e48bf87cb7fbde
parent 3e26fef188baa4626457fae25b0b63e1c788efcd
author Petr Baudis <pasky@ucw.cz> Tue, 31 May 2005 18:51:56 +0200
committer Petr Baudis <xpasky@machine.sinus.cz> Tue, 31 May 2005 18:51:56 +0200
Documentation/git-update-cache.txt | 4 ++--
update-cache.c | 12 +++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-update-cache.txt b/Documentation/git-update-cache.txt
--- a/Documentation/git-update-cache.txt
+++ b/Documentation/git-update-cache.txt
@@ -12,7 +12,7 @@ SYNOPSIS
'git-update-cache'
[--add] [--remove] [--refresh] [--replace]
[--ignore-missing]
- [--force-remove <file>]
+ [--force-remove]
[--cacheinfo <mode> <object> <file>]\*
[--] [<file>]\*
@@ -49,7 +49,7 @@ OPTIONS
--force-remove::
Remove the file from the index even when the working directory
- still has such a file.
+ still has such a file. (Implies --remove.)
--replace::
By default, when a file `path` exists in the index,
diff --git a/update-cache.c b/update-cache.c
--- a/update-cache.c
+++ b/update-cache.c
@@ -13,6 +13,7 @@
* files be revision controlled.
*/
static int allow_add = 0, allow_remove = 0, allow_replace = 0, not_new = 0;
+static int force_remove;
/* Three functions to allow overloaded pointer return; see linux/err.h */
static inline void *ERR_PTR(long error)
@@ -376,11 +377,7 @@ int main(int argc, char **argv)
continue;
}
if (!strcmp(path, "--force-remove")) {
- if (argc <= i + 1)
- die("git-update-cache: --force-remove <path>");
- if (remove_file_from_cache(argv[i+1]))
- die("git-update-cache: --force-remove cannot remove %s", argv[i+1]);
- i++;
+ force_remove = 1;
continue;
}
@@ -394,6 +391,11 @@ int main(int argc, char **argv)
fprintf(stderr, "Ignoring path %s\n", argv[i]);
continue;
}
+ if (force_remove) {
+ if (remove_file_from_cache(path))
+ die("git-update-cache: --force-remove cannot remove %s", path);
+ continue;
+ }
if (add_file_to_cache(path))
die("Unable to add %s to database", path);
}
|
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
next reply other threads:[~2005-05-31 16:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-31 16:52 Petr Baudis [this message]
2005-05-31 19:52 ` [PATCH] Make git-update-cache --force-remove regular Junio C Hamano
2005-05-31 20:41 ` Petr Baudis
2005-06-05 23:26 ` Petr Baudis
2005-06-05 23:58 ` Linus Torvalds
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=20050531165243.GD7013@pasky.ji.cz \
--to=pasky@ucw.cz \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.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