Skip to content

[BUG] Hard reset to remote branch option doesn't work as expected #625

@boltronics

Description

@boltronics

Describe the bug

Note: Since deleting and re-cloning my local repository in Android Password Store, I am unable to reproduce this bug. Somehow, it seems it had gotten into a bad state, but a fresh clone has worked around the issue. Unfortunately I don't seem to be able to retrieve older logs from adb, so I know this will probably be hard to diagnose.

I have made some test entries in Android Password Store which I wish to revert. I can't do that in the Android app, but I can on my desktop via pass git reset --hard <commit> to an older commit on my master branch, followed by pass git push -f origin master. This can be verified to have worked by performing a fresh clone of the repository and inspecting the commit log.

Then in the Android Password Store app, after pulling the remote changes (ie. "Pull from remote", and not "Push to remote" or "Synchronise repository") and using the Hard reset to remote branch option, I type in "master" as the remote branch and it appears to work, but the password entries that should have been removed still exist.

Steps to reproduce

Steps to reproduce the behavior:

  1. Clone an existing pass store repository in the Android Password Store and create some new test entries. Push them back to the remote.
  2. On the desktop, run pass git pull to download the new entry. Revert the most recent commit with something like pass git reset --hard HEAD^, and then push it to the remote master branch with pass git push -f origin master (adjusting "origin" and "master" as required for your remote configuration).
  3. Create a new fresh clone of the remote repository. eg. git clone ... and cd into the new local repo directory. Run git log and observe the tip of the branch (the master branch in this example). This proves the remote repository is in the desired state.
  4. In Android Password Store, click Pull from remote, and then go to Settings -> Repository -> Local Git config & utilities -> Hard reset to remote branch and type "master" as the branch (in my case at least).
  5. Click "Show commit log" and notice that there are still additional commits past the tip of the the remote branch. Browse the Android Password Store entries and notice that the previously created entries still exist. Closing and re-opening the app doesn't make any difference.

I have also tried resetting the branch on my desktop, adding a new commit and then force pushing that (and pulling on Android), but even then, the "Hard reset to remote branch type" option doesn't work — the commits local only to Android were kept and simply rebased on top (presumably since I have "Rebase on pull" set to avoid a merge commit).

The only work-around I could find was to pass git reset --hard <some commit> && pass git push -f origin master on desktop, then delete the repo on Android and re-add it again.

Expected behavior

From the git man page:

git reset [<mode>] [<commit>]
...
--hard
Resets the index and working tree. Any changes to tracked files in the working tree since are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted.

I expect the test entries I added to be discarded, without having to delete my local clone of the repo and re-clone it again.

Screenshots

No response

Device information

  • Device: Samsung Galaxy S22 Ultra
  • OS: Android 16
  • App version: 1.15.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions