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

porecelain.add(files=None) adds files from root rather than os.getcwd() #521

Closed
fviolette opened this issue May 4, 2017 · 8 comments
Closed
Labels

Comments

@fviolette
Copy link
Contributor

Hello,

Small issue with porcelain.add() not adding all modified/new files.

Tested with python 3.6 and dulwich (0.17.3), following syntax:

  • porcelain.add(base_repo, paths=None)
  • porcelain.add(base_repo)

porcelain.get_tree_changes(base_repo) returns {'add': [], 'delete': [], 'modify': []} in this case.

Thanks in advance for your help.

@jelmer
Copy link
Owner

jelmer commented Jun 16, 2017

Do you have some code that reproduces this? Dulwich has some tests for add without explicit paths specified and those pass. What platform are you on?

@fviolette
Copy link
Contributor Author

fviolette commented Jun 17, 2017

Windows
Python 3.6.1
dulwich (0.17.3)

What I would like to use:

base_dir = os.path.join(script_dir, '../..')

porcelain.open_repo(base_dir)
porcelain.add(base_dir, paths=None)

What is working for me at the moment:

base_dir = os.path.join(script_dir, '../..')

porcelain.open_repo(base_dir)
porcelain.add(base_dir, paths=[
    'reuse/metadata_Modules.dita',
    'reuse/metadata_Tasks.dita',
    'reuse/metadata_Products.dita',
    'common/taxonomy/' + rdf,
    'common/taxonomy/subjectscheme.ditamap',
    ...
])

@fviolette
Copy link
Contributor Author

fviolette commented Jun 17, 2017

Retrying now, still with paths=None and I can get it to work sometimes but I don't understand why. There is probably an issue with interfering Git processes.

I've checked for lockfiles, LF vs CRLF, closed my SourceTree instance. Everything seems fine.

So most likely that this is an issue with my setup but just to confirm that the repo does not need to be closed after all other operations? I only run open_repo() then add() in my test.

More important, other files are promoted too:

  • From the same base folder (e.g. build/html/upload.py - my script which runs is build/taxonomy/taxonomy.py and does not affect the upload.py in any way by itself).
  • From .gitignore'd subfolders (/out or /temp)

Is this expected? Is this again an issue with my setup?

Thanks.

@jelmer
Copy link
Owner

jelmer commented Jun 17, 2017

Yes, there shouldn't be a need to reopn the repo after running add.

What do you mean with "promoted" ?

@fviolette
Copy link
Contributor Author

I do not reopen after add so this is fine.

For promoted, I meant other files that are not modified/added by my script or files that Git usually ignores are moved to the staging area.

For those under build/, it's the same content but all lines are replaced (.sh, .bat and .py files. The line endings are unchanged and OK). For those under out/ or temp/, these are new files created by script which get added. But they shouldn't.

@jelmer
Copy link
Owner

jelmer commented Jun 18, 2017

Dulwich currently doesn't support ignore files, files=None will add recursively from the repository root - not from the $PWD. That last bit should be easy to fix though.

Does that match what you're seeing?

@fviolette
Copy link
Contributor Author

Yes, it does behave as you describe.

@jelmer jelmer removed the moreinfo label Jun 19, 2017
@jelmer
Copy link
Owner

jelmer commented Jun 19, 2017

I've filed #524 about the lack of .gitignore support. The issue about recursing from $PWD is easy to fix, I'll change this bug to be about that.

@jelmer jelmer changed the title porecelain.add() not adding files when paths is not specified porecelain.add(files=None) adds files from root rather than $PWD Jun 19, 2017
@jelmer jelmer changed the title porecelain.add(files=None) adds files from root rather than $PWD porecelain.add(files=None) adds files from root rather than os.getcwd() Jun 19, 2017
@jelmer jelmer closed this as completed in c4eaba1 Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants