shadow-git 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CLAUDE.md +3 -0
  2. package/README.md +13 -0
  3. package/dist/cli.js +176 -1
  4. package/package.json +1 -1
  5. package/src/cli.ts +33 -1
  6. package/src/core/update-check.ts +214 -0
  7. package/src/utils/logger.ts +8 -0
  8. package/tests/core/update-check.test.ts +494 -0
  9. package/.claude/settings.local.json +0 -43
  10. package/.temp/.sgit/COMMIT_EDITMSG +0 -1
  11. package/.temp/.sgit/HEAD +0 -1
  12. package/.temp/.sgit/config +0 -8
  13. package/.temp/.sgit/description +0 -1
  14. package/.temp/.sgit/hooks/applypatch-msg.sample +0 -15
  15. package/.temp/.sgit/hooks/commit-msg.sample +0 -24
  16. package/.temp/.sgit/hooks/fsmonitor-watchman.sample +0 -174
  17. package/.temp/.sgit/hooks/post-update.sample +0 -8
  18. package/.temp/.sgit/hooks/pre-applypatch.sample +0 -14
  19. package/.temp/.sgit/hooks/pre-commit +0 -6
  20. package/.temp/.sgit/hooks/pre-commit.sample +0 -49
  21. package/.temp/.sgit/hooks/pre-merge-commit.sample +0 -13
  22. package/.temp/.sgit/hooks/pre-push.sample +0 -53
  23. package/.temp/.sgit/hooks/pre-rebase.sample +0 -169
  24. package/.temp/.sgit/hooks/pre-receive.sample +0 -24
  25. package/.temp/.sgit/hooks/prepare-commit-msg.sample +0 -42
  26. package/.temp/.sgit/hooks/push-to-checkout.sample +0 -78
  27. package/.temp/.sgit/hooks/sendemail-validate.sample +0 -77
  28. package/.temp/.sgit/hooks/update.sample +0 -128
  29. package/.temp/.sgit/index +0 -0
  30. package/.temp/.sgit/info/exclude +0 -20
  31. package/.temp/.sgit/logs/HEAD +0 -1
  32. package/.temp/.sgit/logs/refs/heads/master +0 -1
  33. package/.temp/.sgit/objects/03/7f4e37a02573e40ab78b35dd4b442cc6110bae +0 -0
  34. package/.temp/.sgit/objects/2f/f0fd85dec20039eef6ff63ead905778a88843f +0 -0
  35. package/.temp/.sgit/objects/34/b3190a8a836593fb568a56c073a416a56fbf6d +0 -0
  36. package/.temp/.sgit/objects/70/ad6bbbfefd330d72a43dc2a810e6ef42269911 +0 -0
  37. package/.temp/.sgit/objects/90/4e09c7aadaa32d2426ab5464a975d5151ef195 +0 -0
  38. package/.temp/.sgit/objects/a4/6358feef49515d5f85d1d3a64e929182da7149 +0 -3
  39. package/.temp/.sgit/objects/c3/2432f724b666f647fe21a1ce16535cd7693f74 +0 -0
  40. package/.temp/.sgit/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  41. package/.temp/.sgit/objects/e8/0f4253888cdadda1e3d810f6a3cb3c68c20b50 +0 -0
  42. package/.temp/.sgit/objects/ee/9dd32cca3b134623d184eb4de5805704c493e3 +0 -0
  43. package/.temp/.sgit/refs/heads/master +0 -1
  44. package/.temp/.sgit.json +0 -10
  45. package/.temp/README.md +0 -0
  46. package/.temp/docs/guide.md +0 -10
  47. package/.temp/lib/__init__.py +0 -1
  48. package/.temp/lib/utils.py +0 -5
  49. package/.temp/rec1/rec2/test +0 -0
  50. package/.temp/src/config.py +0 -3
  51. package/.temp/src/main.py +0 -5
  52. package/.temp/temp/shouldnt-track +0 -0
  53. package/.temp/temp.md +0 -3
  54. package/.temp/test/1 +0 -0
  55. package/.temp/tests/test_utils.py +0 -7
@@ -1,77 +0,0 @@
1
- #!/bin/sh
2
-
3
- # An example hook script to validate a patch (and/or patch series) before
4
- # sending it via email.
5
- #
6
- # The hook should exit with non-zero status after issuing an appropriate
7
- # message if it wants to prevent the email(s) from being sent.
8
- #
9
- # To enable this hook, rename this file to "sendemail-validate".
10
- #
11
- # By default, it will only check that the patch(es) can be applied on top of
12
- # the default upstream branch without conflicts in a secondary worktree. After
13
- # validation (successful or not) of the last patch of a series, the worktree
14
- # will be deleted.
15
- #
16
- # The following config variables can be set to change the default remote and
17
- # remote ref that are used to apply the patches against:
18
- #
19
- # sendemail.validateRemote (default: origin)
20
- # sendemail.validateRemoteRef (default: HEAD)
21
- #
22
- # Replace the TODO placeholders with appropriate checks according to your
23
- # needs.
24
-
25
- validate_cover_letter () {
26
- file="$1"
27
- # TODO: Replace with appropriate checks (e.g. spell checking).
28
- true
29
- }
30
-
31
- validate_patch () {
32
- file="$1"
33
- # Ensure that the patch applies without conflicts.
34
- git am -3 "$file" || return
35
- # TODO: Replace with appropriate checks for this patch
36
- # (e.g. checkpatch.pl).
37
- true
38
- }
39
-
40
- validate_series () {
41
- # TODO: Replace with appropriate checks for the whole series
42
- # (e.g. quick build, coding style checks, etc.).
43
- true
44
- }
45
-
46
- # main -------------------------------------------------------------------------
47
-
48
- if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
49
- then
50
- remote=$(git config --default origin --get sendemail.validateRemote) &&
51
- ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
52
- worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
53
- git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
54
- git config --replace-all sendemail.validateWorktree "$worktree"
55
- else
56
- worktree=$(git config --get sendemail.validateWorktree)
57
- fi || {
58
- echo "sendemail-validate: error: failed to prepare worktree" >&2
59
- exit 1
60
- }
61
-
62
- unset GIT_DIR GIT_WORK_TREE
63
- cd "$worktree" &&
64
-
65
- if grep -q "^diff --git " "$1"
66
- then
67
- validate_patch "$1"
68
- else
69
- validate_cover_letter "$1"
70
- fi &&
71
-
72
- if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
73
- then
74
- git config --unset-all sendemail.validateWorktree &&
75
- trap 'git worktree remove -ff "$worktree"' EXIT &&
76
- validate_series
77
- fi
@@ -1,128 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to block unannotated tags from entering.
4
- # Called by "git receive-pack" with arguments: refname sha1-old sha1-new
5
- #
6
- # To enable this hook, rename this file to "update".
7
- #
8
- # Config
9
- # ------
10
- # hooks.allowunannotated
11
- # This boolean sets whether unannotated tags will be allowed into the
12
- # repository. By default they won't be.
13
- # hooks.allowdeletetag
14
- # This boolean sets whether deleting tags will be allowed in the
15
- # repository. By default they won't be.
16
- # hooks.allowmodifytag
17
- # This boolean sets whether a tag may be modified after creation. By default
18
- # it won't be.
19
- # hooks.allowdeletebranch
20
- # This boolean sets whether deleting branches will be allowed in the
21
- # repository. By default they won't be.
22
- # hooks.denycreatebranch
23
- # This boolean sets whether remotely creating branches will be denied
24
- # in the repository. By default this is allowed.
25
- #
26
-
27
- # --- Command line
28
- refname="$1"
29
- oldrev="$2"
30
- newrev="$3"
31
-
32
- # --- Safety check
33
- if [ -z "$GIT_DIR" ]; then
34
- echo "Don't run this script from the command line." >&2
35
- echo " (if you want, you could supply GIT_DIR then run" >&2
36
- echo " $0 <ref> <oldrev> <newrev>)" >&2
37
- exit 1
38
- fi
39
-
40
- if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
41
- echo "usage: $0 <ref> <oldrev> <newrev>" >&2
42
- exit 1
43
- fi
44
-
45
- # --- Config
46
- allowunannotated=$(git config --type=bool hooks.allowunannotated)
47
- allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
48
- denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
49
- allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
50
- allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
51
-
52
- # check for no description
53
- projectdesc=$(sed -e '1q' "$GIT_DIR/description")
54
- case "$projectdesc" in
55
- "Unnamed repository"* | "")
56
- echo "*** Project description file hasn't been set" >&2
57
- exit 1
58
- ;;
59
- esac
60
-
61
- # --- Check types
62
- # if $newrev is 0000...0000, it's a commit to delete a ref.
63
- zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
64
- if [ "$newrev" = "$zero" ]; then
65
- newrev_type=delete
66
- else
67
- newrev_type=$(git cat-file -t $newrev)
68
- fi
69
-
70
- case "$refname","$newrev_type" in
71
- refs/tags/*,commit)
72
- # un-annotated tag
73
- short_refname=${refname##refs/tags/}
74
- if [ "$allowunannotated" != "true" ]; then
75
- echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
76
- echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
77
- exit 1
78
- fi
79
- ;;
80
- refs/tags/*,delete)
81
- # delete tag
82
- if [ "$allowdeletetag" != "true" ]; then
83
- echo "*** Deleting a tag is not allowed in this repository" >&2
84
- exit 1
85
- fi
86
- ;;
87
- refs/tags/*,tag)
88
- # annotated tag
89
- if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
90
- then
91
- echo "*** Tag '$refname' already exists." >&2
92
- echo "*** Modifying a tag is not allowed in this repository." >&2
93
- exit 1
94
- fi
95
- ;;
96
- refs/heads/*,commit)
97
- # branch
98
- if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
99
- echo "*** Creating a branch is not allowed in this repository" >&2
100
- exit 1
101
- fi
102
- ;;
103
- refs/heads/*,delete)
104
- # delete branch
105
- if [ "$allowdeletebranch" != "true" ]; then
106
- echo "*** Deleting a branch is not allowed in this repository" >&2
107
- exit 1
108
- fi
109
- ;;
110
- refs/remotes/*,commit)
111
- # tracking branch
112
- ;;
113
- refs/remotes/*,delete)
114
- # delete tracking branch
115
- if [ "$allowdeletebranch" != "true" ]; then
116
- echo "*** Deleting a tracking branch is not allowed in this repository" >&2
117
- exit 1
118
- fi
119
- ;;
120
- *)
121
- # Anything else (is there anything else?)
122
- echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
123
- exit 1
124
- ;;
125
- esac
126
-
127
- # --- Finished
128
- exit 0
package/.temp/.sgit/index DELETED
Binary file
@@ -1,20 +0,0 @@
1
- # sgit-managed
2
- *
3
- !.sgit.json
4
- !temp.md
5
- !README.md
6
- !temp/
7
- temp/*
8
- !temp/should-track
9
- !temp2/
10
- !temp2/**
11
- !test/
12
- test/*
13
- !test/1
14
- !rec1/
15
- rec1/*
16
- !rec1/rec2/
17
- rec1/rec2/*
18
- !rec1/rec2/test
19
- .gitignore.sgit-parked
20
- # end: sgit-managed
@@ -1 +0,0 @@
1
- 0000000000000000000000000000000000000000 a46358feef49515d5f85d1d3a64e929182da7149 Demo User <demo@example.com> 1774984373 +0400 commit (initial): sgit: initialize shadow repository
@@ -1 +0,0 @@
1
- 0000000000000000000000000000000000000000 a46358feef49515d5f85d1d3a64e929182da7149 Demo User <demo@example.com> 1774984373 +0400 commit (initial): sgit: initialize shadow repository
@@ -1,3 +0,0 @@
1
- x��K
2
- 1]��$?�����
3
-  3�q&��D���\�ݣ��M�35PA�ZA/cr�8�8'cd�:Z�&%��l�v!(%�-\����V��)�y�w�ۊ�����6 �x{i�������:Q�Ԏ@jW�"�%&~A��+5.��'?Z
@@ -1 +0,0 @@
1
- a46358feef49515d5f85d1d3a64e929182da7149
package/.temp/.sgit.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "paths": [
3
- "temp.md",
4
- "README.md",
5
- "temp/should-track",
6
- "temp2/",
7
- "test/1",
8
- "rec1/rec2/test"
9
- ]
10
- }
package/.temp/README.md DELETED
File without changes
@@ -1,10 +0,0 @@
1
- # User Guide
2
-
3
- ## Getting Started
4
-
5
- Run `python src/main.py` to start the application.
6
-
7
- ## API Reference
8
-
9
- - `add(a, b)` — returns the sum
10
- - `subtract(a, b)` — returns the difference
@@ -1 +0,0 @@
1
- from .utils import add, subtract
@@ -1,5 +0,0 @@
1
- def add(a, b):
2
- return a + b
3
-
4
- def subtract(a, b):
5
- return a - b
File without changes
@@ -1,3 +0,0 @@
1
- DEBUG = False
2
- VERSION = "0.1.0"
3
- APP_NAME = "demo"
package/.temp/src/main.py DELETED
@@ -1,5 +0,0 @@
1
- def main():
2
- print("Hello, world!")
3
-
4
- if __name__ == "__main__":
5
- main()
File without changes
package/.temp/temp.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Notes
2
-
3
- This file is tracked only by shadow-git, invisible to the main git repo.
package/.temp/test/1 DELETED
File without changes
@@ -1,7 +0,0 @@
1
- from lib.utils import add, subtract
2
-
3
- def test_add():
4
- assert add(2, 3) == 5
5
-
6
- def test_subtract():
7
- assert subtract(5, 3) == 2