Re: [PATCH v8 8/8] diff: teach diff to display submodule difference with an inline diff

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

 



On Fri, Aug 19, 2016 at 2:52 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Jacob Keller <jacob.e.keller@xxxxxxxxx> 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
--
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]