Compare commits

..

No commits in common. "5f6f7b7efed504edd81a4d6b971419de7338fb34" and "1e7c773c19d0a8ddcf7fd035245b562eb7701325" have entirely different histories.

4 changed files with 6 additions and 45 deletions

View File

@ -78,28 +78,4 @@ impl GitRepo {
return Ok(res); return Ok(res);
} }
pub fn get_revisions_nbr(&self) -> u32 {
let mut res = 0;
let mut revwalk = self.git2.revwalk().expect("revisions walk is not defined");
revwalk.push_head(); // todo : voir ce qu'il faut réellement pousser si on veux avoir TOUS les commits (genre par exemple si le HEAD n'est pas fils de tous les commits)
for _ in revwalk{
res = res + 1;
}
res
}
pub fn get_branches_nbr(&self) -> u32 {
let mut res = 0;
for _ in self.git2.branches(Some(BranchType::Local)){
res = res + 1;
}
res
}
pub fn get_tags_nbr(&self) -> u32 {
let mut res = 0;
self.git2.tag_foreach(|_,_| {res = res + 1;true});
res
}
} }

View File

@ -46,10 +46,6 @@ where for <'a> &'a TS : IntoIterator<Item = &'a Entry>,
browse : TS, browse : TS,
root : ROOT, root : ROOT,
user_opt : Option<User>, user_opt : Option<User>,
revisions_nbr : u32,
branches_nbr : u32,
tags_nbr : u32,
size : String,
} }
@ -113,16 +109,5 @@ pub async fn git_main<T : AuthValidator>(
} }
} }
} }
Ok(GitMainTemplate { Ok(GitMainTemplate { repo, browse : entries, root : path, user_opt : user})
repo,
browse : entries,
root : path,
user_opt : user,
revisions_nbr : gitrepo.get_revisions_nbr(),
branches_nbr : gitrepo.get_branches_nbr(),
tags_nbr : gitrepo.get_tags_nbr(),
size : "16 KiB".to_string(),
})
} }

View File

@ -26,7 +26,7 @@
</div> </div>
</div> </div>
{% when None %} {% when None %}
<a href="?login=true" class="w3-bar-item w3-button w3-right"><i class="fa fa-sign-in"></i> Log in</a> <a href="#" class="w3-bar-item w3-button w3-right"><i class="fa fa-sign-in"></i> Log in</a>
{% endmatch %} {% endmatch %}
</div> </div>
{% block content %}{% endblock %} {% block content %}{% endblock %}

View File

@ -26,16 +26,16 @@
<div class="w3-panel w3-border w3-cell-row"> <div class="w3-panel w3-border w3-cell-row">
<div class="w3-center w3-cell"> <div class="w3-center w3-cell">
<i class="fa fa-history"></i> {{ revisions_nbr }} revisions <i class="fa fa-history"></i> 112 revisions
</div> </div>
<div class="w3-center w3-cell"> <div class="w3-center w3-cell">
<i class="fa fa-code-branch"></i> {{ branches_nbr }} branches <i class="fa fa-code-branch"></i> 10 branches
</div> </div>
<div class="w3-center w3-cell"> <div class="w3-center w3-cell">
<i class="fa fa-tag"></i> {{ tags_nbr }} tags <i class="fa fa-tag"></i> 5 tags
</div> </div>
<div class="w3-center w3-cell"> <div class="w3-center w3-cell">
<i class="fa fa-database"></i> {{ size }} <i class="fa fa-database"></i> 10 KiB
</div> </div>
</div> </div>