Edgewall Software
Modify

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#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:
  • Documented that cached repository is required for changeset search.
  • Modified post-receive script on TracRepositoryAdmin page to avoid error on first repository commit.
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)

in reply to:  description comment:1 by Ryan J Ollos, 10 years ago

Replying to anonymous:

(By the way, when is this trac-admin command necessary? Assuming that the git hooks are configured correctly, is this necessary only once?)

resync will populate the NODE_CHANGE and REVISION tables will all changesets for the specified repository. It only needs to be done once, or after certain repository configuration changes. After the initial resync operation, sync is called through the post-commit hook for every changeset that is added or modified.

I couldn't find this piece of information in the docs (at least not in TracGit) and thought I could add a reminder here.

We could also add a discussion about repository caching on the TracRepositoryAdmin page.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:2 by anonymous, 10 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 Ryan J Ollos, 10 years ago

Priority: normallow

in reply to:  2 ; comment:4 by Jun Omae, 10 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
Last edited 10 years ago by Jun Omae (previous) (diff)

comment:5 by Jun Omae, 10 years ago

Modified hooks/post-receive in wiki:TracRepositoryAdmin@40?action=diff.

in reply to:  4 ; comment:6 by Ryan J Ollos, 9 years ago

Milestone: 1.0.7
Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

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.

in reply to:  6 comment:7 by Ryan J Ollos, 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.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:8 by Ryan J Ollos, 9 years ago

Owner: set to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.