The old implementation was misinterpretating the disabled flag and
effectively applying memoization even when explicitly disabled.
The 'or' operator is a short-circuit one; namely, it evaluates the
second argument if and only if the first is False. Therefore the
following conditions caused unexpected side effects:
- memoize.disabled = True, key not yet memoized
Having disabled the memoize function wrapper, the client expects
that no memoization happens. Instead the execution enters the
if clause and store the value into the 'memo' dictionary
- memoize.disabled = True, key memoized
Having disabled the memoize function wrapper, the client expects
that no memoization happens and the function will be evaluated
anyway, whether or not its return value had already been stored in
the 'memo' dictionary by a previous call. On the contrary, the last
statement of wrapper() access the value stored by the last function
execution.
This commit attempts to improve the function readability too.
--force flag can be very dangerous, because it unconditionally
overwrites remote branch - if someone pushed new commits to the remote
repo after you last fetched/pulled, and you do push --force, you will
overwrite his commits without even knowing that you did that. Using
--force-with-lease is much safer because it only overwrites remote
branch when it points to the same commit that you think it points to.
Read more:
https://developer.atlassian.com/blog/2015/04/force-with-lease/
Move them to `rules` sub-directory and import `shells` instead of `and_`
which in turn triggers the `generic_shell` fixture fixing the tests on
Fish Shell.
It works now with no temp file involved, which makes it a lot faster.
Also, `history --merge`, although only supported on Fish Shell 2.2+,
merges the corrected entry back into history. Neat!
Ref #89
Without this change, users who have "rm" aliased to "rm -i"
have to confirm removal of the file after running fuck. This
change allows such users to run fuck without having to do
the superfluous rm confirmation.