Comments (17)
Note that we have a "global" configuration for all our repos:
gitweb:
path: https://webserver.com/gitweb
project: ${repo_name}
However, also if I "hard-code" the project to the sub-folder like this:
gitweb:
path: https://webserver.com/gitweb
project: funky/fizzle.git
.. the links still end up pointing to the top-level.
In any case, it would be nice if the repo_name variable would end up pointing to "funky/fizzle", as it also appears in the subject of the mail.
from git-commit-notifier.
@tfnico, we have no installations like yours. pull requests are very apprepriated.
from git-commit-notifier.
I don't have a pull request just yet, but the fix is simple: for gitweb, diff_to_html.rb uses Git.repo_name instead of config['gitweb']['project'](which means the setting was totally ignored). See the diff below...
--- /usr/lib/ruby/gems/1.9.1/gems/git-commit-notifier-0.11.2/lib/git_commit_notifier/diff_to_html.rb.orig 2012-04-02 15:44:09.394652993 -0400
+++ /usr/lib/ruby/gems/1.9.1/gems/git-commit-notifier-0.11.2/lib/git_commit_notifier/diff_to_html.rb 2012-04-02 16:32:50.919423617 -0400
@@ -161,7 +161,7 @@
# TODO: these filenames, etc, should likely be properly html escaped
if config['link_files']
file_name = if config["link_files"] == "gitweb" && config["gitweb"]
- "<a href='#{config['gitweb']['path']}?p=#{Git.repo_name}.git;f=#{file_name};h=#{@current_sha};hb=#{@current_commit}'>#{file_name}</a>"
+ "<a href='#{config['gitweb']['path']}?p=#{config['gitweb']['project']};f=#{file_name};h=#{@current_sha};hb=#{@current_commit}'>#{file_name}</a>"
elsif config["link_files"] == "gitorious" && config["gitorious"]
"<a href='#{config['gitorious']['path']}/#{config['gitorious']['project']}/#{config['gitorious']['repository']}/blobs/#{branch_name}/#{file_name}'>#{file_name}</a>"
elsif config["link_files"] == "cgit" && config["cgit"]
@@ -448,7 +448,7 @@
def markup_commit_for_html(commit)
commit = if config["link_files"]
if config["link_files"] == "gitweb" && config["gitweb"]
- "<a href='#{config['gitweb']['path']}?p=#{Git.repo_name}.git;a=commitdiff;h=#{commit}'>#{commit}</a>"
+ "<a href='#{config['gitweb']['path']}?p=#{config['gitweb']['project']};a=commitdiff;h=#{commit}'>#{commit}</a>"
elsif config["link_files"] == "gitorious" && config["gitorious"]
"<a href='#{config['gitorious']['path']}/#{config['gitorious']['project']}/#{config['gitorious']['repository']}/commit/#{commit}'>#{commit}</a>"
elsif config["link_files"] == "trac" && config["trac"]
This has the potential to break projects that don't have the project setting set up properly, which would be a config error. Maybe a better fix would be to use Git.repo_name is the config param isn't set, but I'm not very Ruby-literate so don't expect this from me...
Thanks
from git-commit-notifier.
I see this is already fixed in Git. Thanks
from git-commit-notifier.
@dermoth Thanks for suggesting the fix. Are you saying in your last comment that the issue has been since fixed in the git-commit-notifier itself?
from git-commit-notifier.
Yes, if you clone from git and build it you will have this fix, as well as proper email ordering when you push more than one commit at once.
from git-commit-notifier.
Closed because already fixed.
from git-commit-notifier.
I didn't notice anything being fixed after upgrading to 0.11.4, but ended up just hacking it into lib/git_commit_notifier/git.rb like this:
# TFN: Old line:
# File.expand_path(git_dir).split("/").last.sub(/\.git$/, '')
# TFN: Hack to fix subdir problem
File.expand_path(git_dir).split("/var/git/").last.sub(/\.git$/, '')
Only works if gitweb is running in /var/git, of course.
from git-commit-notifier.
Another hack for gitweb:
in lib/git_commit_notifier/diff_to_html.rb:491, I hardcoded in gitweb, because even though my config.gitweb.project is empty, I still want links on the commits:
# TFN: Commented out the line below, because we don't want default, even though config.gitweb.project is empty (cause we use Git.repo_name instead)
# COMMIT_LINK_MAP[mode].call(config, commit)
COMMIT_LINK_MAP[:gitweb].call(config, commit)
This is all very hacky, of course, and I don't have the Ruby-fu to make something re-usable. But maybe someone else who comes along and has this configuration can make it work.
from git-commit-notifier.
Yup, this issue is still happening in 0.11.4 - the fix as per @dermoth's patch indeed seems to have been applied before 0.11.4, but also only seems to be valid for configurations where one specific repository is configured for the notifier (in gitweb:project). Like @tfnico, we use the "global" configuration, and links are incorrect in such cases.
gitweb:
path: http://git.magnolia-cms.com/gitweb
#project: test.git
from git-commit-notifier.
@gjoseph Any suggestions?
from git-commit-notifier.
I wish. I can't think of anything that would make sense for everyone, other than, perhaps, introduced a config variable such as "repos_root", i.e where all repos are. And even that might not work for everyone. How about looking at gitweb's projects.list file ?
from git-commit-notifier.
Can you inform about its location and format? Gist is very apprepriated. This is because I have no Gitweb installations.
from git-commit-notifier.
The location of the file is specified in gitweb.conf ($project_list); or, as I've just realized not used. In any case, one specifies a $projectroot in gitweb.conf, which is the paths under which all repos are. If $project_list is specific, the format of the file is simply one repo per line, with the path (relative to $projectroot) to each repo/.git folder (in my case, these are bare repos). If $project_list is not specified, gitweb scans $projectroot to find all repos.
Example file:
foobar.git
modules/baz.git
modules/qux.git
So seeing this, my suggestion would be to
- allow projectroot to also be configured in git-commit-notifier (possibly in the gitweb section) - because you probably don't want to parse gitweb.conf (which is Perl, and also because its content might depend on env.variables)
- look at the absolute path of each repo, when building the url, and strip off $projectroot
from git-commit-notifier.
Will be reviewed and feature planned.
from git-commit-notifier.
thanks !
from git-commit-notifier.
in my setup i see that ${repo_name} is not getting expanded as the project name for gitweb URL's. is this problem part of this issue or i should open a new issue?
from git-commit-notifier.
Related Issues (20)
- add URL of repository HOT 2
- emphasizing first line of commit message HOT 3
- Set Reply-to to recipient address? HOT 5
- Pushing a new branch resulted in Iconv::IllegalSequence in diff_to_html HOT 5
- Creation of a branch triggers notification mails for ALL commits in the repository HOT 4
- Add parameter to gem HOT 5
- ${repo_name} is not getting expanded as the project name for gitweb URL's
- COMMIT_LINK_MAP for gitlabhq missing parent in url
- gitlabhq file_link feature produces 404s HOT 5
- support trac with multiple repositories HOT 1
- nokogiri 1.6.0 dropped support for ruby 1.8.3 HOT 1
- I've got a Permission problem with git-commit-notifier HOT 4
- Sorry for Problem again HOT 4
- How to change auther HOT 3
- Link file summary list to web view repository HOT 1
- Invalid multibyte escape
- Pushing to GitLab with link_files fails under ruby 2 HOT 1
- Commits suppressed with unique_commits_per_branch:false and include_branches:[...]
- How to config smtps(port 465) in the file of git-notifier-config.yml
- Tag/deploy new version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-commit-notifier.