Hi Christian,
On Mon, Nov 30, 2026 at 11:19 AM Christian Couder
<chri…@gmail.com> wrote:
>
> Sorry, this patch might have fallen into the cracks.
No worries, thanks for coming back to it.
> So `rev->repo` seems to already be used in one of these functions.
>
> It would be more consistent to use either `rev->repo` or `opt->repo`
> everywhere in these functions rather than mixing both.
Agreed. opt->repo is already what the rest of combine-diff.c uses:
show_combined_header() and the other grab_blob() calls in
show_patch_diff() all go through opt->repo, and rev->repo appears only
in the repo_has_symlinks() call just below my change. I'll convert that
call to opt->repo as well in v2 so show_patch_diff() uses opt->repo
throughout, instead of leaving the two mixed.
Thanks,
Okhuomon
On Mon, Nov 30, 2026 at 11:19 AM Christian Couder
<chri…@gmail.com> wrote:
>
> Hi Okhuomon,
>
>
>
> On Mon, Oct 26, 2026 at 12:13 PM Okhuomon Ajayi
> <okhu…@gmail.com> wrote:
> >
> > show_combined_header() and show_patch_diff() already have the
> > repository through opt->repo, but still used the_repository for
> > the hash algorithm, abbreviating object names and resolving
> > gitlinks. Use opt->repo instead.
> >
> > The file still needs USE_THE_REPOSITORY_VARIABLE for
> > DEFAULT_ABBREV, which refers to the global default_abbrev.
>
> Sorry, this patch might have fallen into the cracks.
>
> > @@ -1068,7 +1069,8 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
> > &result_size, NULL, NULL);
> > } else if (textconv) {
> > struct diff_filespec *df = alloc_filespec(elem->path);
> > - fill_filespec(df, null_oid(the_hash_algo), 0, st.st_mode);
> > + fill_filespec(df, null_oid(opt->repo->hash_algo),
> > + 0, st.st_mode);
> > result_size = fill_textconv(opt->repo, textconv, df, &result);
> > free_filespec(df);
> > } else if (0 <= (fd = open(elem->path, O_RDONLY))) {
>
> Below this there is:
>
> } else if (0 <= (fd = open(elem->path, O_RDONLY))) {
> size_t len = xsize_t(st.st_size);
> ssize_t done;
> int is_file, i;
>
> elem->mode = canon_mode(st.st_mode);
> /* if symlinks don't work, assume symlink if all parents
> * are symlinks
> */
> is_file = repo_has_symlinks(rev->repo);
>
> So `rev->repo` seems to already be used in one of these functions.
>
> It would be more consistent to use either `rev->repo` or `opt->repo`
> everywhere in these functions rather than mixing both.
>
> If there is a reason (like consistency with other functions in this
> file) to use one over the other, the commit message might want to
> explain it.
>
> Thanks.