Closed Clumsy-Coder closed 1 year ago
There is no way to do this via a config value, but you could add it to the line here possibly
eval "git log --follow $graph --color=always --format='$log_format' $* $_forgit_emojify" |
We could consider adding it as an option in the future, like we do for --graph
if enough people think it would be useful
Does glo --follow -- FILESPEC
not work? Forgit passes the options on to git log with $*
. Or am I missing something here?
Interesting, maybe true! We use the argv variable $*
a couple times in the function
files=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command
eval "git log $graph --color=always --format='$log_format' $* $_forgit_emojify" |
I'm not sure if the first one would choke on that flag? It's worth a try though @Clumsy-Coder . Do report back if you find out :)
I tried the command to display the entire history of a file.
glo --follow <file>
I got this.
Not sure what the ...
thing is. When using the arrow keys to navigate the commits, ...
display nothing on the right side
That's git telling you that it left out some commits because the file you specified wasn't modified in those. We could make sure that only lines actually containing a commit get displayed by adding a grep command like this
eval "git log $graph --color=always --format='$log_format' $* $_forgit_emojify" |
grep '\*' |
FZF_DEFAULT_OPTS="$opts" fzf
This would also get rid of lines containing only things like |/
. Before the change glo
looks like this
After the change like this:
I'd personally prefer the second one and can provide a PR if this is the behavior we want. Opinions?
Interesting, maybe true! We use the argv variable
$*
a couple times in the functionfiles=$(sed -nE 's/.* -- (.*)/\1/p' <<< "$*") # extract files parameters for `git show` command eval "git log $graph --color=always --format='$log_format' $* $_forgit_emojify" |
I'm not sure if the first one would choke on that flag? It's worth a try though @Clumsy-Coder . Do report back if you find out :)
Should be fine. The sed command only matches when there is a space after the --
.
@Clumsy-Coder Do I understand it right that calling glo --follow <file>
actually answers your question?
That's git telling you that it left out some commits because the file you specified wasn't modified in those. We could make sure that only lines actually containing a commit get displayed by adding a grep command like this
eval "git log $graph --color=always --format='$log_format' $* $_forgit_emojify" | grep '\*' | FZF_DEFAULT_OPTS="$opts" fzf
This would also get rid of lines containing only things like
|/
. Before the changeglo
looks like this
After the change like this:
I'd personally prefer the second one and can provide a PR if this is the behavior we want. Opinions?
@sandr01d I personally prefer the first one and would like to keep this information in the log. So if you want to provide a PR for this, I would prefer to have it as an opt-in option.
@carlfriedrich It mostly solves it, but a small issue remains where you have ...
on commits that are not related to the file being viewed.
https://github.com/wfxr/forgit/issues/281#issuecomment-1400820232
@carlfriedrich It mostly solves it, but a small issue remains where you have
...
on commits that are not related to the file being viewed.
Does FORGIT_LOG_GRAPH_ENABLE=false glo --follow FILESPEC
provide your desired output?
That's git telling you that it left out some commits because the file you specified wasn't modified in those. We could make sure that only lines actually containing a commit get displayed by adding a grep command like this
eval "git log $graph --color=always --format='$log_format' $* $_forgit_emojify" | grep '\*' | FZF_DEFAULT_OPTS="$opts" fzf
This would also get rid of lines containing only things like
|/
. Before the changeglo
looks like thisAfter the change like this:
I'd personally prefer the second one and can provide a PR if this is the behavior we want. Opinions?
@sandr01d I personally prefer the first one and would like to keep this information in the log. So if you want to provide a PR for this, I would prefer to have it as an opt-in option.
Found this to be solved by FORGIT_LOG_GRAPH_ENABLE
already, so no additional changes are necessary.
Does FORGIT_LOG_GRAPH_ENABLE=false glo --follow FILESPEC provide your desired output?
@sandr01d This solves the issue. maybe sometime later I could use it with the graph as well.
Check list
Environment info
Question
How do I add the flag
--follow
when runninggit log
for the aliasglo
?Why? Ans) I would like to see the logs of a file before it moved or renamed.
https://github.com/wfxr/forgit/blob/be8c306c18754f6ede2955f901b832a3225d4b83/bin/git-forgit#L74-L97
From what I see, there's no ENV used for modifiying the
git log
command to add the--follow
flag.