Compare commits

...

5 Commits

Author SHA1 Message Date
646ca42e6f Add example repository 2024-07-21 16:49:10 -07:00
9200690b69 Rename main script to subcommit-git 2024-07-21 16:47:05 -07:00
69befa481e Add readme 2024-07-21 16:46:27 -07:00
08771733b1 Allow first commit in repo
Before you had to do it through vanilla git
2024-07-20 09:29:52 -07:00
77bdcc1024 Change repo dir from .git to .subcommit-git 2024-07-20 09:29:05 -07:00
55 changed files with 40 additions and 5 deletions

View File

@ -0,0 +1 @@
ref: refs/heads/master

View File

@ -0,0 +1,5 @@
[core]
repositoryformatversion = 0
filemode = false
bare = false

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository

Binary file not shown.

View File

@ -0,0 +1,2 @@
x<EFBFBD>U<EFBFBD><EFBFBD>
<EFBFBD>0<10>=<17>cEH<45><48>?<3F>Ako><3E>xRi<><69><EFBFBD><EFBFBD>J<1A><><EFBFBD><EFBFBD>&j<>=-3;<3B>N޴9<DEB4><39><EFBFBD>`<60>t<EFBFBD>܄D<DC84>YѨ|Zga<67>'<27><>ka<6B><61>Ņ+<2B><><EFBFBD>MU$(jn0<6E><30>~<<3C>x<EFBFBD>hT <09>l <0C>X<EFBFBD><58><EFBFBD><EFBFBD>j([2<>JcD<><44>Wr<57>q<EFBFBD>>qc3<63>R<EFBFBD><04>:;Ǜ_<C79B>H{3<1A><><EFBFBD>t<EFBFBD><74>G*<2A><>؂<EFBFBD>V1<56><31><EFBFBD>Y<EFBFBD><13><>]x<><78>jE{Ǡ:<3A><17><>/<2F>{<7B>Ӣ? <20><><EFBFBD><EFBFBD> =<3D>]<5D>

View File

@ -0,0 +1,2 @@
x<EFBFBD>U<EFBFBD>1N<EFBFBD>@ D<><44><EFBFBD>Ô <20>(_<>tT<74>"<07>N<EFBFBD><04><>u<EFBFBD><75>~N<>&<10>=<3D>f<EFBFBD><0F><>ܞo:E<> cL<63>m}<7D>6,<2C><>Q|<7C>U b<>+ <09><>L<EFBFBD>!4FJc<4A><63>
^h<><68><EFBFBD>w<EFBFBD><77>٢$

View File

@ -0,0 +1,2 @@
x<EFBFBD>5<EFBFBD>A
<EFBFBD>0]z<><7A><EFBFBD>F*u<>օ<17> <0B><>k<12><><EFBFBD><EFBFBD>P<EFBFBD><50>Zw<5A><77>0C<30><01><>rx<72><78><EFBFBD>Rqj<71>XB<58>pLT[<08><>we <09>ana]

View File

@ -0,0 +1,2 @@
x<EFBFBD>M<EFBFBD>=
<EFBFBD>0 @a<><61>"<10><><EFBFBD>g<EFBFBD>(5<><35><EFBFBD><15><>W<EFBFBD>\|O<><4F>oq<>K<15><02>:s+T<>‘S%<25>#<23><><EFBFBD>s<EFBFBD><73>|<7C><><EFBFBD>mk<6D><6B><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD>d<EFBFBD>onj

View File

@ -0,0 +1,2 @@
x<EFBFBD>]<5D>A<0E>0D]<5D>p<EFBFBD>cR 1";n<>JY(<28><04>)<29>ƻ<>V<EFBFBD><56>_<EFBFBD><5F><EFBFBD>̟<EFBFBD>m<EFBFBD>#
w<EFBFBD>E;<3B> q<>ʖ<EFBFBD><CA96>&u<><75>Ȼ?<3F><><EFBFBD><EFBFBD><0F>he<68><65>B<EFBFBD>J<EFBFBD> f<><66>.

View File

@ -0,0 +1,2 @@
x<EFBFBD>5<EFBFBD>A
<EFBFBD>0]r<><72><EFBFBD>F*<2A>'p<><05>i<><69><14>|M~h<><68><05><>a`<60>v<EFBFBD><16><><EFBFBD><EFBFBD><EFBFBD>c<EFBFBD>+K<>~<7E>2N<13><57>]<5D>:B<06><><EFBFBD>m<EFBFBD><6D>w<>;<3B><><EFBFBD><EFBFBD>nk<>y<EFBFBD><79><EFBFBD>;<3B><>]<15>dDY<44><59>\4<><EFBFBD>EfB<66><42>51<>

View File

@ -0,0 +1,2 @@
x<EFBFBD>M<EFBFBD>;
<EFBFBD>0@<40><>b/<2F>h>$[z<>$<24><>A+x|<7C><>v<EFBFBD><76>W<EFBFBD><57><12><> Nh<4E><01><56><D29A>ޕ<EFBFBD>E6ˮH`<60>l<EFBFBD><6C>L<EFBFBD><4C><EFBFBD><06><>4<EFBFBD>1l<31>~<7E><>of<17><>,<1D>>j^ t<1F>

View File

@ -0,0 +1 @@
a3de24d2748d8aff1eb5d785d7a08b0aaa46d76b

View File

@ -0,0 +1 @@
a3de24d2748d8aff1eb5d785d7a08b0aaa46d76b

View File

@ -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")
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())
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
View 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