Skip to content
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

Support push with -f #162

Closed
asmacdo opened this issue May 1, 2023 · 2 comments · Fixed by #176
Closed

Support push with -f #162

asmacdo opened this issue May 1, 2023 · 2 comments · Fixed by #176
Labels
enhancement New feature or request

Comments

@asmacdo
Copy link

asmacdo commented May 1, 2023

I did some squashing, and I'd like to push to OSF. Since the commit history is ammended, I need to force push, but the extension doesnt suppost datalad push --to osf -f gitpush

Update availability for 'osf':  75%|████████████████████████████████▎          | 3.00/4.00 [00:00<00:00, 8.38k Steps/s]CommandError: 'git -c diff.ignoreSubmodules=none push --progress --porcelain --force osf master:master git-annex:git-annex' failed with exitcode 1 under /home/asmacdo/datasets/opfvta-replication-2023
[WARNING] Failed to query keyring: InitError(Failed to create the collection: Prompt dismissed..) 
[WARNING] Failed to query keyring: InitError(Failed to create the collection: Prompt dismissed..) 
[WARNING] Failed to query keyring: InitError(Failed to create the collection: Prompt dismissed..) 
100%|██████████| 145/145 [00:00<00:00, 999kbytes/s]
warning: helper osf does not support 'force'
warning: Not updating refs/heads/master (new tip e99e5e72c462520b904a4c2037d2a9c0ebafe411 does not contain 474a1c5caf97415c5dd384deb6b3ffce8799974c)
fatal: Command '['git', 'fast-import', '--quiet', '--import-marks=/home/asmacdo/datasets/opfvta-replication-2023/.git/osf/osf/osf.marks', '--export-marks=/home/asmacdo/datasets/opfvta-replication-2023/.git/osf/osf/osf.marks']' returned non-zero exit status 1.
error: failed to push some refs to 'osf://dbxpt'
@asmacdo asmacdo added the enhancement New feature or request label May 1, 2023
asmacdo added a commit to con/opfvta-reexecution that referenced this issue May 1, 2023
We cannot force push to osf, so we need to merge here.
datalad/datalad-osf#162
@mih
Copy link
Member

mih commented May 2, 2023

Your assessment is correct.

A bit of background and possibly a path forward:

The git remote helper provided by this extension is a predecessor of http://docs.datalad.org/projects/next/en/latest/generated/datalad_next.gitremotes.datalad_annex.html

While datalad-osf can only deal with OSF, this next iteration can be used to perform git IO operations with any service compatible with any git annex special remote implementation. In some sense, this makes the insufficient piece of code (that is causing the issue your report) obsolete. The OSF extension also provides a git-annex special remote implementation, that should work with datalad-annex::.

So while this has not been tried (to my knowledge), you may just be able to reconfigure the osf git remote of your dataset to use datalad-annex:: instead. It should also support force-pushing.

The general trajectory for the next update of datalad-osf is to adjust the documentation (and some convenience aspects of the code) to do exactly that. The git remote helper provided here will be removed in favor of the solution outlined above.

If you happen to give that a try, it would be great to learn how it went! Thx in advance!

@mih
Copy link
Member

mih commented Jun 8, 2023

This is fixed with #176

❯ datalad create osf
❯ datalad create-sibling-osf
❯ echo 123 > dummy
❯ datalad save
❯ datalad push --to osf
copy(ok): dummy (file) [to osf-storage...]                                                                     
publish(ok): . (dataset) [refs/heads/master->osf:refs/heads/master [new branch]]                               
publish(ok): . (dataset) [refs/heads/git-annex->osf:refs/heads/git-annex [new branch]]                         
                                                                                                              action summary:                                                                                                 
  copy (ok: 1)
  publish (ok: 2)
❯ git reset --hard HEAD~1
HEAD is now at 443c058 [DATALAD] new dataset
❯ datalad push --to osf  -f gitpush
publish(ok): . (dataset) [refs/heads/master->osf:refs/heads/master e8bf591...443c058 (forced update)]          
                                                                                                              action summary:                                                                                                 
  publish (notneeded: 1, ok: 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants