Skip to content

Add ability to use arbitrary log formats#88

Open
prati0100 wants to merge 1 commit intocohama:masterfrom
prati0100:arbitrary-log
Open

Add ability to use arbitrary log formats#88
prati0100 wants to merge 1 commit intocohama:masterfrom
prati0100:arbitrary-log

Conversation

@prati0100
Copy link

Add a new version of the :Agit command called :Agit! that takes arbitrary git-log arguments. This lets people use various options in git-log like -L, --authot, pathspecs, etc.

The implementation is a bit hacky but works for me.

:Agit can only display the entire history because it uses option '--all'
in its log command. This is fine for small projects with one or two
branches. But with larger projects like Linux, there are many branches
that are far apart from each other.

This behaviour makes it impossible to easily view logs of the branch you
want because it might not even be close to the tip of the repo and so it
will be buried deep inside the log.

In addition, you can't use more advanced log options like -L, --author,
etc.

So, add a new version of the :Agit command called :Agit!. This lets the
user pass arbitrary options to the log command that will be executed.
The most important difference is that this version will not use '--all'
when calling git log.

While here, add some whitespace in agit#launch() to make reading it a
bit easier.
@cohama
Copy link
Owner

cohama commented Jul 1, 2020

Agit! is not suitable name for this feature. I think ! means overwrite (:w!, :func!), force (:q!, :e!), invert (:global!, :sort!) or make some small changes (:join!, :silent!).

endfunction

function! agit#launch(args)
function! agit#launch(bang, args)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to modify agit#launch. This method does not care about any concrete VIEW logic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. It won't be needed if we go with another command name.

@@ -41,7 +43,15 @@ endfunction

function! s:git.log(winwidth) dict
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a new function instead to modify s:git.log.

@prati0100
Copy link
Author

Agit! is not suitable name for this feature. I think ! means overwrite (:w!, :func!), force (:q!, :e!), invert (:global!, :sort!) or make some small changes (:join!, :silent!).

Ok. What name would you suggest? I'm not great at naming things, and I can't think of anything sensible.

@cohama
Copy link
Owner

cohama commented Jul 6, 2020

How aboud :AgitWithFormat?

@prati0100
Copy link
Author

Hmm, it is a mouthful. I don't think it will be all that easy to type or remember. And I also don't think it represents what the command does very well. We can pass much more than just formatting options to git-log. Thinking about it a bit more, I am inclined towards :AgitLog. It might cause confusion with :Agit, and it doesn't represent the difference between the two clearly either, but it looks like the lesser of the two evils. sigh naming things is hard. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants