Re: [PATCH 0/4] Flag to add a newline after decorations for --oneline log output

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

 



On Fri, Nov 12, 2021 at 05:27:45PM +0100, Christian Couder wrote:
> On Fri, Oct 29, 2021 at 11:17 PM John Cai via GitGitGadget
> <gitgitgadget@xxxxxxxxx> wrote:
> >
> > Add a flag --newlineafter to be able to pass in "decorations" to enable a
> > nicer format for the --oneline output so the commit subjects are aligned
> > when decorations are printed.
> 
> I wonder if --newlinebefore or --newlinefor rather than --newlineafter
> would be better. It seems to me that it would be easier for users to
> guess what the result will look like with --newlinefor.
> 
> Another possibly more generic solution would be something like
> --format-field=<field>:<format> where, in the output, the field
> <field> (which corresponds to the "%(<field>)" format) would be
> replaced by <format> which should contain "%(<field>)". For example
> `--format-field=decorations:'[[%(decorations)]]\n'` would enclose the
> decorations using [[...]] and would add a newline after them.
> 
> Also it would be nice if this could be extended to other fields and to
> formats other than "oneline". You might want to discuss a bit about
> how it could be done with generic code.
> 
> > 0b96396ef5ff7a3a01e137b3735893c970759dfa (HEAD -> jc/two-line-pretty-decoration, john-cai/jc/two-line-pretty-decoration)
> >                                          Improve UX for oneline with decorations
> > e9e5ba39a78c8f5057262d49e261b42a8660d5b9 (origin/master, origin/HEAD, master)
> >                                          The fifteenth batch
> > c6fc44e9bf85dc02f6d33b11d9b5d1e10711d125 Merge branch 'ab/test-lib-diff-cleanup'
> > 63ec2297d26155adb0e38745bf2284cd663add8e Merge branch 'ab/fix-make-lint-docs'
> 
> Not sure why the above lines are included in your cover letter.
> 
> > original thread in
> > https://lore.kernel.org/git/CA+55aFwT2HUBzZO8Gpt9tHoJtdRxv9oe3TDoSH5jcEOixRNBXg@xxxxxxxxxxxxxx/T/#t
> 
> It would be nice if you could summarize the threads a bit in this
> cover letter, and tell a bit about how your design evolved from what
> was discussed.
> 
> > John Cai (4):
> >   oneline: parse --newlineafter flag
> >   oneline: print newline after decorations if flag provided
> >   oneline: test for --newlineafter feature
> >   doc: add docs for newlineafter flag
> 
> The 2 last patches look very small and might want to be squashed into
> the patch that introduces the --newlineafter flag.
> 
> Thanks!

There was a discussion in https://lore.kernel.org/git/CA+55aFwT2HUBzZO8Gpt9tHoJtdRxv9oe3TDoSH5jcEOixRNBXg@xxxxxxxxxxxxxx/T/#t

about improving the --oneline output with decorations. To summarize, currently, when
decorations are printed with --oneline the subject message ends up misaligned like so:

```
7140c4988f t/lib-git.sh: fix ACL-related permissions failure
88d915a634 (jc-test-peff-revlist-patch) A few fixes before -rc2
9cc14a5b5d Sync with maint
5fbd2fc599 (origin/maint) Merge branch 'vd/pthread-setspecific-g11-fix' into maint
494cb27e57 Merge branch 'ma/doc-git-version' into maint
```

It would improve the user experience of this format if we could allow a newline after
the decorations so that the logs are formatted in the following manner:

```
7140c4988f t/lib-git.sh: fix ACL-related permissions failure
88d915a634 (jc-test-peff-revlist-patch)
           A few fixes before -rc2
9cc14a5b5d Sync with maint
5fbd2fc599 (origin/maint)
           Merge branch 'vd/pthread-setspecific-g11-fix' into maint
494cb27e57 Merge branch 'ma/doc-git-version' into maint
```

In order to accomplish this, we can add a new flag called --format-field=<format>.
<format> is similar to what is passed into --format.

For example, if --format-field=[[%d]]%n is used, the --oneline format will print
decorations enclosed with [[ ]] and a newline after it.

This would be convenient when one wants to modify just one field of the
log output.


cc: Christian Couder <christian.couder@xxxxxxxxx>



[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