Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's just work for HEAD branch only. #13

Open
vin-mfvhn opened this issue May 5, 2023 · 1 comment
Open

It's just work for HEAD branch only. #13

vin-mfvhn opened this issue May 5, 2023 · 1 comment

Comments

@vin-mfvhn
Copy link

I have worked with multiple branches.
But when I generate a report, it just show me a report for current branch only.

@jdockerty
Copy link
Owner

👋 Thanks for filing an issue.

The current intention is very much that the tool looks at HEAD, as this is where you are currently placed within your working tree and seems that a vast majority of the time you would be looking at your past X hours work for where you are.

If I understand correctly, is your intention that you should be able to do something along the lines of 👇 ?

today --branches=feat/new-app,chore/cleanup DIRECTORIES

And the tool would show commits from HEAD, feat/new-app, and chore/cleanup in the directories where those branches exist, skipping those where it doesn't?


An issue that I could foresee, is that in order to check for commits in other branches, multiple git.PlainOpen (or equivalent) must be called, this has the potential to cause problems with your current working tree as those new branch references need to be opened in order to find the commits over a specified time range.

today/today.go

Lines 70 to 81 in a61e6fc

// openGitDir is used to open a validated directory which is tracked by git, this returns information
// about the repository that is being tracked.
func openGitDir(dir string) (*git.Repository, error) {
repo, err := git.PlainOpen(dir)
if err != nil {
return nil, err
}
return repo, nil
}

I haven't looked at this for some time, but I believe this would be a problem if you have uncommitted changes, as the different branch could cause conflicts.

I'd be happy to take a look over a proposal on a feature though if it's something you think could really work 🚀

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

No branches or pull requests

2 participants