threads / discuss / 61265

Git log --decorate show prefetch objects

Subject: Git log --decorate show prefetch objects

## tl;dr

3 messages between Apr 4, 2024 and Apr 4, 2024.

replies: 2people: 2as markdown or json

Alexandre Badez· Apr 4, 2024, 10:16 UTC · lore
# What did you do before the bug happened? (Steps to reproduce your issue)

<on a git repository not fetch from a "long" time so you have missing branches and/or objects>

git maintenance run --task=prefetch
git log --oneline --decorate --all --graph
NOTE: here:
     - xxxxxxx commits are local commits,
     - yyyyyyy commits are remote commits fetch previously,
     - zzzzzzz commits are remote commits prefetch.
     * xxxxxxx (HEAD -> current-dev, origin/master, origin/HEAD) feat
     * xxxxxxx feat
     | * yyyyyyy (origin/feature) feat
     |/
     * xxxxxxx feat
     | * yyyyyyy (origin/a-fix) fix
     |/
     * xxxxxxx fix
     | * zzzzzzz feat
     | * zzzzzzz feat
     | * zzzzzzz feat
     |/
     * xxxxxxx feat
     | * zzzzzzz feat
     |/
     * xxxxxxx fix

According to the git-log  documentation (cf: https://git-scm.com/docs/git-log#Documentation/git-log.txt---all ):

     --all Pretend as if all the refs in refs/, along with HEAD, are 
listed on the command line as <commit>.

But the --decorate (cf: https://git-scm.com/docs/git-log#Documentation/git-log.txt---decorateshortfullautono ):

     --decorate
     Print out the ref names of any commits that are shown. If short is 
specified,
     the ref name prefixes refs/heads/, refs/tags/ and refs/remotes/ 
will not be printed.
     [...]
     The option --decorate is short-hand for --decorate=short.

Documentation of maintenant prefetch (cf: https://git-scm.com/docs/git-maintenance#Documentation/git-maintenance.txt-prefetch ):

     The prefetch task updates the object directory with the latest 
objects from all registered remotes.
     For each remote, a git fetch command is run.
     The configured refspec is modified to place all requested refs 
within refs/prefetch/.
     Also, tags are not updated.
# What did you expect to happen? (Expected behavior)
I would have prefer this output (prefetch not shown):
     * xxxxxxx (HEAD -> current-dev, origin/master, origin/HEAD) feat
     * xxxxxxx feat
     | * yyyyyyy (origin/feature) feat
     |/
     * xxxxxxx feat
     | * yyyyyyy (origin/a-fix) fix
     |/
     * xxxxxxx fix
     * xxxxxxx feat
     * xxxxxxx fix
Or this output (prefetch properly decorated):
     * xxxxxxx (HEAD -> current-dev, origin/master, origin/HEAD) feat
     * xxxxxxx feat
     | * yyyyyyy (origin/feature) feat
     |/
     * xxxxxxx feat
     | * yyyyyyy (origin/a-fix) fix
     |/
     * xxxxxxx fix
     | * zzzzzzz (refs/prefetch/remotes/origin/anotherfeat) feat
     | * zzzzzzz feat
     | * zzzzzzz feat
     |/
     * xxxxxxx feat
     | * zzzzzzz (refs/prefetch/remotes/origin/anotherotherfeat) feat
     |/
     * xxxxxxx fix
# What happened instead? (Actual behavior)
Prefetch object are return and not properly decorated.
# What's different between what you expected and what actually happened?
I would have preferd prefetched objects not displayed
# Information

[System Info] git version: git version 2.44.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/bash bash version: 5.2.26 uname: Linux 6.8.1 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 15 18:19:29 UTC 2024 x86_64 compiler info: gnuc: 13.2 libc info: glibc: 2.39 $SHELL (typically, interactive shell): /bin/fish

Junio C Hamano· Apr 4, 2024, 16:56 UTC · re: Alexandre Badez · lore

Re: Git log --decorate show prefetch objects

Alexandre Badez <alexandre@badez.eu> writes:
Show 8 quoted lines
> # What did you do before the bug happened? (Steps to reproduce your issue)
>
> <on a git repository not fetch from a "long" time so you have missing
> branches and/or objects>
>
> git maintenance run --task=prefetch
>
> git log --oneline --decorate --all --graph

I do not use the prefetch stuff, but unfortunately the person who was most familiar with "maintenance" are no longer active on this list, so let me take a crack.

I think your complaint is that "--all" really means "all", not just "heads" and "tags" but also includes "prefetch", while the prefetch hierarchy is not included in the "--decorate" sources.

What does
    $ git log --oneline --branches --tags --decorate --graph

show, and is it closer to what you expected (note: this is not a direct suggestion of a workaround---trying to gauge what the direction is to move forward)?

Thanks.
Alexandre Badez· Apr 4, 2024, 21:37 UTC · re: Junio C Hamano · lore

Re: Git log --decorate show prefetch objects

On 04/04/2024 18:56, Junio C Hamano wrote:
Show 27 quoted lines
> Alexandre Badez <alexandre@badez.eu> writes:
>
>> # What did you do before the bug happened? (Steps to reproduce your issue)
>>
>> <on a git repository not fetch from a "long" time so you have missing
>> branches and/or objects>
>>
>> git maintenance run --task=prefetch
>>
>> git log --oneline --decorate --all --graph
> I do not use the prefetch stuff, but unfortunately the person who
> was most familiar with "maintenance" are no longer active on this
> list, so let me take a crack.
>
> I think your complaint is that "--all" really means "all", not just
> "heads" and "tags" but also includes "prefetch", while the prefetch
> hierarchy is not included in the "--decorate" sources.
>
> What does
>
>      $ git log --oneline --branches --tags --decorate --graph
>
> show, and is it closer to what you expected (note: this is not a
> direct suggestion of a workaround---trying to gauge what the
> direction is to move forward)?
>
> Thanks.

Indeed, I missed the --branches (and --remotes) options; they do a better job in my case.

Maybe --all have a "legacy behaviour" so it's on me to move to new and better options.

Thanks.

← back to recent threads