# Git log --decorate show prefetch objects

3 messages from 2024-04-04 to 2024-04-04. Participants: Alexandre Badez, Junio C Hamano.
Thread: https://gitlist.dev/t/61265

## Alexandre Badez, 2024-04-04 10:16

Subject: Git log --decorate show prefetch objects
Message-ID: <5a16d4e3-6fa4-45f3-ae79-576f3fa80d44@badez.eu>
URL: https://gitlist.dev/e/5a16d4e3-6fa4-45f3-ae79-576f3fa80d44%40badez.eu

```
# 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, 2024-04-04 16:56

Subject: Re: Git log --decorate show prefetch objects
Message-ID: <xmqqh6gh12yp.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqh6gh12yp.fsf%40gitster.g
In-Reply-To: <5a16d4e3-6fa4-45f3-ae79-576f3fa80d44@badez.eu>

```
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.

```

## Alexandre Badez, 2024-04-04 21:37

Subject: Re: Git log --decorate show prefetch objects
Message-ID: <a8c030bb-b7ff-4628-a104-65e64a1feb93@badez.eu>
URL: https://gitlist.dev/e/a8c030bb-b7ff-4628-a104-65e64a1feb93%40badez.eu
In-Reply-To: <xmqqh6gh12yp.fsf@gitster.g>

```
On 04/04/2024 18:56, Junio C Hamano wrote:

> 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.



```
