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
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 ???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.