@ -8,8 +8,7 @@
# include "cgit.h"
struct repolist cgit_repolist ;
struct repoinfo * cgit_repo ;
struct cgit_repolist cgit_repolist ;
struct cgit_context ctx ;
int cgit_cmd ;
@ -73,9 +72,9 @@ int chk_non_negative(int result, char *msg)
return result ;
}
struct repoinf o * add_repo ( const char * url )
struct cgit_ repo * add_repo ( const char * url )
{
struct repoinf o * ret ;
struct cgit_ repo * ret ;
if ( + + cgit_repolist . count > cgit_repolist . length ) {
if ( cgit_repolist . length = = 0 )
@ -84,7 +83,7 @@ struct repoinfo *add_repo(const char *url)
cgit_repolist . length * = 2 ;
cgit_repolist . repos = xrealloc ( cgit_repolist . repos ,
cgit_repolist . length *
sizeof ( struct repoinf o) ) ;
sizeof ( struct cgit_ repo) ) ;
}
ret = & cgit_repolist . repos [ cgit_repolist . count - 1 ] ;
@ -103,10 +102,10 @@ struct repoinfo *add_repo(const char *url)
return ret ;
}
struct repoinf o * cgit_get_repoinfo ( const char * url )
struct cgit_ repo * cgit_get_repoinfo ( const char * url )
{
int i ;
struct repoinf o * repo ;
struct cgit_ repo * repo ;
for ( i = 0 ; i < cgit_repolist . count ; i + + ) {
repo = & cgit_repolist . repos [ i ] ;
@ -179,32 +178,32 @@ void cgit_global_config_cb(const char *name, const char *value)
else if ( ! strcmp ( name , " repo.group " ) )
ctx . cfg . repo_group = xstrdup ( value ) ;
else if ( ! strcmp ( name , " repo.url " ) )
c git_ repo = add_repo ( value ) ;
c tx. repo = add_repo ( value ) ;
else if ( ! strcmp ( name , " repo.name " ) )
c git_ repo- > name = xstrdup ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.path " ) )
c git_ repo- > path = trim_end ( value , ' / ' ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.clone-url " ) )
c git_ repo- > clone_url = xstrdup ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.desc " ) )
c git_ repo- > desc = xstrdup ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.owner " ) )
c git_ repo- > owner = xstrdup ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.defbranch " ) )
c git_ repo- > defbranch = xstrdup ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.snapshots " ) )
c git_ repo- > snapshots = ctx . cfg . snapshots & cgit_parse_snapshots_mask ( value ) ; /* XXX: &? */
else if ( c git_ repo & & ! strcmp ( name , " repo.enable-log-filecount " ) )
c git_ repo- > enable_log_filecount = ctx . cfg . enable_log_filecount * atoi ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.enable-log-linecount " ) )
c git_ repo- > enable_log_linecount = ctx . cfg . enable_log_linecount * atoi ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.module-link " ) )
c git_ repo- > module_link = xstrdup ( value ) ;
else if ( c git_ repo & & ! strcmp ( name , " repo.readme " ) & & value ! = NULL ) {
c tx. repo- > name = xstrdup ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.path " ) )
c tx. repo- > path = trim_end ( value , ' / ' ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.clone-url " ) )
c tx. repo- > clone_url = xstrdup ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.desc " ) )
c tx. repo- > desc = xstrdup ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.owner " ) )
c tx. repo- > owner = xstrdup ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.defbranch " ) )
c tx. repo- > defbranch = xstrdup ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.snapshots " ) )
c tx. repo- > snapshots = ctx . cfg . snapshots & cgit_parse_snapshots_mask ( value ) ; /* XXX: &? */
else if ( c tx. repo & & ! strcmp ( name , " repo.enable-log-filecount " ) )
c tx. repo- > enable_log_filecount = ctx . cfg . enable_log_filecount * atoi ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.enable-log-linecount " ) )
c tx. repo- > enable_log_linecount = ctx . cfg . enable_log_linecount * atoi ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.module-link " ) )
c tx. repo- > module_link = xstrdup ( value ) ;
else if ( c tx. repo & & ! strcmp ( name , " repo.readme " ) & & value ! = NULL ) {
if ( * value = = ' / ' )
c git_ repo- > readme = xstrdup ( value ) ;
c tx. repo- > readme = xstrdup ( value ) ;
else
c git_ repo- > readme = xstrdup ( fmt ( " %s/%s " , c git_ repo- > path , value ) ) ;
c tx. repo- > readme = xstrdup ( fmt ( " %s/%s " , c tx. repo- > path , value ) ) ;
} else if ( ! strcmp ( name , " include " ) )
cgit_read_config ( value , cgit_global_config_cb ) ;
}
@ -213,7 +212,7 @@ void cgit_querystring_cb(const char *name, const char *value)
{
if ( ! strcmp ( name , " r " ) ) {
ctx . qry . repo = xstrdup ( value ) ;
c git_ repo = cgit_get_repoinfo ( value ) ;
c tx. repo = cgit_get_repoinfo ( value ) ;
} else if ( ! strcmp ( name , " p " ) ) {
ctx . qry . page = xstrdup ( value ) ;
cgit_cmd = cgit_get_cmd_index ( value ) ;