Prevent insertion of duplicate keys

Assigned to
2 years ago
1 year, 4 months ago
No labels applied.

~whynothugo 1 year, 6 months ago

Affects git-credential-himitsu, since git uses its credential helpers to inserts any keys that it uses back into the store, creating a new duplicate on each run.

I would like to try an address this. Does simply yielding the same result that is returned for non-duplicates sound good, or would you prefer a dedicated error response?

~sircmpwn 1 year, 6 months ago

Probably needs an error, since we have to assume


are the same key

~whynothugo 1 year, 6 months ago

What would the mechanic to update an existing key? Could we have a flag to insert-or-update?

~sircmpwn 1 year, 6 months ago

A flag would probably be good, yeah.

~whynothugo 1 year, 4 months ago

I've a WIP changes for this here, but am missing the most important parts in exec_add.


Some early questions before proceeding:

  • For a duplicate entry, should I add a new error type to cmderror (e.g.: duplicate_entry)?
  • When the update flag is provided, is deleted-then-insert okay? I think it's much simpler than implementing rewriting at a lower layer.
  • Should we prompt users to confirm updates?
  • In case the -u flag (update) is provided, and no matching entry exists: should I fail, or simply proceed with insertion?

~sircmpwn 1 year, 4 months ago




fail, unless -au are both provided

~whynothugo 1 year, 4 months ago

Oh, so I guess it should be possible to specify -u without specifying -a. I had not accounted for that.

Register here or Log in to comment, or comment via email.