git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Stefan Beller <stefanbeller@gmail.com>, Jeff King <peff@peff.net>,
	Johannes Sixt <j6t@kdbg.org>,
	Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH v7 6/7] submodule: refactor show_submodule_summary with helper function
Date: Thu, 18 Aug 2016 00:00:23 -0700	[thread overview]
Message-ID: <20160818070023.GA30666@gmail.com> (raw)
In-Reply-To: <20160818005131.31600-7-jacob.e.keller@intel.com>

On Wed, Aug 17, 2016 at 05:51:30PM -0700, Jacob Keller wrote:
> [snip]
> @@ -333,31 +326,23 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,
>  	strbuf_release(&sb);
>  }
>  
> -void show_submodule_summary(FILE *f, const char *path,
> +/* Helper function to display the submodule header line prior to the full
> + * summary output. If it can locate the submodule objects directory it will
> + * attempt to lookup both the left and right commits and put them into the
> + * left and right pointers.
> + */
> +static void show_submodule_header(FILE *f, const char *path,
>  		const char *line_prefix,
>  		unsigned char one[20], unsigned char two[20],
>  		unsigned dirty_submodule, const char *meta,
> -		const char *del, const char *add, const char *reset)
> +		const char *reset,
> +		struct commit **left, struct commit **right)


Note the pre-existing unsigned char[20]s in the signature above...


> [snip]
> @@ -381,14 +401,39 @@ void show_submodule_summary(FILE *f, const char *path,
>  		strbuf_addf(&sb, "%s:%s\n", fast_backward ? " (rewind)" : "", reset);
>  	fwrite(sb.buf, sb.len, 1, f);
>  
> -	if (!message) /* only NULL if we succeeded in setting up the walk */
> -		print_submodule_summary(&rev, f, line_prefix, del, add, reset);
> +	strbuf_release(&sb);
> +}
> +
> +void show_submodule_summary(FILE *f, const char *path,
> +		const char *line_prefix,
> +		unsigned char one[20], unsigned char two[20],
> +		unsigned dirty_submodule, const char *meta,
> +		const char *del, const char *add, const char *reset)


... and here too.

There's an ongoing effort to replace unsigned char sha1[20]
with struct object_id.  It might make sense to pass "one" and
"two" as "unsigned char*" instead of hard-coding the SHA1-length
here.  Alternatively, we could pass in the struct object_id*
instead.

The [20] in the show_submodule_header() function above is
pre-existing and not added by this patch, but that function's
signature is touched by this patch so it might make sense to
tidy that up while we're in here, possibly as a separate patch.
-- 
David

  reply	other threads:[~2016-08-18  7:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-18  0:51 [PATCH v7 0/7] implement inline submodule diff format Jacob Keller
2016-08-18  0:51 ` [PATCH v7 1/7] diff.c: remove output_prefix_length field Jacob Keller
2016-08-18  0:51 ` [PATCH v7 2/7] graph: add support for --line-prefix on all graph-aware output Jacob Keller
2016-08-18 17:56   ` Stefan Beller
2016-08-18 18:26     ` Jacob Keller
2016-08-18 18:29     ` Jacob Keller
2016-08-18  0:51 ` [PATCH v7 3/7] diff: prepare for additional submodule formats Jacob Keller
2016-08-18 18:03   ` Stefan Beller
2016-08-18  0:51 ` [PATCH v7 4/7] submodule: allow do_submodule_path to work if given gitdir directly Jacob Keller
2016-08-18 18:06   ` Stefan Beller
2016-08-18 18:46   ` Junio C Hamano
2016-08-18 18:50     ` Jacob Keller
2016-08-18  0:51 ` [PATCH v7 5/7] submodule: correct output of submodule log format Jacob Keller
2016-08-18 18:25   ` Stefan Beller
2016-08-18 18:34     ` Jacob Keller
2016-08-18  0:51 ` [PATCH v7 6/7] submodule: refactor show_submodule_summary with helper function Jacob Keller
2016-08-18  7:00   ` David Aguilar [this message]
2016-08-18  7:37     ` Jacob Keller
2016-08-18 19:04   ` Stefan Beller
2016-08-18 20:24     ` Jacob Keller
2016-08-18 20:39       ` Stefan Beller
2016-08-18 20:44         ` Jacob Keller
2016-08-18 20:49           ` Junio C Hamano
2016-08-18 21:08             ` Jacob Keller
2016-08-18  0:51 ` [PATCH v7 7/7] diff: teach diff to display submodule difference with an inline diff Jacob Keller
2016-08-18 19:47   ` Stefan Beller
2016-08-18 20:13     ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160818070023.GA30666@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.com \
    --cc=peff@peff.net \
    --cc=stefanbeller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).