Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

STASH Licenses + Hooks

Ishan August 15, 2013
Guys,
I have a few questions on hand:
Q1:
We have requested about a 100 licenses for initial Stash Deployment.. Now we have an inhouse crowd server that we want to connect to, but that server has about 1000 users. Would we be able to connect to this crowd server considering the number of licenses requested ???
Q2:
Currently git supports Global Hooks and repository level hooks. I am trying to use global hooks at the git level via STASH.
Meaning I dont plan to add anything at the STASH level but plan to do so at the GIT server level and I want to see if STASH will be able to handle that.. Is this possible, if so then if you can provide some examples, that would be really helpful..
Thanks,
Ishan

5 answers

1 vote
ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 19, 2013

Hey Ishan,

EDIT: you should still be able to put hooks in the global git template as mentioned on the link you described and the hooks will be copied into every new or forked repo created by Stash.

You might want to have a look at STASH-3597 and vote for that issue as well.

Best regards,

Thiago Bomfim

Atlassian Support

0 votes
GPReleaseEngineering August 22, 2013

Thanks Charles, that confirms one scenario..

Now there is a sticky part here, assuming the scenario below:

git branch abc, git checkout abc, making changes in the branch, git commit -a -m "fixing stuff", git push origin abc

Here initially I used to do : git rev-list old_change..latest_change . But here if I take the latest_change and do:

git cat-file commit latest_change | sed '1,/^$/d'.

It returns does not give me the latest changeset SHA, am I missing something here ???

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 23, 2013

Hi Ishan,

What are you using cat-file for? Testing that regex it looks like that would return you the commit message on 'latest_change'. Don't you already have the latest changeset? Sorry, I'm not quite sure what you're trying to do. Can you post your hook?

Charles

0 votes
GPReleaseEngineering August 21, 2013

Hey Charles,

Yes even I plan to use Java/Plugin Hooks soon.. But for now we have needs that needs to be accomplished soon enough.. So I will try out your suggestion..

One question I had on STASH/git side is, in general how can I check if the git push is a branch creation ??

meaning : git branch abc, git checkout abc, git push origin abc.

Now how can I know that this push is a branch checkout ?? I am looking for a git command.

One way I thought of is that during any push, git passes old change + new change and the branch name. If the old change is "00000000000" then that means its a branch creation, if not then its an existing branch..

Please correct me if I am wrong !!

Thanks,

Ishan

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2013

Hi Ishan,

That's exactly what you can do. If the old change is the null SHA (40 0's) then it's a new ref (branch/tag/whatever) and if the new changes is the null SHA then it's a ref deletion.

Does that help?

Charles

0 votes
GPReleaseEngineering August 19, 2013

Hey Thiago,

Here is what I think how Global Hooks in git work:

-> There is a template that a user can create and then initialize using "git config --global init.templatedir '~/.git_template'" and then every repo that I have created can use this template and hoks within this template..

http://stackoverflow.com/questions/2293498/git-commit-hooks-global-settings

-> Here is what I tried with STASH:

I created a repo and hooks within it, then I forked that repo assuming that the hooks get copied over, but it seems that is not the case.. So how can I implement global hooks at git level for STASH ??

Thanks,

Ishan

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2013

Hi Ishan,

When you fork in Stash we're just doing a 'git clone', which doesn't normally copy hooks. Stash is no different.

While I don't recommend in general that you use raw Git hooks, you should still be able to put your hooks in the global git template directory and they should be copied into every new or forked repository that is created in Stash. Please let me know if that's not the case.

I would also thinking about making your hooks in the template directory symlinks so that if you need to make changes you can do it once and not have to update your hooks in Stash.

I would definitely vote/watch the issue that Thiago mentioned below. Managing global hooks in Stash would be the ideal situation. Although I should warn you if/when we implement that feature it is likely to only be Java/Plugin hooks, not the normal Git scripts.

Cheers,

Charles

0 votes
ThiagoBomfim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 15, 2013

Hello Ishan,

Q1:

As per the "Integrating Crowd with Atlassian Stash" document, the first step you have to take is to configure Crowd so that Stash will be able to connect to it. There is another step in which you will have to configure a specific set of users that can log in to Stash. Hence, not all your Crowd user base will have to be sychronized with Stash but only the ones you configure.

Q2:

Stash is a Git repository management tool. So that means you are able to do anything Git allows you to. The Repository System Info Plugin enables you to see the location of your repositories on disk and you can add the hooks to your Git repositories once you know their path. You can see some examples here.

However, you might want to start doing at "Stash level" after reading Hooked on Stash.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events