-
Notifications
You must be signed in to change notification settings - Fork 429
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
New feature: add a new policy for fixing clashes #810
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor changes requested, code looks good. Could we also document this in the README.md, if possible?
type FixClashesMode uint8 | ||
|
||
const ( | ||
FixClashesRename FixClashesMode = iota |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this 1 + iota
, so that when we can catch the
zero/uninitialized value, and reject it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done @ 9d078d9
|
||
func autoTrashClashes(g *Commands, clashes []*Change) error { | ||
for _, c := range clashes { | ||
// make c.Op() == OpDelete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just update this comment to
// Let's coerce this change to a deletion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done @ f7a68ea
} | ||
|
||
if g.opts.canPrompt() { | ||
g.log.Logln("Some clashes found, trashes them ?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace
trashes them ?
with
trash them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done @ 04dcf5e
Hello there @iblis17, thank you for the PR and welcome to drive! This is awesome, your first Go code looks great! |
|
Dope! One last thing, let's squash all these commits into one and then I'll merge it in. Just in $ git rebase -i head~6 and when prompted for the message, let's set it to something like this clashes: add trash and no-prompt to deal with clashes
Added trash and no-prompt to clash. The default is `rename` but
in some cases it is convenient to trash duplicates. This PR makes
that possible. Thank you! |
Added trash and no-prompt to clash. The default is `rename` but in some cases it is convenient to trash duplicates. This PR makes that possible. New cli option for `drive clashes`: $ drive clashes -fix -fix-mode trash
283066c
to
4178a6d
Compare
Rebased ! |
Thank you, LGTM! |
This change is confusing when using "drive clashes -fix -fix-mode trash [remote folder]" since is trashes both files. When doing so, I expected the newest file to be kept. Deleting both files certainly fixed the clash, but so would "rm -Rf" 😉. |
@jpambrun Trashing them all and re-pushing is just my habit. Feel free to rename it and add the feature you want. Maybe I should notice user that it will trash both of new and old files on |
What is the purpose of this? It does not make a lot of sense. Especially since in my case, I had no local copy. |
Those are just different use cases. And I think there are no correct one or wrong one. If you really want that feature and do not want to write code, please open a feature request. I can push it into my TODO stack... Maybe I will make it at some Sunday afternoon. |
I'm sorry if that came out a bit harsh; that was not the intent. I don't feel very strongly about this issue/feature and the proposed changes make it clear that it is a destructive operation. Personally, I wouldn't make any destructive operations the default behavior for this type of application. I wanted to fix clashes and I issued "drive clashes -fix -fix-mode trash" on in a clean ~/gdrive folder thinking it would fix clashes based on the documentation. Anyway, I appreciate your contribution. |
Hearing a different need is not a bad thing, and it's the source of innovation of open source. :) I will try to add a new policy called |
Having different needs is not the issue I was trying to raise. The issue is
with the expectations that my data is not going to be lost by "fixing"
clashes. Deleting them all is not what a typical user would call a "fix".
So basically,yes, having different expectations when it comes to the
potential lost of data is a bad thing.
The better solution would be to call your fix-mode trash-all and the one I
proposed trash.
The is the safest, clearest way to include your feature.
…On Tue, Dec 20, 2016 at 9:16 AM Iblis Lin ***@***.***> wrote:
Personally, I wouldn't make any destructive operations the default
behavior for this type of application. I wanted to fix clashes and I issued
"drive clashes -fix -fix-mode trash" on in a clean ~/gdrive folder thinking
it would fix clashes based on the documentation.
Hearing a different need is not a bad thing, and it's the source of
innovation of open source. :)
I will try to add a new policy called trash-old (or something like that),
if I get free time.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#810 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAr2MGzdbtP6vuLQf9F8fT_E2tlIkWCRks5rJ-NLgaJpZM4LMeGc>
.
|
ok, I got it. ( |
Hi,
I add an new command line option for
drive clashes
. Let user switch the policy between rename (the original) and trash. When I encounter the clashes, I always trash it then re-push again. Hope this also useful for other user. And the simple usage is documented in the commit message.To be honest, I never wrote any line of golang code before I decide to add this feature. I just browsed the golang tutorial at the last Sunday afternoon. Please read my code carefully and comment. :)