Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Features/linguist #1410

Closed
wants to merge 8 commits into
from

Conversation

Projects
None yet
6 participants
Contributor

SaitoWu commented Sep 8, 2012

use github-linguist to instead of gitlab linguist.

add detect language feature.

image

Important:

post-receive need to export git_work_tree variable. that is why we can detect language.

projects added a language field. the default language is Plain Text

Next:

we can checkout gl-pages branch to a folder too. so , we can have our gitlab pages!.

@vsizov vsizov commented on the diff Sep 8, 2012

lib/hooks/post-receive
@@ -9,4 +9,8 @@ do
pwd=`pwd`
reponame=`basename "$pwd" | cut -d. -f1`
env -i redis-cli rpush "resque:queue:post_receive" "{\"class\":\"PostReceive\",\"args\":[\"$reponame\",\"$oldrev\",\"$newrev\",\"$ref\",\"$GL_USER\"]}" > /dev/null 2>&1
+ # export GIT_WORK_TREE variable for Language detection
@vsizov

vsizov Sep 8, 2012

Contributor

How GIT_WORK_TREE helps for the Language detection? I do not see the relation. Can you explain?

@SaitoWu

SaitoWu Sep 9, 2012

Contributor

Git bare repo didn't have repo's source code in the file system.

If we have a GIT_WORK_TREE variable, the work tree will be there. just like a unbare repo.

Linguist works will unbare repo(work tree).

@SaitoWu

SaitoWu Sep 9, 2012

Contributor

After first push detection, the /home/git/repositories will be like this.

img

@dzaporozhets

dzaporozhets Sep 9, 2012

Owner

We have sattelite repo. Maybe we use it instead of patching hook

@SaitoWu

SaitoWu Sep 9, 2012

Contributor

@randx If we use satellite repo , I think we should keep the satellite repo up to date.

Satellite repo didn't pull unless it has a merge request and do merge.

@dzaporozhets

dzaporozhets Sep 9, 2012

Owner

yeah you right

@SaitoWu

SaitoWu Sep 9, 2012

Contributor

ok, I'll handle it. :-)

@dzaporozhets

dzaporozhets Sep 9, 2012

Owner

one more question. Does it increase repositories size 2x? As i understand we keep bare repo and normal one

@dzaporozhets

dzaporozhets Sep 9, 2012

Owner

lets chant in campfire?

@NARKOZ NARKOZ commented on an outdated diff Sep 8, 2012

app/roles/repository.rb
@@ -151,6 +155,12 @@ def archive_repo(ref)
file_path
end
+ def detect_repo_language
+ if(File.exist?(path_to_work_tree))
@NARKOZ

NARKOZ Sep 8, 2012

Contributor

less parentheses here

@tsigo tsigo commented on an outdated diff Sep 9, 2012

app/views/dashboard/index.html.haml
@@ -24,6 +24,7 @@
%li.wll
= link_to project_path(project), class: dom_class(project) do
%strong.project_name= truncate(project.name, length: 25)
+ %strong.language_name= project.language ||= "Plain Text"
@tsigo

tsigo Sep 9, 2012

Owner

You're not assigning something. Just use ||.

Contributor

SaitoWu commented Sep 9, 2012

@NARKOZ @tsigo just fixed the problem, thx for review.

@tsigo tsigo commented on an outdated diff Sep 9, 2012

app/roles/push_observer.rb
@@ -109,5 +109,9 @@ def trigger_post_receive(oldrev, newrev, ref, user)
if default_branch.nil?
update_attributes(default_branch: discover_default_branch)
end
+
+ # Update project's language field
+ update_attributes(language: detect_repo_language)
+
end
@tsigo

tsigo Sep 9, 2012

Owner

Let's only update attributes once. Change the default branch line to just be self.default_branch = discover_default_branch, then change yours to self.language = detect_repo_language, then add a save call at the bottom.

@dzaporozhets dzaporozhets was assigned Sep 12, 2012

Contributor

dubcanada commented Sep 27, 2012

Tried this out, issue with Resque

uninitialized constant Gitlabhq::Satellite
/home/gitlab/gitlab/app/models/project/repository_trait.rb:41:in `satellite'
/home/gitlab/gitlab/app/models/project/hooks_trait.rb:106:in `trigger_post_receive'
/home/gitlab/gitlab/app/workers/post_receive.rb:11:in `perform'
Contributor

SaitoWu commented Sep 27, 2012

close this issue now, I'll send a new PR next week..

I was been busy these days.

@SaitoWu SaitoWu closed this Sep 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment