ugit icon indicating copy to clipboard operation
ugit copied to clipboard

git reflog would benefit from including the branch names on entries

Open corbob opened this issue 2 years ago • 2 comments

Take the current output of git reflog:

image

Notice that some of the reflog entries show branches that they are on. This would be beneficial to pass through in ugit, both as a property on the reflog entries, as well as formatted to show similar to native git.

image

Note: The coloring shown here is some done by WindTerm, and some by git itself. I think the colors are helpful, but not needed as part of an initial implementation.

corbob avatar May 04 '23 23:05 corbob

@corbob this one will be a good bit trickier than the others (surprisingly)

git reflog maps down to

git log -g --abbrev-commit --pretty=oneline

Which comes back with branch information when pretty-printed, but not when assigned to a string.

This will take some more digging.

StartAutomating avatar May 06 '23 23:05 StartAutomating

Which comes back with branch information when pretty-printed, but not when assigned to a string.

That's caused by the implicit --decorate=auto argument. Log.Decorate

Working args

image

$color = @('--color=always', '--decorate=full')
[string[]]$render = git.exe log -g @color --abbrev-commit --pretty=oneline | select -first 10
$render

note: I'm using git.exe so that I don't have to unload ugit.

$color = @('--color=always', '--decorate=full')
git.exe log -g @color --abbrev-commit --pretty=oneline | select -first 10
git.exe reflog @color | select -first 10

reproduction

# full color invoke
git.exe log --color=always --decorate=auto --abbrev-commit --oneline | select -first 10 

# now only partial color, the hash, is preserved
git.exe log --color=always --decorate=auto --abbrev-commit --oneline

image

Select-Object and assigning to string were both triggering the same auto, behavior, so I used both interchangabliy in some cases.


( [string[]]$render = ... ) | select -first 10 

ninmonkey avatar Jun 02 '23 03:06 ninmonkey