Skip to content

Conversation

@DedSecer
Copy link
Contributor

@DedSecer DedSecer commented Aug 27, 2021

Command git for python3. (do not support python2)

(Still needs tests)
Directly using dulwich(dulwich is more stronger now) without gittle now. (gittle it not update anymore now)

TODO

  • git checkout . and git add .
  • git config
  • git diff
  • git merge
  • set upstream
  • support ssh key
  • remote branch support

Known issues

  • Password input will be echoed while authorizing
  • github not support authorize by github password now.(use a personal access token or add a ssh key instead)

@DedSecer DedSecer marked this pull request as draft August 27, 2021 12:48
@fschaeck
Copy link
Collaborator

@DedSecer Any progress here? I wouldn't want to merge a git implementation without ssh key support. Not having any Python 2 support is also a bit of a problem, but maybe it's time to thing about a Python-3-only-StaSh soon...

@DedSecer
Copy link
Contributor Author

DedSecer commented Jun 6, 2022

@fschaeck Sorry,I am busying.Since somebody noticed this, I will trying to process,this could be very slow.

FUNKY_URL = 'https://github.com/FriendCode/funky/archive/master.zip'
DULWICH_URL = 'https://github.com/jsbain/dulwich/archive/ForStaSH_0.12.2.zip'
REQUIRED_DULWICH_VERSION = (0, 12, 2)
DULWICH_URL = 'https://github.com/dedsecer/dulwich/archive/checkout.zip'
Copy link
Collaborator

@cclauss cclauss Jan 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use https://pypi.org/project/dulwich ?

DedSecer/dulwich 3 commits ahead, 545 commits behind jelmer/dulwich

@cclauss
Copy link
Collaborator

cclauss commented May 4, 2023

Please rebase.

@tringcooler
Copy link

tringcooler commented May 31, 2023

This PR still can not work in Pythonista 3.4,
So, I made some modifications to it and it finally worked properly.

Firstly, Pythonista doesn't support Subprocesses, so it cannot support shell hooks for git.
So I commented out the code in the following files of Dulwich to avoid executing hooks:
stash/lib/dulwich/repo.py, line 1104

        #self.hooks["pre-commit"] = PreCommitShellHook(self.controldir())
        #self.hooks["commit-msg"] = CommitMsgShellHook(self.controldir())
        #self.hooks["post-commit"] = PostCommitShellHook(self.controldir())
        #self.hooks["post-receive"] = PostReceiveShellHook(self.controldir())

Then, there is also a small issue in the git.py file of this PR. At function git_ add, when adding files, it check whether they are in the repo index. Doing so will result in the inability to add new files.
So I shortcut this checking:
stash/bin/git.py, line 348

if True or file.encode() in repo.open_index():

Finally, it works correctly.

@cclauss
Copy link
Collaborator

cclauss commented Aug 5, 2025

Please git rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants