I want to validate branch names when someone on my team does: git checkout -b [branch-name and then do some validation and give them feedback if they don't hit the criteria
I don't seem to be able to create custom hooks and im not sure how to create a script that runs when someone types git checkout -b. can someone give me a clue how to do this?
also once I commit this PR into master I would like the command git checkout -b to work on other peoples machines as soon as they pull this new code down
What you've described is that you want to commit something into a repo, so that if someone pulls from that repo, the behavior of a common git command is changed so as to run arbitrary code of your choosing. This is not something git supports, and hopefully it never will (as doing so would be a huge security hole).
I don't seem to be able to create custom hooks
Why is that?
I ask because hooks are the closest thing you're going to get to what you want. In particular, you should enforce branch naming (or any other conventions) on the remote using a pre-receive hook (and give up on caring what branch names might be used locally by the devs).
If your developers want something client-side so that they can "fail fast" when they make errors with respect to this naming convention - and once you have server-side enforcement, they probably will - then you can offer them the same underlying script to run as needed. They can then set it up locally in whatever way they see fit - perhaps as an alias, for example.
If you can't use a pre-receive hook - e.g. if the software that hosts your remote doesn't provide for custom hooks - then git has no direct support that's likely to help. In the case that server software is getting in the way, consult that software's docs to see what functionality it might offer in lieu of hooks.
In the end, you may not be able to rely on the software to enforce your naming policy. Not everything is best solved as a technical problem.
Related
Should Node.js be the basis of a website or be used only when certain functionality (eg. a chat room) is needed?
For example, in certain project, I'm using npm and have a node_modules folder and a package.json file in the main directory where all my code is.
However, the question I'm asking is whether or not this is good practice? Should Node.js only be used in, for example a chat-room/ folder? Or is it OK to use the same Node.js installation across an entire website, using when needed?
Many companies recently are having a hard job to detach their front end code from their server, hence, if you are starting a project from scratch, this is something you want to avoid.
Having low coupling applications will give you the flexibility to change your whole Front End stack without changing a single code in your API. Moreover, you will be able to use your API from different applications. They will now work independently.
The routing is how you define the URL, verb and opt parameters.
I hope that is what you have been struggling with.
When using packages installed to Visual Studio from NuGET for instances, what are some things I can look for within the javascript file(s) to make sure company or personal information isn't being captured and sent somewhere?
What keywords could I use to search other than http to make sure there are no extra calls transparently shipping out information?
I know that with these being open-source and all most likely a lot of eyes have been on it, but I want to take a look for myself.
This may be the wrong forum to ask this question, however is it possible to do a "touchless" node.js deployment? For example, is it possible to push a copy of node.exe and the required packages to a physical location on the drive (assume the machine is generally in a disconnected state) then have a shortcut that executes the appropriate commandline to get the node process running?
I know that this is a loaded question, because without being physically installed on the box, and then running within a Windows Service, you lose all the lifetime management, and that is just scratching the surface of the things that need to be considered. Anyway, I truly appreciate the help and opinions.
Just coming back to clean up this answer. Yes this is possible, but not always advisable. Better to do an installation or leverage containers.
I'm a newer and if the question is so easy I apologize for that.
Assume I want to dev a classical online judge system, obviously the core part is
get users' code to a file
compile it on server
run it on server (with some sandbox things to prevent damage)
the program exit itself, then check the answer.
or get the signal of program collapsing.
I wonder if it's possible to do all the things using Node.js, how to do the sandbox things. Is there any example for compile-sandbox-run-abort-check thing?
additional:
is it more convenient to dev a such system using PYTHON?
thanks in advance.
Most of these steps are standard --- create a file, run a system call to compile something, muck around with I/O --- I think any language should be able to do them, except the very crucial step of "run in a sandbox." I am aware of several solutions for sandboxing:
use OS commands to restrict or remove abilities (chroot, setrlimit, file system permissions in linux)
remove all dangerous functionality from the language being graded
interrupt system events
run the sandbox inside a virtual machine.
This list is probably not exhaustive. The system I am involved with, http://cscircles.cemc.uwaterloo.ca uses option #1. Again, most of the work is done in system calls so I can't imagine that one language is so much better than the other? We use php for the big-level stuff and C to do the sandboxing. Does that help answer your question?
To accomplish the sandbox, it would be fairly easy to do this by simply running your code inside of a closure that reassigns all of the worrisome calls to NaN
for instance, if the code executes inside a closure where eval=NaN
Is there a Javascript implementation of Git?
I'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests.
Check out: https://github.com/danlucraft/git.js
A pure js implementation of git in javascript.
This https://github.com/creationix/js-git is and will be the future!
It is backed by a kickstarter campaign and has a very sound software design.
Many of the client use-cases such as git clone have been implemented
According the answer to my question on the issue tracker [1]. The author also plans to implement parts of the server side stuff to allow you to build a server with it.
https://github.com/creationix/js-git/issues/33
You can use https://github.com/isomorphic-git/isomorphic-git
isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read and write to git repositories, fetch from and push to git remotes (such as GitHub), all without any native C++ module
isomorphic-git is a continuation of https://github.com/creationix/js-git
isomorphic-git would not have been possible without the pioneering work by
#creationix and #chrisdickinson. Git is a tricky binary mess, and without
their examples (and their modules!) I would not have been able to come even
close to finishing this. They are geniuses ahead of their time.
Related questions:
Run git push from javascript hosted in static site
How to implement Git in pure Javascript to create a GUI?
I guess it depends on what you need, but there's a few related projects out there.
The most "robust" implementation I can think of is this one by the 280North crew (of Cappuccino fame).
There's also some server-side JavaScript projects underway (e.g., http://github.com/ajaxorg/node-github), but that won't run entirely within a browser client.
Update (for anyone else who comes across this):
Please be sure to check out vanthome's answer. Tim Caswell's js-git project is well funded and undoubtedly the best answer here at this time.
I just recently wrote a Git client called Nougit. Maybe this resembles something you are looking for?
$ npm install nougit
https://github.com/gordonwritescode/nougit
This is a full GUI, but the module inside named "git.js" is an API I wrote specifically to do what you are describing. Yank out the file, and you can use express to handle the http routes.