* [PATCH] Make git-update-cache --force-remove regular
@ 2005-05-31 16:52 Petr Baudis
2005-05-31 19:52 ` Junio C Hamano
2005-06-05 23:26 ` Petr Baudis
0 siblings, 2 replies; 5+ messages in thread
From: Petr Baudis @ 2005-05-31 16:52 UTC (permalink / raw)
To: torvalds; +Cc: git
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git-update-cache --force-remove regular
2005-05-31 16:52 [PATCH] Make git-update-cache --force-remove regular Petr Baudis
@ 2005-05-31 19:52 ` Junio C Hamano
2005-05-31 20:41 ` Petr Baudis
2005-06-05 23:26 ` Petr Baudis
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2005-05-31 19:52 UTC (permalink / raw)
To: Petr Baudis; +Cc: torvalds, git
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> Make the --force-remove flag behave same as --add, --remove and
PB> --replace. This means I can do
PB> git-update-cache --force-remove -- file1.c file2.c
PB> which is probably saner and also makes it easier to use in cg-rm.
I am ambivalent about this. Although I like the semantic
clean-up your proposed change makes, at the same time:
$ git-update-cache --force-remove one --add two
used to remove "one" and add "two", which has to be now written
as two separate calls, which is a slight a performance hit of
having to read the 1.6MB cache twice. Maybe it does not matter,
or the new usage's convenience outweighs it; I cannot tell
offhand.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git-update-cache --force-remove regular
2005-05-31 19:52 ` Junio C Hamano
@ 2005-05-31 20:41 ` Petr Baudis
0 siblings, 0 replies; 5+ messages in thread
From: Petr Baudis @ 2005-05-31 20:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: torvalds, git
Dear diary, on Tue, May 31, 2005 at 09:52:17PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> >>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>
> PB> Make the --force-remove flag behave same as --add, --remove and
> PB> --replace. This means I can do
>
> PB> git-update-cache --force-remove -- file1.c file2.c
>
> PB> which is probably saner and also makes it easier to use in cg-rm.
>
> I am ambivalent about this. Although I like the semantic
> clean-up your proposed change makes, at the same time:
>
> $ git-update-cache --force-remove one --add two
>
> used to remove "one" and add "two", which has to be now written
> as two separate calls, which is a slight a performance hit of
> having to read the 1.6MB cache twice. Maybe it does not matter,
> or the new usage's convenience outweighs it; I cannot tell
> offhand.
Sort all the forced removals to the end. I think it's still better than
git-update-cache --force-remove one --force-remove two \
--force-remove three ...
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git-update-cache --force-remove regular
2005-05-31 16:52 [PATCH] Make git-update-cache --force-remove regular Petr Baudis
2005-05-31 19:52 ` Junio C Hamano
@ 2005-06-05 23:26 ` Petr Baudis
2005-06-05 23:58 ` Linus Torvalds
1 sibling, 1 reply; 5+ messages in thread
From: Petr Baudis @ 2005-06-05 23:26 UTC (permalink / raw)
To: torvalds; +Cc: git
Dear diary, on Tue, May 31, 2005 at 06:52:43PM CEST, I got a letter
where Petr Baudis <pasky@ucw.cz> told me that...
> 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>
Can this go in, please? Currently it's the only delta between your and
my git tree, so I'd like to get it merged so that Cogito works with
stock git again.
Thanks,
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git-update-cache --force-remove regular
2005-06-05 23:26 ` Petr Baudis
@ 2005-06-05 23:58 ` Linus Torvalds
0 siblings, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2005-06-05 23:58 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
On Mon, 6 Jun 2005, Petr Baudis wrote:
>
> Can this go in, please? Currently it's the only delta between your and
> my git tree, so I'd like to get it merged so that Cogito works with
> stock git again.
Done.
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-06-05 23:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-31 16:52 [PATCH] Make git-update-cache --force-remove regular Petr Baudis
2005-05-31 19:52 ` Junio C Hamano
2005-05-31 20:41 ` Petr Baudis
2005-06-05 23:26 ` Petr Baudis
2005-06-05 23:58 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox