todo/Metadata changes are not reflected in a viewgit-annexhttp://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/git-annexikiwiki2023-02-14T18:00:48Zcomment 1http://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_1_5c3a0d8ec7b1da69b0d81aa4acc0c75b/joey2015-07-20T17:49:31Z2015-07-20T17:45:13Z
<p>This might be worth adding. But, one of the ways views can be used
is to use file operations to adjust the metadata that is being viewed.</p>
<p>So, when you delete a file from a view, and git commit, git-annex
will remove the metadata that had made the file be in the view.</p>
<p>And, if you copy or move a file in a view to a different subdirectory,
and add and git commit the change, the metadata will be updated to
update the metadata to reflect the files new location.</p>
<p>As such, I see this as a wishlist todo item at best, and will move it from
the bugs list to the todo list.</p>
👍 +1 for updating the view when committinghttp://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_2_74597dc57b426adccfa5aab456e499d2/nobodyinperson2023-02-03T13:25:22Z2023-02-03T13:25:21Z
<p>I'd also love to see the current view being updated to reflect the new metadata after committing. Workaround is currently to <code>git switch</code> back to the main branch and re-make the view with <code>git annex view bla='*'</code>.</p>
<p>BTW views are <strong>really</strong> cool, what an awesome idea, joey!</p>
comment 3http://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_3_39d7b5588595067332909c53b232c413/joey2023-02-08T19:37:36Z2023-02-08T16:29:36Z
<p>Another time it would make sense to update the view is after git pull from
elsewhere, which could change the metadata, or change the files present in
the parent branch. I think it would make sense for <code>git-annex sync</code> run in
a view to update the view after pulling.</p>
<p>Updating the branch after <code>git-annex metadata</code> is run locally is of course
also possible. There is a similarity to updating an adjusted branch after
get/drop. Which has a config annex.adjustedbranchrefresh to tune how
frequently to update the branch. Or the user could just run
<code>git-annex sync --no-pull --no-push</code> themselves.</p>
<p>There is probably a lot of scope for optimisation in updating the view
branch, that might be able to get it reasonably quick.
I have not fully thought through it, but basically diffing from the old
parent branch to the new parent to find files that have changed, and
adding/removing those from the view. And also diffing from the old
git-annex branch tree to the new one to get changes to metadata logs,
parsing those and using changes to metadata to also move/delete/add
files to the view branch.</p>
<p>But it would be ok to start with a simple, slow implementation.</p>
comment 4http://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_4_6ab0e38d8be8a70d501108f207d41d82/joey2023-02-08T19:37:36Z2023-02-08T19:32:34Z
<p><code>git-annex sync</code> when in a view branch will now update it.</p>
<p>Leaving this open for optimising it.</p>
<p>Also because of this problem:</p>
<pre><code>joey@darkstar:~/tmp/m#master(author=_)>git-annex sync
commit
On branch views/master(author=_)
nothing to commit, working tree clean
ok
merge synced/master
fatal: refusing to merge unrelated histories
failed
</code></pre>
<p>Looks like it should not be trying to merge the synced/master
branch into the view branch. But, this makes me wonder, does the master branch
get updated with new files pulled from remotes? If not, the view branch
won't be updated to have them either.</p>
<p>Also, I think that it may try to import trees from importree special remotes,
into the view branch. Perhaps those should also get imported but merged into
the master branch...</p>
`git annex sync` when in viewhttp://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_5_b1b381c560fd81f372fc393ec5d63d8d/nobodyinperson2023-02-08T20:17:12Z2023-02-08T20:17:12Z
Right, git refusing to merge unrelated histories is something I also bumped into while developing <code>thunar-plugins</code>. There I worked around it by having the <em>Synchronize</em> menu item do <code>git add -A;git commit -m ...;git annex sync --only-annex</code>, which works fine.
comment 6http://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_6_9d3d9877e8581f986257dd3d495a8eab/joey2023-02-10T19:51:46Z2023-02-10T19:49:51Z
<p>I've now fixed <code>git-annex sync</code>'s other behavior when ran in a view branch
to be acceptable.</p>
<p>I'm going to close this as fixed. But have opened
<a href="http://git-annex.branchable.com/todo/faster_incremental_update_of_view_branch_by_git-annex_sync/">faster incremental update of view branch by git-annex sync</a> as the
performance could be improved.</p>
👍 This made it easier for the Thunar plugin!http://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_7_f97d171fdd715d984e43c1a8139bb8ae/nobodyinperson2023-02-14T09:35:32Z2023-02-14T09:35:32Z
<a href="https://gitlab.com/nobodyinperson/thunar-plugins"><code>thunar-plugins</code></a> now detect git annex' support for this (checking if <code>view</code> appears in <code>git annex help sync</code>, which it didn't before) and does <code>git annex sync</code> instead of the <code>git add -A;git commit;git annex sync --only-annex</code> workaround in that case. Very nice, joey!
comment 8http://git-annex.branchable.com/todo/Metadata_changes_are_not_reflected_in_a_view/comment_8_e10e8e6daf155fc493454f1d0d8595a8/joey2023-02-14T18:00:48Z2023-02-14T16:17:05Z
<p>I'd recommend not relying on the <code>git-annex help sync</code> to detect this,
since man pages may not be available. Look for '?=' in
<code>git-annex view --help</code></p>