shadow-git 1.0.3 → 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.
- package/CLAUDE.md +5 -1
- package/README.md +13 -0
- package/dist/cli.js +498 -75
- package/package.json +1 -1
- package/src/cli.ts +69 -5
- package/src/commands/forward.ts +3 -3
- package/src/commands/track/add.ts +6 -4
- package/src/commands/track/clone.ts +16 -1
- package/src/commands/track/destroy.ts +5 -0
- package/src/commands/track/ignore.ts +2 -2
- package/src/commands/track/index.ts +12 -0
- package/src/commands/track/init.ts +5 -1
- package/src/commands/track/remove.ts +3 -2
- package/src/commands/track/swap.ts +61 -0
- package/src/commands/track/sync.ts +9 -6
- package/src/commands/track/unswap.ts +49 -0
- package/src/commands/track/verify.ts +11 -9
- package/src/core/errors.ts +31 -1
- package/src/core/exclude.ts +2 -2
- package/src/core/gitignore.ts +18 -3
- package/src/core/repository.ts +8 -0
- package/src/core/swap-mode.ts +83 -0
- package/src/core/update-check.ts +214 -0
- package/src/utils/logger.ts +20 -0
- package/tests/commands/forward.test.ts +6 -6
- package/tests/commands/track/add.test.ts +6 -6
- package/tests/commands/track/swap.test.ts +266 -0
- package/tests/commands/track/verify.test.ts +16 -16
- package/tests/core/exclude.test.ts +10 -10
- package/tests/core/gitignore.test.ts +30 -30
- package/tests/core/update-check.test.ts +494 -0
- package/tests/helpers/guard-child.mjs +2 -2
- package/.claude/settings.local.json +0 -43
- package/.temp/.sgit/COMMIT_EDITMSG +0 -1
- package/.temp/.sgit/HEAD +0 -1
- package/.temp/.sgit/config +0 -8
- package/.temp/.sgit/description +0 -1
- package/.temp/.sgit/hooks/applypatch-msg.sample +0 -15
- package/.temp/.sgit/hooks/commit-msg.sample +0 -24
- package/.temp/.sgit/hooks/fsmonitor-watchman.sample +0 -174
- package/.temp/.sgit/hooks/post-update.sample +0 -8
- package/.temp/.sgit/hooks/pre-applypatch.sample +0 -14
- package/.temp/.sgit/hooks/pre-commit +0 -6
- package/.temp/.sgit/hooks/pre-commit.sample +0 -49
- package/.temp/.sgit/hooks/pre-merge-commit.sample +0 -13
- package/.temp/.sgit/hooks/pre-push.sample +0 -53
- package/.temp/.sgit/hooks/pre-rebase.sample +0 -169
- package/.temp/.sgit/hooks/pre-receive.sample +0 -24
- package/.temp/.sgit/hooks/prepare-commit-msg.sample +0 -42
- package/.temp/.sgit/hooks/push-to-checkout.sample +0 -78
- package/.temp/.sgit/hooks/sendemail-validate.sample +0 -77
- package/.temp/.sgit/hooks/update.sample +0 -128
- package/.temp/.sgit/index +0 -0
- package/.temp/.sgit/info/exclude +0 -20
- package/.temp/.sgit/logs/HEAD +0 -1
- package/.temp/.sgit/logs/refs/heads/master +0 -1
- package/.temp/.sgit/objects/03/7f4e37a02573e40ab78b35dd4b442cc6110bae +0 -0
- package/.temp/.sgit/objects/2f/f0fd85dec20039eef6ff63ead905778a88843f +0 -0
- package/.temp/.sgit/objects/34/b3190a8a836593fb568a56c073a416a56fbf6d +0 -0
- package/.temp/.sgit/objects/70/ad6bbbfefd330d72a43dc2a810e6ef42269911 +0 -0
- package/.temp/.sgit/objects/90/4e09c7aadaa32d2426ab5464a975d5151ef195 +0 -0
- package/.temp/.sgit/objects/a4/6358feef49515d5f85d1d3a64e929182da7149 +0 -3
- package/.temp/.sgit/objects/c3/2432f724b666f647fe21a1ce16535cd7693f74 +0 -0
- package/.temp/.sgit/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- package/.temp/.sgit/objects/e8/0f4253888cdadda1e3d810f6a3cb3c68c20b50 +0 -0
- package/.temp/.sgit/objects/ee/9dd32cca3b134623d184eb4de5805704c493e3 +0 -0
- package/.temp/.sgit/refs/heads/master +0 -1
- package/.temp/.sgit.json +0 -10
- package/.temp/README.md +0 -0
- package/.temp/docs/guide.md +0 -10
- package/.temp/lib/__init__.py +0 -1
- package/.temp/lib/utils.py +0 -5
- package/.temp/rec1/rec2/test +0 -0
- package/.temp/src/config.py +0 -3
- package/.temp/src/main.py +0 -5
- package/.temp/temp/shouldnt-track +0 -0
- package/.temp/temp.md +0 -3
- package/.temp/test/1 +0 -0
- 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
|
package/.temp/.sgit/info/exclude
DELETED
|
@@ -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.bat
|
|
20
|
-
# end: sgit-managed
|
package/.temp/.sgit/logs/HEAD
DELETED
|
@@ -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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a46358feef49515d5f85d1d3a64e929182da7149
|
package/.temp/.sgit.json
DELETED
package/.temp/README.md
DELETED
|
File without changes
|
package/.temp/docs/guide.md
DELETED
package/.temp/lib/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .utils import add, subtract
|
package/.temp/lib/utils.py
DELETED
package/.temp/rec1/rec2/test
DELETED
|
File without changes
|
package/.temp/src/config.py
DELETED
package/.temp/src/main.py
DELETED
|
File without changes
|
package/.temp/temp.md
DELETED
package/.temp/test/1
DELETED
|
File without changes
|