Closed acuarica closed 6 years ago
This is not currently implement but I think it may be possible. I see two options for how this could work. One option is to track everything in the parent git project. Another option is to track time within each submodule - which is what you are asking for. This may be more difficult to implement.
I'll do some research on this and mark this as feature request. Feel free to explore options. I think what currently is failing is the discovery process for finding the root of the git repo when you are within the submodule.
Thanks for your reply.
I've been looking how a project is being initialized, and the issue seems to be in project/project.go:96
:
gitPath := filepath.Join(projRoot, ".git") // <- Here is the issue
if _, err := os.Stat(gitPath); os.IsNotExist(err) {
return "", fmt.Errorf(
"Unable to intialize Git Time Metric, Git repository not found in %s", gitPath)
}
For submodules, the git repo is under .git/modules/<submodule-name>
in the parent .git
repo. The problem I see is the ".git"
is hardcoded, but this should be provided by scm.RootPath
. Does all this make sense?
I was trying to fix it, but I am unable to build the project. The instructions on the wiki page seem to be outdated (there is no vagrantfile and base directory was removed). Do you have any instructions on how to get started with building from source?
Best, Luis.
The Wiki is outdated as far as the build instructions. For local builds I use Make. You can try make install-git2go
(this assumes macOS but you can easily update for Linux) and make build test
. You only you need to do the install-git2go
initially.
Another option is to take a look at how I do the build in .travis.yml
.
If your on Windows you can take a look at appveyor.yml
.
I did some research and experimenting on this. Tracking time within each individual submodule will be challenging to implement cleanly. I'm not even sure yet if it's possible.
However we can support tracking the submodule time within the git parent. This means when you edit files within a submodule the time will be be added to the parent project. You can see which files are from submodules by looking at the file path recorded.
Here's a change I tested within a branch that supports this. https://github.com/git-time-metric/gtm/compare/master...submodule
I'm still open to the idea of recording the time within the submodules but we would need to find a clean way to support that.
I made an implementation submodule tracking. I created a PR for this. Let me know if I missed something.
I close the broken PR and submit a new and fixed PR. I'm testing it with my work tree and seems to work fine.
I made some minors updates and created PR. https://github.com/git-time-metric/gtm/pull/86
Latest release now supports git submodules. Thanks for your help @acuarica.
When trying to initialize a git subrepo (created using
git submodule add
) withgtm init
I get the error:Whenever I
gtm init
aclone
d repo, it works fine.Is there any workaround to track time individually on each submodule? Is this feature implemented? Are there any plan to implement this in the future? Maybe I could contribute with the implementation.
gtm
seems exactly what I was looking for, no distraction, seamless, IDE integration. I believe I would enjoy using is myself.OS: macOS High Sierra 10.13.5 gtm: v1.3.3 git: version 2.15.1 (Apple Git-101)