diff --git a/Makefile b/Makefile index 50bff0c49b896f02fc5e26a1de41fcc51f91b7b9..638848a35f4914aed3d3cb4f3dbf301e884981b7 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ +CXX ?= g++ build: - g++ git-commit-hash-vanity.cc -lssl -lcrypto -lpthread -O3 -o git-commit-hash-vanity + $(CXX) git-commit-hash-vanity.cc -lssl -lcrypto -lpthread -O3 -o git-commit-hash-vanity bench: - g++ sha1-benchmark.cc -lssl -lcrypto -O3 -o sha1-benchmark + $(CXX) sha1-benchmark.cc -lssl -lcrypto -O3 -o sha1-benchmark time ./sha1-benchmark +install: build + cp git-commit-hash-vanity /usr/bin/ + cp vgitcommit /usr/bin/ diff --git a/README.md b/README.md index 460e129dd236f40409b917faed8c2099fc7b6085..3c1d9a6d594bdbe5798124a837af21556760c069 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ +# Git commit-hash vanity -1. Run `git commit` -2. Run `git cat-file commit HEAD` -3. Run `git reset HEAD~1 --soft`. -4. Modify the `catfile_text` and `commit_msg` in `main()` , also modify the hash condition `if(unlikely(*(uint16_t *)hashbuf == 0))`. Also search for `+0800` if you need to modify timezone. -5. Commit the result. (You should commit exactly the same changes) +If you want your git-commit hash looks strange, use me! + +## Installation + +Download this project and `make install`. + +## Usage + +In your own git repo, you just run `vgitcommit 'Update documents. %s'` instead of running `git commit -m 'Update documents'`. + +By default, this tool generates commit-hash with 8 leading-zero. If you want to change this behavior, just modify line 83 of `git-commit-hash-vanity.cc`.