Repository navigation
Add new command git lfs dedup for file system level de-duplication. - #3753
Conversation
0393dd3 to
dff4c81
Compare
bk2204
left a comment
There was a problem hiding this comment.
Overall, I think this is a great start. I've left some comments about directions I think we could go.
I'd also like to see some tests for this functionality in our integration test suite (say, a file called t-dedup.sh) that demonstrate success on macOS as well as an error case when we have modified files. If you implement the --test option, we should verify additionally that it succeeds on macOS and fails on Windows (and do something sane or skip it on Linux).
|
|
||
| func init() { | ||
| RegisterCommand("dedup", dedupCommand, func(cmd *cobra.Command) { | ||
| }) |
There was a problem hiding this comment.
Most file systems on Linux are not going to support copy-on-write in the way we want them to for this feature. It would be nice if we had a --test option that would test using the LFS temporary directory and simply exit successfully or unsuccessfully depending on whether this feature could actually be supported on the system.
That would prevent the current status quo where someone tries to use this function on Linux, and then it errors out on the first file. It would also let users distinguish between the case that the feature is not really supported on their system and the case that the feature is functional but failed.
git lfs dedup for file system level de-duplication.git lfs dedup for file system level de-duplication.
|
@bk2204 Sorry for late reply, I'm start update this PR. Thank you for your detailed feedback. Please wait until update finished. |
aac820c to
06f3023
Compare
d33084d to
3528654
Compare
ca02531 to
f0de50e
Compare
Implements and closes git-lfs#3740.
git lfs dedup for file system level de-duplication.git lfs dedup for file system level de-duplication.
|
Updated. Could you review again? |
bk2204
left a comment
There was a problem hiding this comment.
This looks good. Thanks for working on it.
|
|
||
| # DO | ||
| result=$(git lfs dedup 2>&1) && true | ||
| if ( echo $result | grep "This system does not support deduplication." ); then |
There was a problem hiding this comment.
I like this approach. It makes it really easy for this to work on any system that supports it without needing to hard-code a list of systems or file systems.
Since the "git lfs dedup" command was introduced in PR git-lfs#3753 it has accepted a --test option, which causes the command to check whether the current operating system and file system support the copy-on-write functionality the command uses to create clones or reflinks of Git LFS files. However, this option is not documented in our git-lfs-dedup(1) manual page, so we now add an entry for it into the list of options supported by the command.
Since the "git lfs dedup" command was introduced in PR git-lfs#3753 it has accepted a --test option, which causes the command to check whether the current operating system and file system support the copy-on-write functionality the command uses to create clones or reflinks of Git LFS files. However, this option is not documented in our git-lfs-dedup(1) manual page, so we now add an entry for it into the list of options supported by the command.
Since the "git lfs dedup" command was introduced in PR git-lfs#3753 it has accepted a --test option, which causes the command to check whether the current operating system and file system support the copy-on-write functionality the command uses to create clones or reflinks of Git LFS files. However, this option is not documented in our git-lfs-dedup(1) manual page, so we now add an entry for it into the list of options supported by the command.

Implements and closes #3740.
This PR depends #3745 (merged).
Formatted doc is here https://github.com/kazuki-ma/git-lfs/blob/dedup/docs/man/git-lfs-dedup.1.ronn
Request of information
lfs.NewGitScannerwithScanTree("HEAD"). Is it right?canDedupcondition.! git.IsWorkingCopyDirty()Can I skip it?