From c12e2bcf8b583dc226b6c0189d577607d6506260 Mon Sep 17 00:00:00 2001 From: anarcat Date: Thu, 25 Oct 2018 17:30:30 +0000 Subject: [PATCH 1/3] Added a comment: try the --known argument --- .../comment_1_6bf093f228353130e80e7a30bcf0075d._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/forum/Wishlist__58___automatic_reinject/comment_1_6bf093f228353130e80e7a30bcf0075d._comment diff --git a/doc/forum/Wishlist__58___automatic_reinject/comment_1_6bf093f228353130e80e7a30bcf0075d._comment b/doc/forum/Wishlist__58___automatic_reinject/comment_1_6bf093f228353130e80e7a30bcf0075d._comment new file mode 100644 index 0000000000..3b13217790 --- /dev/null +++ b/doc/forum/Wishlist__58___automatic_reinject/comment_1_6bf093f228353130e80e7a30bcf0075d._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="anarcat" + avatar="http://cdn.libravatar.org/avatar/4ad594c1e13211c1ad9edb81ce5110b7" + subject="try the --known argument" + date="2018-10-25T17:30:29Z" + content=""" +This works now, with the reinject `--known` argument. +"""]] From 2243d62d05f8996739ab1189b9b52f6a19e0840f Mon Sep 17 00:00:00 2001 From: anarcat Date: Thu, 25 Oct 2018 17:36:40 +0000 Subject: [PATCH 2/3] issues with reinject comparable with import --- .../copy_instead_of_rename_on_reinject.mdwn | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 doc/todo/copy_instead_of_rename_on_reinject.mdwn diff --git a/doc/todo/copy_instead_of_rename_on_reinject.mdwn b/doc/todo/copy_instead_of_rename_on_reinject.mdwn new file mode 100644 index 0000000000..e32752e029 --- /dev/null +++ b/doc/todo/copy_instead_of_rename_on_reinject.mdwn @@ -0,0 +1,23 @@ +The same way that [[git-annex-import]] has a `--duplicate` option, +there should be a way to reinject content without dropping the +original file. + +My use case is that I had imported content in the wrong git-annex +repository, by mistake. Unaware of my mistake, I moved the files (now +symlinks) to the proper git-annex repo, where I added them and where +they (obviously) were broken. So I tried to fix that with reinject: + + $ git annex reinject --known ~/mp3/.git/annex/objects/xJ/K5/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac + reinject /home/anarcat/mp3/.git/annex/objects/xJ/K5/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac + git-annex: /home/anarcat/mp3/.git/annex/objects/xJ/K5/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac: rename: permission denied (Permission denied) + failed + (recording state in git...) + git-annex: reinject: 1 failed + +It *almost* worked but failed because it cannot rename the git-annex +file on the other side. Other than making reinject work against a +fellow git-annex repository, I think this would be useful to avoid +deleting files which might surprise users... I suggest using a logic +similar to [[git-annex-import]] for consistency reasons. + +Thanks! -- [[anarcat]] From 73bcd7fdd4adf81d20e50a1ac2a4789c6714623a Mon Sep 17 00:00:00 2001 From: anarcat Date: Thu, 25 Oct 2018 17:48:07 +0000 Subject: [PATCH 3/3] add workaround --- .../copy_instead_of_rename_on_reinject.mdwn | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/todo/copy_instead_of_rename_on_reinject.mdwn b/doc/todo/copy_instead_of_rename_on_reinject.mdwn index e32752e029..1aa3274b52 100644 --- a/doc/todo/copy_instead_of_rename_on_reinject.mdwn +++ b/doc/todo/copy_instead_of_rename_on_reinject.mdwn @@ -15,9 +15,20 @@ they (obviously) were broken. So I tried to fix that with reinject: git-annex: reinject: 1 failed It *almost* worked but failed because it cannot rename the git-annex -file on the other side. Other than making reinject work against a -fellow git-annex repository, I think this would be useful to avoid -deleting files which might surprise users... I suggest using a logic -similar to [[git-annex-import]] for consistency reasons. +file on the other side. But worse, copying the file by hand does not +work either: + + $ LANG=C cp ~/mp3/.git/annex/objects/xJ/K5/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac ../../../.git/annex/objects/xJ/K5/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac + cp: cannot create regular file '../../../.git/annex/objects/xJ/K5/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac/SHA256E-s16309242--41eb375ac760bf8542bae1ec2bcfce9269f78302820bcc88904e76bab473181c.flac': Permission denied + +... obviously because the directory already exists and is not +writable. The workaround is to create those directories if missing +(`mkdir -p`) or change the mode if present (`chmod u+w`), then run +`git-annex-fsck` which will fix those modes. + +Other than making reinject work against a fellow git-annex repository, +I think this would be useful to avoid deleting files which might +surprise users... I suggest using a logic similar to +[[git-annex-import]] for consistency reasons. Thanks! -- [[anarcat]]