git-annex/doc/bugs/git-annex-fromkey_broken_on_Windows.mdwn
Joey Hess 4588668a12
fromkey unlocked files support
fromkey: Create an unlocked file when used in an adjusted branch where the
file should be unlocked, or when configured by annex.addunlocked.

There is some overlap with code in Annex.Ingest, however it's not quite the
same because ingesting has a temp file with the content, where here the
content, if any, is in the annex object file. So it eg, makes sense for
Annex.Ingest to copy the execute mode of the content file, but it does not make
sense for fromkey to do that.

Also changed in passing to stage the file in git directly, rather than
using git add. One consequence of that is that if the file is gitignored,
it will still get added, rather than the old behavior:

The following paths are ignored by one of your .gitignore files:
ignored
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"
git-annex: user error (xargs ["-0","git","--git-dir=.git","--work-tree=.","--literal-pathspecs","add","--"] exited 123)

That old behavior was a surprise to me, and so I consider it a bug, and doubt
anyone would have relied on it.

Note that, when on an --hide-missing branch, it is possible to fromkey a key
that is not present (needs --force). The annex link or pointer file still gets
written in this case. It doesn't seem to make any sense not to write it,
because then fromkey would not do anything useful in this case, and this way
the file can be committed and synced to master, and the branch re-adjusted to
hide the new missing file.

This commit was sponsored by Noam Kremen on Patreon.
2021-05-03 11:26:18 -04:00

29 lines
1,004 B
Markdown

Hi Joey,
### Please describe the problem.
`git annex fromkey` on Windows fails with `git-annex: System.PosixCompat.Files.createSymbolicLink: not supported: illegal operation`
I guess it should create a unlocked file instead on Windows.
### What steps will reproduce the problem?
mkdir test
cd test
git init
git annex init test
touch file
git annex add file
git annex sync
git annex fromkey SHA256E-s0--e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 file2
### What version of git-annex are you using? On what operating system?
git version 2.31.1.windows.1 <br>
git annex 8.20210331-g1fb59a63a <br>
Windows 10 Pro 1903 <br>
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes! git-annex is really great and there is nothing else like it.
> [[fixed|done]] by making it create an unlocked file when used on an
> unlocked adjusted branch. --[[Joey]]