git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH] git: add --no-replace option to disable replacing
@ 2009-10-11 15:32 Christian Couder
  2009-10-12  6:32 ` Johannes Sixt
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2009-10-11 15:32 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jakub Narebski, Johannes Sixt, bill lam, Andreas Schwab

Commit dae556b (environment: add global variable to disable replacement)
adds a variable to enable/disable replacement, and it is enabled by
default for most commands.

So there is no way to disable it for some commands, which is annoying
when we want to get information about a commit that has been replaced.

For example:

$ git cat-file -p N

would output information about the replacement commit if commit N is
replaced.

With the "--no-replace" option that this patch adds it is possible to
get information about the original commit using:

$ git --no-replace cat-file -p N

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

	Jakub Narebski wrote:

	> Wouldn't it be better for this option to be option for git
	> wrapper, i.e.
	>
	>  $ git --no-replace cat-file -p N
	>
	> and not
	>
	>  $ git cat-file --no-replace -p N

	You mean something like this patch?

	This is untested yet. I will add some tests and documentation
	later if it's ok to add this option.


diff --git a/git.c b/git.c
index 9883009..cfef7ac 100644
--- a/git.c
+++ b/git.c
@@ -6,7 +6,7 @@
 
 const char git_usage_string[] =
 	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n"
-	"           [-p|--paginate|--no-pager]\n"
+	"           [-p|--paginate|--no-pager] [--no-replace]\n"
 	"           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n"
 	"           [--help] COMMAND [ARGS]";
 
@@ -87,6 +87,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			use_pager = 0;
 			if (envchanged)
 				*envchanged = 1;
+		} else if (!strcmp(cmd, "--no-replace")) {
+			read_replace_refs = 0;
 		} else if (!strcmp(cmd, "--git-dir")) {
 			if (*argc < 2) {
 				fprintf(stderr, "No directory given for --git-dir.\n" );
-- 
1.6.5.1.g31b53

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC/PATCH] git: add --no-replace option to disable replacing
  2009-10-11 15:32 [RFC/PATCH] git: add --no-replace option to disable replacing Christian Couder
@ 2009-10-12  6:32 ` Johannes Sixt
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Sixt @ 2009-10-12  6:32 UTC (permalink / raw)
  To: Christian Couder
  Cc: Junio C Hamano, git, Jakub Narebski, bill lam, Andreas Schwab

Christian Couder schrieb:
> So there is no way to disable it for some commands, which is annoying
> when we want to get information about a commit that has been replaced.
> 
> For example:
> 
> $ git cat-file -p N
> 
> would output information about the replacement commit if commit N is
> replaced.
> 
> With the "--no-replace" option that this patch adds it is possible to
> get information about the original commit using:
> 
> $ git --no-replace cat-file -p N

I think it makes sense. But given the exotic nature of this option, I'd
prefer a more specific name, e.g., --no-replace-objects.

-- Hannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-12  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-11 15:32 [RFC/PATCH] git: add --no-replace option to disable replacing Christian Couder
2009-10-12  6:32 ` Johannes Sixt

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).