Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

index.add() method add support for "chmod=+x" #1156

Answered by Byron
ericsunplus asked this question in Q&A
Discussion options

On Windows OS, if you have a unix file with permission 100755 -rwxr-xr-x, after git add, the staged file will miss the x permission and becomes 100644 -rw-r--r-- as shown in git ls-files --stage. git add has the option `--chmod=+x' to handle this problem. Can gitpython also add this feature in index.add() method?

You must be logged in to vote

Unless you explicitly require GitPython for 'plumbing', it is recommended to use Repo(path).git.add(..., chmod='+x'), which supports all flags that git supports. You can read more about that in the respective section of the docs.

Even though I am closing this issue assuming you don't actually need plumbing, please let me know if you do which would make this a feature request or bugfix. Thank you

Replies: 2 comments

Comment options

Unless you explicitly require GitPython for 'plumbing', it is recommended to use Repo(path).git.add(..., chmod='+x'), which supports all flags that git supports. You can read more about that in the respective section of the docs.

Even though I am closing this issue assuming you don't actually need plumbing, please let me know if you do which would make this a feature request or bugfix. Thank you

You must be logged in to vote
0 replies
Answer selected by Byron
Comment options

Thank you Byron. I actually used the repo.git.add as a solution and it works well. I was just thinking index.add is more like a native solution for GitPython and expect to be as versatile as git shell command. Up to you to judge :)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #1021 on February 26, 2021 11:18.

AltStyle によって変換されたページ (->オリジナル) /