Compare commits
5 Commits
3a13d25e9c
...
646ca42e6f
Author | SHA1 | Date | |
---|---|---|---|
|
646ca42e6f | ||
|
9200690b69 | ||
|
69befa481e | ||
|
08771733b1 | ||
|
77bdcc1024 |
1
example-repo/.subcommit-git/HEAD
Normal file
1
example-repo/.subcommit-git/HEAD
Normal file
@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
5
example-repo/.subcommit-git/config
Normal file
5
example-repo/.subcommit-git/config
Normal file
@ -0,0 +1,5 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = false
|
||||
bare = false
|
||||
|
1
example-repo/.subcommit-git/description
Normal file
1
example-repo/.subcommit-git/description
Normal file
@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository
|
BIN
example-repo/.subcommit-git/index
Normal file
BIN
example-repo/.subcommit-git/index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xśUŽÍ
|
||||
Â0„=úcEHĄ<48>?ŕAko><3E>xRi“¶<E2809C>šJ˝<>ďî&jĹ=-3;ßNŢ´9–‹Ő`¤tŃÜ„DÚYѨ|Zgađ'ŞÖka ´Ĺ…+ÍÜÂMU$(jn0ˇý~<Çx„hT ćl·XöŞ›ňj([2˘JcD‡ŽWrŤqç>qc3¤R‹ě¤Łž:;Ç›_ŢH{3óŹôtüG*äóŘ‚ŰV1źť÷Yç÷Ď]x÷íjE{Ç :ĘđÄ/â{˛Ó˘? ¤ł©Ć=•]Ó
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xœU<EFBFBD>1NÅ@D©‘¸Ã” ¡(_ÿtTˆ"øNâ‹Ýuäõ~NÏ&=óf¦ÚãÜžo:EÉcL²m}Ù6,¦³Q|ÄUbÉ+ â˜Lã!4FJc<4A>Ä
^h•™œw¹ÁÙ¢$
|
||||
p=¤ArÑ<04>þ§ð'Å©Œ{5Ð8Ö?ùŸ¡âëS÷N«˜¦Èɱ’Éî{@íðÓ-È;ãòK?áÔ¶—]<5D>ôÙ\vsÞ×2òXOß»S‰=[Þó²“ùAÍ®jã¼ðà²r¸6w·_¥jp%
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xœ5<EFBFBD>A
|
||||
Â0]z‡·ËF*uçօФíkˆùú“PééZwÃÀ0C”ýùrxø<78>ñRqjŸXBŒpLT[‹Ìwe ™ana]
óæZw²iÚünº¶i›;‰IÆSÍÖ±+Ÿ‚Y^<14>Ö„âù?þ‚/“?.
|
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xœMÌ=
|
||||
€0@açž"ÒÐôgô(5<>è ‰÷Wœ\|Oú¾oq°K<15>ç:s+Tü‘S%¦#¡æÌsÁ<73>|âèêmk¿à•0Ž‰½“ïdúonj
¤¢§AëâˆYÿ
|
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xœ]<5D>A‚0D]“p‡cR1";náJY(Ћ)ÅÆ»ÛVÅà_ýÌëÌŸæm—#
|
||||
w‹E;”q¯Ê–çÛ&u<>™È»?âã˜ãhe×áBáJ¹ f¡².
•Øèý~Î|<\zxb0– ¢I5SݤöVDcRðN=ÙëÞ R¥ˆ™(Ó‹ðØÔ]æ~ÉÔ Â<>ô4ìE]Èú‘€ªŽë
'¯á:wF÷–¾ù÷£Ä†æ<C3A6>:ÿp[<5B>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xœ5<EFBFBD>A
|
||||
Â0]r‡·ËF*Š'páôiûšÚ|M~héé»a`˜v’çëåðŒcÁ+KÈ~Æ2N³W£ð]™:B¸û¸mŽåw«;ùÔÿünk¬y<C2AC>è¥;Õâ]ƒdDY ‚\4òüEfB¹ª51Å
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
xœMÌ;
|
||||
€0@ëœb/ h>$[z”$û‚A+x|ÁÊvŠ©Wï§ó¤ Nhð<01>VÒšŠÏÞ•šE6Ë®H`—l<E28094>ÜL¾õ¸‘‹4Ï1l¦~‘âof¡<>,‹>j^ tñ
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
example-repo/.subcommit-git/refs/heads/master
Normal file
1
example-repo/.subcommit-git/refs/heads/master
Normal file
@ -0,0 +1 @@
|
||||
a3de24d2748d8aff1eb5d785d7a08b0aaa46d76b
|
1
example-repo/.subcommit-git/refs/heads/test
Normal file
1
example-repo/.subcommit-git/refs/heads/test
Normal file
@ -0,0 +1 @@
|
||||
a3de24d2748d8aff1eb5d785d7a08b0aaa46d76b
|
17
libwyag.py
17
libwyag.py
@ -50,7 +50,7 @@ class GitRepository (object):
|
||||
|
||||
def __init__(self, path, force=False):
|
||||
self.worktree = path.replace("\\", "/")
|
||||
self.gitdir = join_path(path, ".git")
|
||||
self.gitdir = join_path(path, ".subcommit-git")
|
||||
|
||||
if not (force or os.path.isdir(self.gitdir)):
|
||||
raise Exception(f"Not a git repository {path}")
|
||||
@ -156,7 +156,7 @@ def cmd_init(args):
|
||||
def repo_find(path=".", required=True):
|
||||
path = os.path.realpath(path)
|
||||
|
||||
if os.path.isdir(join_path(path, ".git")):
|
||||
if os.path.isdir(join_path(path, ".subcommit-git")):
|
||||
return GitRepository(path)
|
||||
|
||||
# If we haven't returned, recurse in parent
|
||||
@ -1093,7 +1093,7 @@ def check_ignore(rules, path):
|
||||
raise Exception("This function requires path to be relative to the repository's root")
|
||||
|
||||
# Eh, just hardcode it
|
||||
if (path.startswith(".git")):
|
||||
if (path.startswith(".subcommit-git")):
|
||||
return True
|
||||
|
||||
result = check_ignore_scoped(rules.scoped, path)
|
||||
@ -1487,6 +1487,7 @@ def tree_from_index(repo, index, commit_map, author, commit_time, message):
|
||||
if path in commit_map:
|
||||
(subcommit_hash, subcommit) = commit_map[path]
|
||||
else:
|
||||
subcommit_hash = None
|
||||
subcommit = None
|
||||
|
||||
if subcommit == None or subcommit.kvlm[b'tree'] != sha.encode('ascii'):
|
||||
@ -1530,12 +1531,18 @@ def cmd_commit(args):
|
||||
repo = repo_find()
|
||||
index = index_read(repo)
|
||||
root_commit_sha = object_find(repo, "HEAD")
|
||||
root_commit = object_read(repo, root_commit_sha)
|
||||
if root_commit_sha:
|
||||
root_commit = object_read(repo, root_commit_sha)
|
||||
else:
|
||||
root_commit = None
|
||||
|
||||
commit_time = datetime.now()
|
||||
author = gitconfig_user_get(gitconfig_read())
|
||||
|
||||
commit_map = create_commit_map(repo, root_commit)
|
||||
if root_commit:
|
||||
commit_map = create_commit_map(repo, root_commit)
|
||||
else:
|
||||
commit_map = dict()
|
||||
|
||||
tree = tree_from_index(repo,
|
||||
index,
|
||||
|
5
readme.txt
Normal file
5
readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
This is an implementation of alternate git internals where trees point to subcommits rather than other trees. This allows subdirectory history tracking to be baked into the repository structure.
|
||||
|
||||
This is based on Write Yourself a Git (https://wyag.thb.lt/)
|
||||
|
||||
Note that this requires >= Python 3.10
|
Loading…
Reference in New Issue
Block a user