{"thread":{"id":"21195","subject":"[RFC/PATCH] git: add --no-replace option to disable replacing","startedAt":"2009-10-11T15:32:26Z","lastAt":"2009-10-12T06:32:10Z","messageCount":2,"participants":["Christian Couder","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"124627","messageId":"20091011153227.8487.81803.chriscool@tuxfamily.org","threadId":"21195","inReplyTo":null,"subject":"[RFC/PATCH] git: add --no-replace option to disable replacing","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-10-11T15:32:26Z","receivedAt":"2009-10-11T15:32:26Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Commit dae556b (environment: add global variable to disable replacement)\nadds a variable to enable/disable replacement, and it is enabled by\ndefault for most commands.\n\nSo there is no way to disable it for some commands, which is annoying\nwhen we want to get information about a commit that has been replaced.\n\nFor example:\n\n$ git cat-file -p N\n\nwould output information about the replacement commit if commit N is\nreplaced.\n\nWith the \"--no-replace\" option that this patch adds it is possible to\nget information about the original commit using:\n\n$ git --no-replace cat-file -p N\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\n\tJakub Narebski wrote:\n\n\t> Wouldn't it be better for this option to be option for git\n\t> wrapper, i.e.\n\t>\n\t>  $ git --no-replace cat-file -p N\n\t>\n\t> and not\n\t>\n\t>  $ git cat-file --no-replace -p N\n\n\tYou mean something like this patch?\n\n\tThis is untested yet. I will add some tests and documentation\n\tlater if it's ok to add this option.\n\n\ndiff --git a/git.c b/git.c\nindex 9883009..cfef7ac 100644\n--- a/git.c\n+++ b/git.c\n@@ -6,7 +6,7 @@\n \n const char git_usage_string[] =\n \t\"git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\\n\"\n-\t\"           [-p|--paginate|--no-pager]\\n\"\n+\t\"           [-p|--paginate|--no-pager] [--no-replace]\\n\"\n \t\"           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\\n\"\n \t\"           [--help] COMMAND [ARGS]\";\n \n@@ -87,6 +87,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tuse_pager = 0;\n \t\t\tif (envchanged)\n \t\t\t\t*envchanged = 1;\n+\t\t} else if (!strcmp(cmd, \"--no-replace\")) {\n+\t\t\tread_replace_refs = 0;\n \t\t} else if (!strcmp(cmd, \"--git-dir\")) {\n \t\t\tif (*argc < 2) {\n \t\t\t\tfprintf(stderr, \"No directory given for --git-dir.\\n\" );\n-- \n1.6.5.1.g31b53\n"},{"id":"124674","messageId":"4AD2CD6A.2020509@viscovery.net","threadId":"21195","inReplyTo":"20091011153227.8487.81803.chriscool@tuxfamily.org","subject":"Re: [RFC/PATCH] git: add --no-replace option to disable replacing","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-10-12T06:32:10Z","receivedAt":"2009-10-12T06:32:10Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Christian Couder schrieb:\n> So there is no way to disable it for some commands, which is annoying\n> when we want to get information about a commit that has been replaced.\n> \n> For example:\n> \n> $ git cat-file -p N\n> \n> would output information about the replacement commit if commit N is\n> replaced.\n> \n> With the \"--no-replace\" option that this patch adds it is possible to\n> get information about the original commit using:\n> \n> $ git --no-replace cat-file -p N\n\nI think it makes sense. But given the exotic nature of this option, I'd\nprefer a more specific name, e.g., --no-replace-objects.\n\n-- Hannes\n"}]}