#12093 closed defect (fixed)
document that git.cached_repository=true is needed for searching in git changesets
Reported by: | anonymous | Owned by: | Jun Omae |
---|---|---|---|
Priority: | low | Milestone: | 1.0.7 |
Component: | plugin/git | Version: | 1.0-stable |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
|
||
API Changes: | |||
Internal Changes: |
Description
I was testing the search in the commit messages of the git repositories that I added to trac.
I noted that it dind't work until I set git.cached_repository=true
in trac.ini
, followed by trac-admin /path/to/my/trac/env repository resync "myrepo"
.
(By the way, when is this trac-admin
command necessary? Assuming that the git hooks are configured correctly, is this necessary only once?)
I couldn't find this piece of information in the docs (at least not in TracGit) and thought I could add a reminder here.
Attachments (0)
Change History (8)
follow-up: 4 comment:2 by , 9 years ago
Thank you for your answer!
I also noticed that with this git post-receive hook (as recommended in TracRepositoryAdmin#Git):
#!/bin/sh while read oldrev newrev refname; do git rev-list --reverse $newrev ^$oldrev | \ while read rev; do trac-admin /srv/http/trac/gtd changeset added tm4c-launchpad-cmsis $rev done done
I get a (harmless?) error on the first push:
git push -u myserver master Counting objects: 35, done. Delta compression using up to 4 threads. Compressing objects: 100% (33/33), done. Writing objects: 100% (35/35), 60.45 KiB | 0 bytes/s, done. Total 35 (delta 3), reused 0 (delta 0) remote: fatal: bad object 0000000000000000000000000000000000000000 To git@localhost:myrepo * [new branch] master -> master Branch master set up to track remote branch master from myserver.
The following pushes work without error.
What triggers this remote: fatal?
comment:3 by , 9 years ago
Priority: | normal → low |
---|
follow-up: 6 comment:4 by , 9 years ago
#!/bin/sh while read oldrev newrev refname; do git rev-list --reverse $newrev ^$oldrev | \ while read rev; do trac-admin /srv/http/trac/gtd changeset added tm4c-launchpad-cmsis $rev done done
It doesn't seem that the hook script works when a branch is created like this.
$ git rev-list c08bf199cd81f681f6fbd45c9ee8602791759c2e ^0000000000000000000000000000000000000000 fatal: bad object 0000000000000000000000000000000000000000
Instead, please try the following hook script:
#! /bin/sh tracenv=/path/to/env # change with your Trac environment's path repos= # change with your repository's name while read oldrev newrev refname; do if [ "$oldrev" = 0000000000000000000000000000000000000000 ]; then git rev-list --reverse "$newrev" -- else git rev-list --reverse "$newrev" "^$oldrev" -- fi | xargs trac-admin "$tracenv" changeset added "$repos" done
follow-up: 7 comment:6 by , 9 years ago
Milestone: | → 1.0.7 |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
Replying to jomae:
Instead, please try the following hook script:
Extracting the variables /path/to/env
and <repos>
like you've done in comment:4 seems like a nice way to make the script on the TracRepositoryAdmin page more clear. Should we make that change?
Other suggested documentation changes in TracRepositoryAdmin@41.
comment:7 by , 9 years ago
Replying to rjollos:
Replying to jomae:
Instead, please try the following hook script:
Extracting the variables
/path/to/env
and<repos>
like you've done in comment:4 seems like a nice way to make the script on the TracRepositoryAdmin page more clear. Should we make that change?
Page modified in TracRepositoryAdmin@42.
comment:8 by , 9 years ago
Owner: | set to |
---|
Replying to anonymous:
resync
will populate theNODE_CHANGE
andREVISION
tables will all changesets for the specified repository. It only needs to be done once, or after certain repository configuration changes. After the initialresync
operation,sync
is called through the post-commit hook for every changeset that is added or modified.We could also add a discussion about repository caching on the TracRepositoryAdmin page.