From: Jacob Keller <jacob.keller@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
Git mailing list <git@vger.kernel.org>,
Stefan Beller <stefanbeller@gmail.com>, Jeff King <peff@peff.net>,
Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCH v8 8/8] diff: teach diff to display submodule difference with an inline diff
Date: Fri, 19 Aug 2016 15:03:05 -0700 [thread overview]
Message-ID: <CA+P7+xrdcDOak2Cw8FNq0_LGeAQZG8aJy6NnAvD0Umzr6NxVkA@mail.gmail.com> (raw)
In-Reply-To: <xmqqmvk8zasi.fsf@gitster.mtv.corp.google.com>
On Fri, Aug 19, 2016 at 2:52 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Jacob Keller <jacob.e.keller@intel.com> writes:
>
>> diff --git a/diff.h b/diff.h
>> index ea5aba668eaa..192c0eedd0ff 100644
>> --- a/diff.h
>> +++ b/diff.h
>> @@ -112,6 +112,7 @@ enum diff_words_type {
>> enum diff_submodule_format {
>> DIFF_SUBMODULE_SHORT = 0,
>> DIFF_SUBMODULE_LOG,
>> + DIFF_SUBMODULE_INLINE_DIFF,
>
> Same trailing comma.
>
>> };
>>
>> struct diff_options {
>> diff --git a/submodule.c b/submodule.c
>> index 7108b4786bc1..cecd3cd98de4 100644
>> --- a/submodule.c
>> +++ b/submodule.c
>> @@ -435,6 +435,68 @@ void show_submodule_summary(FILE *f, const char *path,
>> clear_commit_marks(right, ~0);
>> }
>>
>> +void show_submodule_inline_diff(FILE *f, const char *path,
>> + const char *line_prefix,
>> + struct object_id *one, struct object_id *two,
>> + unsigned dirty_submodule, const char *meta,
>> + const char *del, const char *add, const char *reset,
>> + const struct diff_options *o)
>> +{
>> + const struct object_id *old = &empty_tree_oid, *new = &empty_tree_oid;
>> + struct commit *left = NULL, *right = NULL;
>> + struct strbuf submodule_dir = STRBUF_INIT;
>> + struct child_process cp = CHILD_PROCESS_INIT;
>> +
>> + show_submodule_header(f, path, line_prefix, one, two, dirty_submodule,
>> + meta, reset, &left, &right);
>> +
>> + /* We need a valid left and right commit to display a difference */
>> + if (!(left || is_null_oid(one)) ||
>> + !(right || is_null_oid(two)))
>> + goto done;
>> +
>> + if (left)
>> + old = one;
>> + if (right)
>> + new = two;
>> +
>> + fflush(f);
>> + cp.git_cmd = 1;
>> + cp.dir = path;
>> + cp.out = dup(fileno(f));
>> + cp.no_stdin = 1;
>> +
>> + /* TODO: other options may need to be passed here. */
>> + argv_array_pushl(&cp.args, "diff");
>
> I think you meant argv_array_push() here. Or ", NULL" at the end if
> you anticipate you would grow more args after "diff" later and keep
> using pushl().
I had added an argument at one point and accidentally forgot to
convert back to push(). Oops!
Regards,
Jake
prev parent reply other threads:[~2016-08-19 22:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 0:00 [PATCH v8 0/8] submodule show inline diff Jacob Keller
2016-08-19 0:00 ` [PATCH v8 1/8] diff.c: remove output_prefix_length field Jacob Keller
2016-08-19 0:00 ` [PATCH v8 2/8] graph: add support for --line-prefix on all graph-aware output Jacob Keller
2016-08-19 0:00 ` [PATCH v8 3/8] diff: prepare for additional submodule formats Jacob Keller
2016-08-19 19:49 ` Junio C Hamano
2016-08-19 0:00 ` [PATCH v8 4/8] submodule: allow add_submodule_odb to work even if path is not checked out Jacob Keller
2016-08-19 20:06 ` Junio C Hamano
2016-08-19 20:32 ` Jacob Keller
2016-08-19 21:11 ` Junio C Hamano
2016-08-19 22:00 ` Jacob Keller
2016-08-19 22:26 ` Junio C Hamano
2016-08-19 23:25 ` Jacob Keller
2016-08-19 0:00 ` [PATCH v8 5/8] submodule: convert show_submodule_summary to use struct object_id * Jacob Keller
2016-08-19 20:12 ` Junio C Hamano
2016-08-19 0:00 ` [PATCH v8 6/8] submodule: refactor show_submodule_summary with helper function Jacob Keller
2016-08-19 20:24 ` Junio C Hamano
2016-08-19 20:33 ` Jacob Keller
2016-08-19 0:00 ` [PATCH v8 7/8] cache: add empty_tree_oid object Jacob Keller
2016-08-19 20:31 ` Junio C Hamano
2016-08-19 20:35 ` Jacob Keller
2016-08-19 20:50 ` Junio C Hamano
2016-08-19 21:14 ` Junio C Hamano
2016-08-19 22:02 ` Jacob Keller
2016-08-19 20:58 ` Jeff King
2016-08-23 16:28 ` Junio C Hamano
2016-08-19 0:00 ` [PATCH v8 8/8] diff: teach diff to display submodule difference with an inline diff Jacob Keller
2016-08-19 21:52 ` Junio C Hamano
2016-08-19 22:03 ` Jacob Keller [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+P7+xrdcDOak2Cw8FNq0_LGeAQZG8aJy6NnAvD0Umzr6NxVkA@mail.gmail.com \
--to=jacob.keller@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jacob.e.keller@intel.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).