Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symlinkTargetNameNoExt: Fall back on regular hashing for regular files. #40

Closed
eigengrau opened this issue May 31, 2015 · 4 comments
Closed
Assignees
Milestone

Comments

@eigengrau
Copy link

I was trying to set up TMSU for use within a git-annex repository, and was delighted to see the symlinkTargetName{,NoExt} option exist. However, it seems that when a regular (non-symlinked) file is tagged, tmsu will still use the name as the fingerprint (despite what the option name indicates). Would it be reasonable to fall back to a regular hash for non-symlinked files? Perhaps by specifying the desired digest in a setting, such as symlinkTargetNameNoExt,dynamic:SHA1?

In the best case, tmsu could also fall-back to its regular behavior when the file is a symlink, but the target name is not “special”. If the config option is meant to target git-annex interoperability, git-annexes known key formats could be used as a pattern against which to match; alternatively, it could be checked whether the symlink goes to […]/.git/annex. Or, for a more generic solution, maybe a config option specifying a regular expression might be viable?

Thanks for making TMSU!

@oniony
Copy link
Owner

oniony commented Jun 1, 2015

The symlinkTargetName and symlinkTargetNameNoExt were added at the request of another user who was trying to use TMSU with Git Annex.

Yes it would be possible to fall back to regular hashing in the case of regular files but as you have expressed this would be somewhat hard to configure with the current set-up. One solution is the comma-seperated list of preferences as you proposed; another would be to split out the configuration of the hash algorithm for each type of file. Already TMSU allows files and directories to be configured separately so perhaps this could be extended to allow symbolic links to be separately configured?

@oniony
Copy link
Owner

oniony commented Jun 1, 2015

In the best case, tmsu could also fall-back to its regular behavior when the file is a symlink, but the target name is not “special”.

This would be a lot more complex to implement and configure but I will have a think about how it could work.

@oniony oniony added this to the 0.6.0 milestone Nov 23, 2015
@oniony oniony self-assigned this Nov 23, 2015
@oniony oniony modified the milestones: 0.6.0, 0.7.0 Nov 23, 2015
oniony added a commit that referenced this issue Nov 25, 2015
Added 'symlinkFingerprintAlgorithm' setting with possible values of
'none', 'follow', 'targetName' and 'targetNameNoExt'.
Added schema upgrade logic for converting existing settings.
@oniony
Copy link
Owner

oniony commented Nov 25, 2015

So what I've done is to:

  1. Remove support for the symlinkTargetName and symlinkTargetNameNoExt values of the fileFingerprintAlgorithm setting.
  2. Added a new setting called symlinkFingerprintAlgorithm with the following possible values:
    • none -- use empty fingerprints
    • follow -- use the fingerprint of the target file (default)
    • targetName -- use the target file's name
    • targetNameNoExt -- use the target file's name with the extension removed
  3. Added automatic upgrade logic to populate symlinkFingerprintAlgorithm where fileFingerprintAlgorithm is currently symlinkTargetName or symlinkTargetNameNoExt. The only thing to note with this is that it will also then delete the fileFingerprintAlgorithm setting such that the default will be used for regular files.
  4. Updated the wiki.

@eigengrau
Copy link
Author

This makes the symlink handling more consistent! Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants