Merge branch 'master' of ssh://git-annex.branchable.com into master
This commit is contained in:
commit
8c9a38a91f
3 changed files with 66 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
[[!comment format=mdwn
|
||||
username="kyle"
|
||||
avatar="http://cdn.libravatar.org/avatar/7d6e85cde1422ad60607c87fa87c63f3"
|
||||
subject="comment 7"
|
||||
date="2020-10-05T17:42:23Z"
|
||||
content="""
|
||||
> - find a way for `find --unlocked` without invoking `git-annex`.
|
||||
|
||||
Assuming you're interested in finding just the v6+ pointer files,
|
||||
instead of also finding the uncommitted type changes for v5 unlocked
|
||||
files, perhaps you could use something like this
|
||||
|
||||
[[!format python \"\"\"
|
||||
import subprocess as sp
|
||||
|
||||
p_ls = sp.Popen([\"git\", \"ls-files\", \"--stage\"], stdout=sp.PIPE)
|
||||
p_cat = sp.Popen([\"git\", \"cat-file\", \"--batch\"], stdin=sp.PIPE, stdout=sp.PIPE)
|
||||
with p_ls:
|
||||
with p_cat:
|
||||
for line in p_ls.stdout:
|
||||
info, fname = line.strip().split(b\"\t\")
|
||||
mode, objid = info.split(b\" \")[:2]
|
||||
if mode != b\"100644\":
|
||||
continue
|
||||
p_cat.stdin.write(objid + b\"\n\")
|
||||
p_cat.stdin.flush()
|
||||
out = p_cat.stdout.readline()
|
||||
_, objtype, size = out.split()
|
||||
size = int(size)
|
||||
if size > 0:
|
||||
content = p_cat.stdout.read(size)
|
||||
if content.startswith(b\"/annex/objects/\"):
|
||||
print(fname.decode())
|
||||
p_cat.stdout.readline()
|
||||
\"\"\"]]
|
||||
|
||||
"""]]
|
|
@ -0,0 +1,20 @@
|
|||
[[!comment format=mdwn
|
||||
username="yarikoptic"
|
||||
avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
|
||||
subject="comment 8"
|
||||
date="2020-10-05T18:02:48Z"
|
||||
content="""
|
||||
Thank you Kyle! I came up with
|
||||
|
||||
```shell
|
||||
unlocked=( `git grep -l -a --no-textconv --cached '^/annex/objects/' || :` )
|
||||
if [ \"${#unlocked[*]}\" -ge 1 ]; then
|
||||
error \"Found ${#unlocked[*]} unlocked files. Cannot do: ${unlocked[*]}\" 2
|
||||
fi
|
||||
```
|
||||
|
||||
do you think it would miss something?
|
||||
|
||||
Here is my complete script ATM (didn't try in \"production\" yet, switched to other tasks for now but it is ready, also does some testing of operation at the end, so must not be applied as is to existing repos without commenting that out): http://www.onerussian.com/tmp/downgrade-annex
|
||||
|
||||
"""]]
|
|
@ -0,0 +1,9 @@
|
|||
[[!comment format=mdwn
|
||||
username="kyle"
|
||||
avatar="http://cdn.libravatar.org/avatar/7d6e85cde1422ad60607c87fa87c63f3"
|
||||
subject="comment 9"
|
||||
date="2020-10-05T18:09:03Z"
|
||||
content="""
|
||||
Ah, I didn't think of using `git grep` for this. I think that's much
|
||||
better than my suggestion.
|
||||
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue