-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix: create git hook not stuck anymore (now creating from file in…
…stead of cat eof) ; pre-commit now as a symlink!
- Loading branch information
Showing
6 changed files
with
69 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
commit QmdmreDdby63wApPSNyE3jHnpMWfYstcyYemdJ3683sDeH | ||
commit QmTyCVdDULTUKm72Qvs6Ps7F7mJcKArLU5B3N4QkfgGgeW | ||
Branch: main | ||
|
||
------------------------------ | ||
|
||
chown -h 1000:1000 './.gitmeta' | ||
chmod 0755 './.gitmeta' | ||
/usr/bin/touch -hcmd "2024-03-15 15:44:30.1444364000 -0300" './.gitmeta' | ||
/usr/bin/touch -hcad "2024-03-15 15:18:53.5880235000 -0300" './.gitmeta' | ||
/usr/bin/touch -hcmd "2024-03-15 15:52:57.6367678000 -0300" './.gitmeta' | ||
/usr/bin/touch -hcad "2024-03-15 15:44:30.1844360000 -0300" './.gitmeta' | ||
chown -h 1000:1000 './.gitmeta-cid' | ||
chmod 0755 './.gitmeta-cid' | ||
/usr/bin/touch -hcmd "2024-03-15 15:44:30.0764372000 -0300" './.gitmeta-cid' | ||
/usr/bin/touch -hcad "2024-03-15 15:44:30.1404365000 -0300" './.gitmeta-cid' | ||
/usr/bin/touch -hcmd "2024-03-15 15:52:57.5687672000 -0300" './.gitmeta-cid' | ||
/usr/bin/touch -hcad "2024-03-15 15:52:57.6327678000 -0300" './.gitmeta-cid' | ||
chown -h 1000:1000 './Tasks.txt' | ||
chmod 0755 './Tasks.txt' | ||
/usr/bin/touch -hcmd "2024-03-15 15:44:23.0245187000 -0300" './Tasks.txt' | ||
/usr/bin/touch -hcad "2024-03-15 15:44:29.8484398000 -0300" './Tasks.txt' | ||
/usr/bin/touch -hcmd "2024-03-15 15:52:45.7246590000 -0300" './Tasks.txt' | ||
/usr/bin/touch -hcad "2024-03-15 15:52:52.1967177000 -0300" './Tasks.txt' | ||
chown -h 1000:1000 './init.sh' | ||
chmod 0755 './init.sh' | ||
/usr/bin/touch -hcmd "2024-03-15 15:52:16.7324086000 -0300" './init.sh' | ||
/usr/bin/touch -hcad "2024-03-15 15:52:52.2367181000 -0300" './init.sh' | ||
chown -h 1000:1000 './install.sh' | ||
chmod 0755 './install.sh' | ||
/usr/bin/touch -hcmd "2024-03-15 15:50:59.7878523000 -0300" './install.sh' | ||
/usr/bin/touch -hcad "2024-03-15 15:52:52.2367181000 -0300" './install.sh' | ||
chown -h 1000:1000 './pre-commit' | ||
chmod 0664 './pre-commit' | ||
/usr/bin/touch -hcmd "2024-03-15 15:46:32.9074917000 -0300" './pre-commit' | ||
/usr/bin/touch -hcad "2024-03-15 15:52:52.2567182000 -0300" './pre-commit' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
Branch: main | ||
Tasks.txt: QmUjVRjnMYy4frEa3ycEjnujboJ7gENYSy7c6WkpR3TeBq | ||
Tasks.txt: QmYetV54G4TJBwoiFw7kGpXAjwoUWTKHXetXj1KsSffRqH | ||
init.sh: QmP2onTksejZi4tTKiTmgeHwRYhucZycLAcywugVzoY5fm | ||
install.sh: QmXWL4d8u7bPwNBnR77KLsgjJugGt7RCnB8rtnw1H6xvQj | ||
pre-commit: QmV3C9xY6FSEZ2uh2KcuVGq1CTp2jGy5kNuZipHUnGtoRo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
#01VCSHere | ||
|
||
echo "Storing files' timestamp, CID/hash; and other files/commit's metadata..." | ||
|
||
commit_author="$(git config user.name)"" <""$(git config user.email)"">" | ||
commit_message=$(cat $1) | ||
current_branch=$(git rev-parse --abbrev-ref HEAD) #from https://dev.to/anibalardid/how-to-check-commit-message-and-branch-name-with-git-hooks-without-any-new-installation-n34 | ||
# https://github.com/typicode/husky/discussions/1171 | ||
|
||
if [ ! -f ".gitmeta-cid" ]; then touch .gitmeta-cid; fi | ||
|
||
echo "Branch: $current_branch" > .gitmeta-cid & #use ">" instead of ">>" as a way of emptying .gitmeta-cid before writing new commit data | ||
# Get a list of all staged files | ||
staged_files=$(git diff --cached --name-only) | ||
# Hash (IPFS CID) the contents of each staged file, to the pipe | ||
for file in $staged_files; do | ||
if [ -f "$file" ]; then | ||
file_cid=$(ipfs add -q --only-hash "$file") | ||
echo "$file"": ""$file_cid" >> .gitmeta-cid & | ||
fi | ||
done | ||
|
||
commit_cid=$(ipfs add -q --only-hash .gitmeta-cid) | ||
echo "commit ""$commit_cid" > .gitmeta #use ">" instead of ">>" as a way of emptying .gitmeta before writing new commit data | ||
echo "Branch: ""$current_branch" >> .gitmeta | ||
echo "" >> .gitmeta && echo "------------------------------" >> .gitmeta && echo "" >> .gitmeta | ||
|
||
# If the .eth file exists, sign the commit data with the Ethereum account | ||
if [ -f ".git/hooks/.eth" ]; then | ||
eth_account=$(cat .git/hooks/.eth) | ||
signature=$(geth --exec "web3.personal.sign(web3.toHex('$commit_cid'), '$eth_account', null)" attach) | ||
fi | ||
|
||
bash .git/hooks/git-meta --store | ||
git add .gitmeta | ||
git add .gitmeta-cid | ||
echo "Done. Meta has been preserved!" |