Re: [PATCH] git show <tree>: show mode and hash, and handle -r

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> Now, git show <tree> shows some more information, and with the -r option,
> it recurses into subdirectories.
>
> Requested by Scott Chacon.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
>
> 	The only quirk is the command line parsing for -r: we cannot use 
> 	DIFF_OPT_TST(&rev.diffopt, RECURSIVE), because that is switched 
> 	on not only by cmd_log_init(), but implicitly by 
> 	diff_setup_done(), because FORMAT_PATCH is selected by git-show.

That's a rather large quirk with an ugly workaround if you ask me.

I also notice that there is:

    int cmd_log_reflog(int argc, const char **argv, const char *prefix)
    {
            struct rev_info rev;
            ...
            /*
             * This means that we override whatever commit format the user gave
             * on the cmd line.  Sad, but cmd_log_init() currently doesn't
             * allow us to set a different default.
             */

I wonder if it would help breaking down cmd_log_init() a bit like this.

 builtin-log.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git c/builtin-log.c w/builtin-log.c
index 2efe593..0fcc28a 100644
--- c/builtin-log.c
+++ w/builtin-log.c
@@ -50,18 +50,23 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
 	return 0;
 }
 
-static void cmd_log_init(int argc, const char **argv, const char *prefix,
-		      struct rev_info *rev)
+static void cmd_log_init_0(int argc, const char **argv, const char *prefix,
+			   struct rev_info *rev,
+			   int default_abbrev,
+			   int default_commit_format,
+			   int default_verbose_header,
+			   int default_recursive)
 {
 	int i;
 	int decorate = 0;
 
-	rev->abbrev = DEFAULT_ABBREV;
-	rev->commit_format = CMIT_FMT_DEFAULT;
+	rev->abbrev = default_abbrev;
+	rev->commit_format = default_commit_format;
 	if (fmt_pretty)
 		get_commit_format(fmt_pretty, rev);
-	rev->verbose_header = 1;
-	DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
+	rev->verbose_header = default_verbose_header;
+	if (default_recursive)
+		DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
 	rev->show_root_diff = default_show_root;
 	rev->subject_prefix = fmt_patch_subject_prefix;
 
@@ -88,6 +93,16 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 	}
 }
 
+static void cmd_log_init(int argc, const char **argv, const char *prefix,
+			 struct rev_info *rev)
+{
+	cmd_log_init_0(argc, argv, prefix, rev,
+		       DEFAULT_ABBREV,
+		       CMIT_FMT_DEFAULT,
+		       1,
+		       1);
+}
+
 /*
  * This gives a rough estimate for how many commits we
  * will print out in the list.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux