{"thread":{"id":"777","subject":"[PATCH] Make git-update-cache --force-remove regular","startedAt":"2005-05-31T16:52:43Z","lastAt":"2005-06-05T23:58:04Z","messageCount":5,"participants":["Petr Baudis","Junio C Hamano","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4310","messageId":"20050531165243.GD7013@pasky.ji.cz","threadId":"777","inReplyTo":null,"subject":"[PATCH] Make git-update-cache --force-remove regular","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-31T16:52:43Z","receivedAt":"2005-05-31T16:52:43Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Make the --force-remove flag behave same as --add, --remove and\n--replace. This means I can do\n\n\tgit-update-cache --force-remove -- file1.c file2.c\n\nwhich is probably saner and also makes it easier to use in cg-rm.\n\nSigned-off-by: Petr Baudis <pasky@ucw.cz>\n\n---\ncommit 2cd99acef0c74c6218b51e058a3e045e1a8b7b66\ntree 4e25708b4fd3ca1589833245a8e48bf87cb7fbde\nparent 3e26fef188baa4626457fae25b0b63e1c788efcd\nauthor Petr Baudis <pasky@ucw.cz> Tue, 31 May 2005 18:51:56 +0200\ncommitter Petr Baudis <xpasky@machine.sinus.cz> Tue, 31 May 2005 18:51:56 +0200\n\n Documentation/git-update-cache.txt |    4 ++--\n update-cache.c                     |   12 +++++++-----\n 2 files changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-update-cache.txt b/Documentation/git-update-cache.txt\n--- a/Documentation/git-update-cache.txt\n+++ b/Documentation/git-update-cache.txt\n@@ -12,7 +12,7 @@ SYNOPSIS\n 'git-update-cache'\n \t     [--add] [--remove] [--refresh] [--replace]\n \t     [--ignore-missing]\n-\t     [--force-remove <file>]\n+\t     [--force-remove]\n \t     [--cacheinfo <mode> <object> <file>]\\*\n \t     [--] [<file>]\\*\n \n@@ -49,7 +49,7 @@ OPTIONS\n \t\n --force-remove::\n \tRemove the file from the index even when the working directory\n-\tstill has such a file.\n+\tstill has such a file. (Implies --remove.)\n \n --replace::\n \tBy default, when a file `path` exists in the index,\ndiff --git a/update-cache.c b/update-cache.c\n--- a/update-cache.c\n+++ b/update-cache.c\n@@ -13,6 +13,7 @@\n  * files be revision controlled.\n  */\n static int allow_add = 0, allow_remove = 0, allow_replace = 0, not_new = 0;\n+static int force_remove;\n \n /* Three functions to allow overloaded pointer return; see linux/err.h */\n static inline void *ERR_PTR(long error)\n@@ -376,11 +377,7 @@ int main(int argc, char **argv)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(path, \"--force-remove\")) {\n-\t\t\t\tif (argc <= i + 1)\n-\t\t\t\t\tdie(\"git-update-cache: --force-remove <path>\");\n-\t\t\t\tif (remove_file_from_cache(argv[i+1]))\n-\t\t\t\t\tdie(\"git-update-cache: --force-remove cannot remove %s\", argv[i+1]);\n-\t\t\t\ti++;\n+\t\t\t\tforce_remove = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n \n@@ -394,6 +391,11 @@ int main(int argc, char **argv)\n \t\t\tfprintf(stderr, \"Ignoring path %s\\n\", argv[i]);\n \t\t\tcontinue;\n \t\t}\n+\t\tif (force_remove) {\n+\t\t\tif (remove_file_from_cache(path))\n+\t\t\t\tdie(\"git-update-cache: --force-remove cannot remove %s\", path);\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (add_file_to_cache(path))\n \t\t\tdie(\"Unable to add %s to database\", path);\n \t}\n\n|\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4316","messageId":"7vpsv7xjf2.fsf@assigned-by-dhcp.cox.net","threadId":"777","inReplyTo":"20050531165243.GD7013@pasky.ji.cz","subject":"Re: [PATCH] Make git-update-cache --force-remove regular","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-31T19:52:17Z","receivedAt":"2005-05-31T19:52:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"PB\" == Petr Baudis <pasky@ucw.cz> writes:\n\nPB> Make the --force-remove flag behave same as --add, --remove and\nPB> --replace. This means I can do\n\nPB> \tgit-update-cache --force-remove -- file1.c file2.c\n\nPB> which is probably saner and also makes it easier to use in cg-rm.\n\nI am ambivalent about this.  Although I like the semantic\nclean-up your proposed change makes, at the same time: \n\n  $ git-update-cache --force-remove one --add two\n\nused to remove \"one\" and add \"two\", which has to be now written\nas two separate calls, which is a slight a performance hit of\nhaving to read the 1.6MB cache twice.  Maybe it does not matter,\nor the new usage's convenience outweighs it; I cannot tell\noffhand.\n\n"},{"id":"4318","messageId":"20050531204155.GH7013@pasky.ji.cz","threadId":"777","inReplyTo":"7vpsv7xjf2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Make git-update-cache --force-remove regular","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-31T20:41:55Z","receivedAt":"2005-05-31T20:41:55Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, May 31, 2005 at 09:52:17PM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> told me that...\n> >>>>> \"PB\" == Petr Baudis <pasky@ucw.cz> writes:\n> \n> PB> Make the --force-remove flag behave same as --add, --remove and\n> PB> --replace. This means I can do\n> \n> PB> \tgit-update-cache --force-remove -- file1.c file2.c\n> \n> PB> which is probably saner and also makes it easier to use in cg-rm.\n> \n> I am ambivalent about this.  Although I like the semantic\n> clean-up your proposed change makes, at the same time: \n> \n>   $ git-update-cache --force-remove one --add two\n> \n> used to remove \"one\" and add \"two\", which has to be now written\n> as two separate calls, which is a slight a performance hit of\n> having to read the 1.6MB cache twice.  Maybe it does not matter,\n> or the new usage's convenience outweighs it; I cannot tell\n> offhand.\n\nSort all the forced removals to the end. I think it's still better than\n\n  git-update-cache --force-remove one --force-remove two \\\n\t--force-remove three ...\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4618","messageId":"20050605232620.GU17462@pasky.ji.cz","threadId":"777","inReplyTo":"20050531165243.GD7013@pasky.ji.cz","subject":"Re: [PATCH] Make git-update-cache --force-remove regular","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-06-05T23:26:20Z","receivedAt":"2005-06-05T23:26:20Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, May 31, 2005 at 06:52:43PM CEST, I got a letter\nwhere Petr Baudis <pasky@ucw.cz> told me that...\n> Make the --force-remove flag behave same as --add, --remove and\n> --replace. This means I can do\n> \n> \tgit-update-cache --force-remove -- file1.c file2.c\n> \n> which is probably saner and also makes it easier to use in cg-rm.\n> \n> Signed-off-by: Petr Baudis <pasky@ucw.cz>\n\nCan this go in, please? Currently it's the only delta between your and\nmy git tree, so I'd like to get it merged so that Cogito works with\nstock git again.\n\nThanks,\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"4621","messageId":"Pine.LNX.4.58.0506051657540.1876@ppc970.osdl.org","threadId":"777","inReplyTo":"20050605232620.GU17462@pasky.ji.cz","subject":"Re: [PATCH] Make git-update-cache --force-remove regular","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-05T23:58:04Z","receivedAt":"2005-06-05T23:58:04Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 6 Jun 2005, Petr Baudis wrote:\n> \n> Can this go in, please? Currently it's the only delta between your and\n> my git tree, so I'd like to get it merged so that Cogito works with\n> stock git again.\n\nDone.\n\n\t\tLinus\n"}]}