Skip to content

Commit

Permalink
complement previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danimesq committed Mar 15, 2024
1 parent 48ea540 commit 1164e58
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 487 deletions.
22 changes: 9 additions & 13 deletions .gitmeta
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
commit QmcQktF2shMQMGGPXfxpDQfiRG9HS7ybeazsExP7LSR5va
commit QmYMBbMN3TxwH1Ks1tuQ7GDq9TexXcaizRBqwRQdy2sktg
Branch: main

------------------------------

chown -h 1000:1000 './git-meta-0.fixed'
chmod 0755 './git-meta-0.fixed'
/usr/bin/touch -hcmd "2024-03-15 17:17:15.7542464000 -0300" './git-meta-0.fixed'
/usr/bin/touch -hcad "2024-03-15 17:26:03.1146962000 -0300" './git-meta-0.fixed'
chown -h 1000:1000 './git-meta.fixed'
chmod 0755 './git-meta.fixed'
/usr/bin/touch -hcmd "2024-03-15 17:19:41.5444663000 -0300" './git-meta.fixed'
/usr/bin/touch -hcad "2024-03-15 17:26:03.4106960000 -0300" './git-meta.fixed'
chown -h 1000:1000 './git-meta.pregpt'
chmod 0664 './git-meta.pregpt'
/usr/bin/touch -hcmd "2024-03-15 17:13:26.7670362000 -0300" './git-meta.pregpt'
/usr/bin/touch -hcad "2024-03-15 17:13:42.6706047000 -0300" './git-meta.pregpt'
chown -h 1000:1000 './GPTConversation.txt'
chmod 0664 './GPTConversation.txt'
/usr/bin/touch -hcmd "2024-03-15 17:28:28.7307324000 -0300" './GPTConversation.txt'
/usr/bin/touch -hcad "2024-03-15 17:32:20.7792791000 -0300" './GPTConversation.txt'
chown -h 1000:1000 './git-meta'
chmod 0755 './git-meta'
/usr/bin/touch -hcmd "2024-03-15 17:30:31.9749604000 -0300" './git-meta'
/usr/bin/touch -hcad "2024-03-15 17:32:05.9312300000 -0300" './git-meta'
5 changes: 2 additions & 3 deletions .gitmeta-cid
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Branch: main
git-meta-0.fixed: QmbEJtq1bieM6jHUDCfxiBR8zccoHQZ8yN1Ufvo4Y1Fcqr
git-meta.fixed: QmYa3mu4BJSSnfPhrtk59zvNt4KoocStwsGQhavaFqj9FW
git-meta.pregpt: QmTyf54Dhv6xbifv7jzTo5kTywELTqm9smLkaZLVNGtjLA
GPTConversation.txt: QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH
git-meta: QmWYLGFfUa8yZsTEiqAo1eZ3cgmkz5KiS7o5DB1MBbmzjj
188 changes: 0 additions & 188 deletions GPTConversation.txt
Original file line number Diff line number Diff line change
@@ -1,188 +0,0 @@
About the git-meta "binary" (Bash), and maybe also about init.sh:

I don't want .gitmeta and .gitmeta-cid being added to .gitmeta on commits.
How to add an exclusion feature to git-meta to except .gitmeta from being added/listed to itself and also except .gitmeta-cid from also being added to .gitmeta?





To exclude [.gitmeta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta#1%2C1-1%2C1) and [.gitmeta-cid](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta-cid#1%2C1-1%2C1) from being added to [.gitmeta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta#1%2C1-1%2C1) during commits, you can modify the [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script to check for these filenames and skip them during the metadata storage process. This can be achieved by adding conditional checks within the loops that process files for metadata storage.

Here's how you can implement the exclusion feature:

1. **Modify the [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script**: Locate the section of the script that processes files and adds their metadata to [.gitmeta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta#1%2C1-1%2C1). This is where you'll add conditions to skip [.gitmeta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta#1%2C1-1%2C1) and [.gitmeta-cid](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta-cid#1%2C1-1%2C1).

2. **Add Exclusion Logic**: Before processing each file for metadata storage, check if the filename matches [.gitmeta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta#1%2C1-1%2C1) or [.gitmeta-cid](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/.gitmeta-cid#1%2C1-1%2C1). If it does, skip processing for that file.

Here's an example modification to the [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script, focusing on the part where files are processed:

```bash:git-meta
# Assuming this snippet is part of the larger git-meta script where files are being processed
for file in $(git ls-files -z | xargs -0); do
if [[ "$file" != ".gitmeta" && "$file" != ".gitmeta-cid" ]]; then
# Existing logic to store file metadata
# This is where you would have the commands to add file metadata to .gitmeta
fi
done
```

This example uses a simple `if` condition within a loop that iterates over all files tracked by Git, excluding `.gitmeta` and `.gitmeta-cid` from being processed.

3. **Apply similar logic in `init.sh`**: If `init.sh` also contributes to the process of adding files to `.gitmeta`, ensure to include similar exclusion logic in relevant sections of `init.sh`.

Remember, the exact implementation might vary based on the current structure and logic of your `git-meta` script and `init.sh`. The key is to introduce a conditional check before processing each file and exclude `.gitmeta` and `.gitmeta-cid` based on their filenames.





Storing files' timestamp, CID/hash; and other files/commit's metadata...
.git/hooks/git-meta: line 63: syntax error near unexpected token `;;'
.git/hooks/git-meta: line 63: ` \( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }' ;;'
Done. Meta has been preserved!






The syntax error you're encountering in the [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script is likely due to an incorrect use of the `;;` token within a command substitution context, rather than within a [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) statement where it's typically expected. To resolve this issue, you should remove the `;;` at the end of the problematic line.

Here's the corrected part of the script, focusing on the line that caused the error:

```bash:git-meta
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }'
```

Ensure this line is correctly placed within the script's logic for processing files and excluding `.gitmeta` and `.gitmeta-cid`. This adjustment should resolve the syntax error and allow the script to execute as intended.






Despite your fix attempt, the issue persists.

git-meta on  main [!⇡]
❯ bash install.sh
Installing git-meta's dependencies...
Building dependency tree... Done
Reading state information... Done
gawk is already the newest version (1:5.2.1-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Installing git-meta syswide...
- Turning git-meta into an executable...
- Turning git-meta's init.sh into an executable...
- Turning git-meta's pre-commit into an executable...

git-meta on  main [!⇡] took 4s
❯ git add Tasks.txt ; git commit -m "updt Tasks.txt"
Storing files' timestamp, CID/hash; and other files/commit's metadata...
.git/hooks/git-meta: line 63: syntax error near unexpected token `;;'
.git/hooks/git-meta: line 63: ` \( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }' ;;'
Done. Meta has been preserved!










The syntax error you're encountering is due to an incorrect placement or use of `;;` within a command substitution block in your [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script. The `;;` token is used to terminate cases in a shell [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) statement and should not be used at the end of a command substitution block.

To resolve this issue, you need to remove the `;;` at the end of the problematic line in your [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script. However, since the exact line causing the error wasn't directly shown in the provided code snippets, I'll guide you based on the error message you've shared.

Look for the line in your [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script that closely matches the error message:

```bash
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }' ;;
```

And remove the `;;` at the end, so it looks like this:

```bash
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }'
```

Ensure this change is made in the correct context within your script. This should resolve the syntax error and allow your script to execute properly.








git-meta on  main [!⇡]
❯ git add Tasks.txt ; git commit -m "updt Tasks.txt"
Storing files' timestamp, CID/hash; and other files/commit's metadata...
.git/hooks/git-meta: line 64: syntax error near unexpected token `)'
.git/hooks/git-meta: line 64: ` --apply) sh -e $GIT_CACHE_META_FILE;;'
Done. Meta has been preserved!









The syntax error you're encountering now is due to an incorrect placement or use of `)` in a context where it's not expected. This error is likely within a [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) statement in your [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script, specifically at the line handling the `--apply` case.

To resolve this issue, ensure that the [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) syntax is correctly structured. Each case should be followed by a pattern and then a right parenthesis `)`, with the commands for the case ending with `;;`.

Based on the error message, the problematic line seems to be related to the `--apply` case. Here's a corrected snippet assuming the structure of a [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) statement:

```bash:git-meta
case $1 in
--apply)
sh -e $GIT_CACHE_META_FILE
;;
# Other cases here
esac
```

Ensure this correction aligns with the actual structure and logic of your `git-meta` script. This adjustment should resolve the syntax error related to the unexpected token `)`.









git-meta on  main [!+⇡]
❯ git commit -m "test"
Storing files' timestamp, CID/hash; and other files/commit's metadata...
.git/hooks/git-meta: line 64: syntax error near unexpected token `)'
.git/hooks/git-meta: line 64: ` --apply) '
Done. Meta has been preserved!









The syntax error you're encountering in the [git-meta](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/init.sh#53%2C17-53%2C17) script is due to an incorrect or incomplete [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) statement syntax, specifically at the line handling the `--apply` case. The error message indicates that there's an unexpected token `)` which suggests that the command following `--apply)` might be missing or incorrectly formatted.

To resolve this issue, ensure that the command following `--apply)` is correctly formatted and that the [case](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#51%2C7-51%2C7) statement is properly closed with [esac](file:///media/daniella/B/git/nerdy%20DAOs/01VCS/git-meta/git-meta#53%2C61-53%2C61). Here's a corrected structure for the `--apply` case:

```bash:git-meta
case $1 in
--apply)
sh -e $GIT_CACHE_META_FILE
;;
# Other cases here
esac
```

Make sure this correction is applied in the correct context within your `git-meta` script, aligning with its actual structure and logic. This should resolve the syntax error related to the unexpected token `)`.
21 changes: 13 additions & 8 deletions git-meta
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ if [ ! -f .gitmeta ]
\( -printf 'chown -h %U:%G \0%p\n' \) , \
\( \! -type l -printf 'chmod %#m \0%p\n' \) , \
\( -printf $TOUCH' -hcmd "%TY-%Tm-%Td %TH:%TM:%TS '$Tz'" \0%p\n' \) , \
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }'
--apply)
sh -e $GIT_CACHE_META_FILE
;;
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \)
} | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }' ;;
--apply) sh -e $GIT_CACHE_META_FILE;;
*) 1>&2 echo "Usage:"
echo " $0 --store|--stdout|--apply";
echo " --store -f store meta in file";
echo " --stdout -c output to cosole";
echo " --apply -r restore meta"; exit 1;;
esac
#Would you like to add all files that are on the working tree (even the not versioned ones)?
#https://www.google.com/search?q=ls+all+files+recursively+except+some&client=ubuntu&hs=fhV&channel=fs&ei=HzWUYffIDKbN1sQPsu6n-AM&oq=ls+all+files+recursively+except+some&gs_lcp=Cgdnd3Mtd2l6EAM6BwgAEEcQsANKBAhBGABQFlgWYJUEaAFwAngAgAG0AYgBtAGSAQMwLjGYAQCgAQHIAQjAAQE&sclient=gws-wiz&ved=0ahUKEwi31M28-530AhWmppUCHTL3CT8Q4dUDCA0&uact=5
else
case $@ in
--store|--stdout)
Expand All @@ -78,10 +79,14 @@ esac
\( -printf 'chown -h %U:%G \0%p\n' \) , \
\( \! -type l -printf 'chmod %#m \0%p\n' \) , \
\( -printf $TOUCH' -hcmd "%TY-%Tm-%Td %TH:%TM:%TS '$Tz'" \0%p\n' \) , \
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \) | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }'
--apply)
sh -e $GIT_CACHE_META_FILE
;;
\( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \)
# git ls-files -mz | xargs -0 -I NAME $FIND ./NAME -maxdepth 0 \
# \( -printf 'chown -h %U:%G \0%p\n' \) , \
# \( \! -type l -printf 'chmod %#m \0%p\n' \) , \
# \( -printf $TOUCH' -hcmd "%TY-%Tm-%Td %TH:%TM:%TS '$Tz'" \0%p\n' \) , \
# \( -printf $TOUCH' -hcad "%AY-%Am-%Ad %AH:%AM:%AS '$Tz'" \0%p\n' \)
} | $AWK -v exclude=".gitmeta .gitmeta-cid" 'BEGIN {FS="\0"; split(exclude, ex, " ")}; {exclude_file=0; for(i in ex) if($2 == "./" ex[i]) exclude_file=1; if(!exclude_file) print $1 "'\''" gensub(/'\''/, "'\''\\\\'\'''\''", "g", $2) "'\''" }' ;;
--apply) sh -e $GIT_CACHE_META_FILE;;
*) 1>&2 echo "Usage:"
echo " $0 --store|--stdout|--apply";
echo " --store -f store meta in file";
Expand Down
Loading

0 comments on commit 1164e58

Please sign in to comment.