From 8f9d480076b1f8f2a404474f067cc2ac451f7d9e Mon Sep 17 00:00:00 2001 From: kyle Date: Thu, 5 Mar 2020 17:41:11 +0000 Subject: [PATCH 1/3] annex.dotfiles override --- ...ithout_persistent_configuration__63__.mdwn | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__.mdwn diff --git a/doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__.mdwn b/doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__.mdwn new file mode 100644 index 0000000000..9dba66be4a --- /dev/null +++ b/doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__.mdwn @@ -0,0 +1,83 @@ +In DataLad, there are some dotfiles that we want to annex +(e.g. `.datalad/metadata/objects/*`), so we need to set +`annex.dotfiles=true`. Ideally that would be in effect for annex +commands that DataLad executes without setting `annex.dotfiles=true` +in the repo. DataLad configuring `annex.dotfiles` in the repo seems +problematic because the change in behavior would be surprising to +users that call `git annex add` directly. And more generally, DataLad +should be able to operate in existing git(-annex) repos without +changing configuration values in the background. + +That reasoning leads to using `-c annex.dotfiles=true` in our calls to +git-annex. By doing that combined with `--force-large`, we can make +`git annex add` send a dotfile to the annex. However, if the file is +later unlocked, it switches to being store in git, presumably when the +clean filter runs. The script below provides a concrete example of +this when running on an unlocked adjusted branch. + +So, I think this is expected behavior. `annex.dotfiles=true` is no +longer in effect when the clean filter runs, and the dotfile goes into +git instead. The only way I can think of to work around this +annex->git conversion is to set `annex.dotfiles=true` in the repo. +But, as I mentioned in the first paragraph, I'm hoping to avoid that. +Is there another solution that I'm overlooking? + + +[[!format sh """ +#!/bin/sh + +set -eux + +cd "$(mktemp -d --tmpdir gx-XXXXXXX)" + +echo $(git annex version --raw) +git init +git annex init +git commit --allow-empty -mc0 +git annex adjust --unlock + +echo one >.dot +git annex add -c annex.dotfiles=true --force-large .dot +git commit -mdot +git diff +"""]] + +``` ++ mktemp -d --tmpdir gx-XXXXXXX ++ cd /tmp/gx-dVCRKik ++ git annex version --raw ++ echo 8.20200226 +8.20200226 ++ git init +Initialized empty Git repository in /tmp/gx-dVCRKik/.git/ ++ git annex init +init (scanning for unlocked files...) +ok +(recording state in git...) ++ git commit --allow-empty -mc0 +[master (root-commit) 594fa63] c0 ++ git annex adjust --unlock +adjust +Switched to branch 'adjusted/master(unlocked)' +ok ++ echo one ++ git annex add -c annex.dotfiles=true --force-large .dot +add .dot +ok +(recording state in git...) ++ git commit -mdot +[adjusted/master(unlocked) 826ad5d] dot + 1 file changed, 1 insertion(+) + create mode 100644 .dot ++ git diff +diff --git a/.dot b/.dot +index 9a70ce7..5626abf 100644 +--- a/.dot ++++ b/.dot +@@ -1 +1 @@ +-/annex/objects/SHA256E-s4--2c8b08da5ce60398e1f19af0e5dccc744df274b826abe585eaba68c525434806.dot ++one +``` + +[[!meta author=kyle]] +[[!tag projects/datalad]] From ae61ee34c0d133c277024d9698e530205cde231b Mon Sep 17 00:00:00 2001 From: Ilya_Shlyakhter Date: Thu, 5 Mar 2020 19:10:16 +0000 Subject: [PATCH 2/3] Added a comment: atomic/transactional upgrades --- .../comment_1_ef44b98740b33d6a7cab0cc5caf4be15._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/bugs/upgrade_to_V8_fails/comment_1_ef44b98740b33d6a7cab0cc5caf4be15._comment diff --git a/doc/bugs/upgrade_to_V8_fails/comment_1_ef44b98740b33d6a7cab0cc5caf4be15._comment b/doc/bugs/upgrade_to_V8_fails/comment_1_ef44b98740b33d6a7cab0cc5caf4be15._comment new file mode 100644 index 0000000000..895a649d77 --- /dev/null +++ b/doc/bugs/upgrade_to_V8_fails/comment_1_ef44b98740b33d6a7cab0cc5caf4be15._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="Ilya_Shlyakhter" + avatar="http://cdn.libravatar.org/avatar/1647044369aa7747829c38b9dcc84df0" + subject="atomic/transactional upgrades" + date="2020-03-05T19:10:16Z" + content=""" +Related question: is [[git-annex-upgrade]] atomic, in the sense of restoring old state if an upgrade fails? +"""]] From ebd0447dc25d9b4879de1131398a2de9d6a3fd1d Mon Sep 17 00:00:00 2001 From: Ilya_Shlyakhter Date: Thu, 5 Mar 2020 19:31:37 +0000 Subject: [PATCH 3/3] Added a comment: annexing only large dotfiles --- .../comment_1_b215a9ab1c37688cc22dbe4ec63347ad._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__/comment_1_b215a9ab1c37688cc22dbe4ec63347ad._comment diff --git a/doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__/comment_1_b215a9ab1c37688cc22dbe4ec63347ad._comment b/doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__/comment_1_b215a9ab1c37688cc22dbe4ec63347ad._comment new file mode 100644 index 0000000000..0374f30914 --- /dev/null +++ b/doc/forum/Get_annex.dotfiles__61__true_behavior_without_persistent_configuration__63__/comment_1_b215a9ab1c37688cc22dbe4ec63347ad._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="Ilya_Shlyakhter" + avatar="http://cdn.libravatar.org/avatar/1647044369aa7747829c38b9dcc84df0" + subject="annexing only large dotfiles" + date="2020-03-05T19:31:37Z" + content=""" +Maybe, set `annex.dotfiles=true`, then in `.gitattributes` at repo root put `.* annex.largefiles=nothing`, and in .gitattributes under .datalad put `.* annex.largefiles=anything`? +"""]]