projects/repronim/bugs-done/get fails to place v7 unlocked file content into the file tree in v7 in repo with detached HEADyohhttp://git-annex.branchable.com/projects/repronim/bugs-done/get_fails_to_place_v7_unlocked_file_content_into_the_file_tree_in_v7_in_repo_with_detached_HEAD/git-annexikiwiki2023-01-05T17:30:31Zcomment 1http://git-annex.branchable.com/projects/repronim/bugs-done/get_fails_to_place_v7_unlocked_file_content_into_the_file_tree_in_v7_in_repo_with_detached_HEAD/comment_1_a377e26b2eb75956c9de9beed0534cc2/yarikoptic2023-01-05T17:30:31Z2019-07-11T20:15:45Z
further debugging showed that the bug appears if <code>annex upgrade</code> is done in detached HEAD mode.
a reduced scripthttp://git-annex.branchable.com/projects/repronim/bugs-done/get_fails_to_place_v7_unlocked_file_content_into_the_file_tree_in_v7_in_repo_with_detached_HEAD/comment_2_d1ae8ccbfc3a9dd90cc03e68d5a78071/kyle2023-01-05T17:30:31Z2019-07-11T20:19:23Z
<pre><code>#!/bin/sh
cd $(mktemp -dt gx-XXXXXXX)
git init a
cd a
git annex init --version=7
echo foo >foo
git add foo
git commit -mfoo
cd ..
git clone a b
cd b
git checkout HEAD^{}
git annex init
git annex upgrade
git annex get foo
cat foo
</code></pre>
<p>Output:</p>
<pre><code>Initialized empty Git repository in /tmp/gx-RqdQyBF/a/.git/
init ok
(recording state in git...)
(recording state in git...)
[master (root-commit) 2b5f739] foo
1 file changed, 1 insertion(+)
create mode 100644 foo
Cloning into 'b'...
done.
Note: checking out 'HEAD^{}'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 2b5f739 foo
init (merging origin/git-annex into git-annex...)
ok
(recording state in git...)
upgrade (v5 to v6...) (v6 to v7...) ok
get foo (from origin...) (checksum...) ok
(recording state in git...)
/annex/objects/SHA256E-s4--b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
</code></pre>
comment 3http://git-annex.branchable.com/projects/repronim/bugs-done/get_fails_to_place_v7_unlocked_file_content_into_the_file_tree_in_v7_in_repo_with_detached_HEAD/comment_3_cd7cc008c3d37caa76416bd2452da90d/joey2023-01-05T17:30:31Z2019-07-16T16:13:49Z
<p>I notice that the keys database is not populated in the clone.</p>
<p>Also, the upgrade does not display "scanning for unlocked files".
And in Annex.WorkTree, we can see why:</p>
<pre><code>scanUnlockedFiles = whenM (isJust <$> inRepo Git.Branch.current) $ do
showSideAction "scanning for unlocked files"
</code></pre>
<p>There is no current git branch in this case.</p>
<p>That check was added in <a href="http://source.git-annex.branchable.com/?p=source.git;a=commitdiff;h=9b995954731e05727d77c7bff487af10da9cb4b9">9b995954731e05727d77c7bff487af10da9cb4b9</a>
"only do scan when there's a branch, not in freshly created new repo"</p>
<p>Since it does a ls-tree of HEAD, what it really ought to check for is that
HEAD is set, which it's not in a fresh new repo. Done.</p>