You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
git clone sets the timestamps of files to now() (i.e. the time of the clone), which does not reflect their creation or commit times. That way, building a module ZIP from a repo that has not seen any commits for 2 years would result in a module being announced as "brand new". To avoid that, timestamps should be adjusted after cloning and before zipping.
To speed up implementation for that, you can find matching Python code here. Quoting for your convenience:
#!/usr/bin/env python# Bare-bones version. Current directory must be top-level of work tree.# Usage: git-restore-mtime-bare [pathspecs...]# By default update all files# Example: to only update only the README and files in ./doc:# git-restore-mtime-bare README docimportsubprocess, shleximportsys, os.pathfilelist=set()
forpathin (sys.argv[1:] or [os.path.curdir]):
ifos.path.isfile(path) oros.path.islink(path):
filelist.add(os.path.relpath(path))
elifos.path.isdir(path):
forroot, subdirs, filesinos.walk(path):
if'.git'insubdirs:
subdirs.remove('.git')
forfileinfiles:
filelist.add(os.path.relpath(os.path.join(root, file)))
mtime=0gitobj=subprocess.Popen(shlex.split('git whatchanged --pretty=%at'),
stdout=subprocess.PIPE)
forlineingitobj.stdout:
line=line.strip()
ifnotline: continueifline.startswith(':'):
file=line.split('\t')[-1]
iffileinfilelist:
filelist.remove(file)
#print mtime, fileos.utime(file, (mtime, mtime))
else:
mtime=long(line)
# All files done?ifnotfilelist:
break
No worries about performance impact, if the author is to be believed. They state it took 0.27s for the entire Bash repo, and still less than a minute for the entire Linux repo even. So it should not even be noticable for a single Magisk module 🙈
The text was updated successfully, but these errors were encountered:
OK, that's a compromise. I just got irritated by all files having the same timestamp (but then, some devs set it to 1980-01-01 for all their files when zipping the module, which is much worse IMHO).
Maybe filing it as lower-prio nice-to-have then? Having all the details in modules.json (#7) is what I feel most important at the moment (see the index.json next to my modules.json for what I've cobbled together currently for easier access in different places). That said, I'd be curious what your road-map says 😉
In order to save traffic, git clone uses depth=1, which causes us to not get the last committed of each file, so we can only set it as the current commit.
git clone
sets the timestamps of files tonow()
(i.e. the time of the clone), which does not reflect their creation or commit times. That way, building a module ZIP from a repo that has not seen any commits for 2 years would result in a module being announced as "brand new". To avoid that, timestamps should be adjusted after cloning and before zipping.To speed up implementation for that, you can find matching Python code here. Quoting for your convenience:
No worries about performance impact, if the author is to be believed. They state it took 0.27s for the entire Bash repo, and still less than a minute for the entire Linux repo even. So it should not even be noticable for a single Magisk module 🙈
The text was updated successfully, but these errors were encountered: