question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question][2.0] exports_sources with .gitignore support

See original GitHub issue

I’m currently starting to port conan 1.x recipes in our organization to conan 2.0 syntax using conan 1.52.0. One pattern we use in most of our projects is this syntax for exports_sources in order not to export files ignored by git:

exports_sources = ["*", "!.gitignore"] + ["!%s" % x for x in tools.Git().excluded_files()]

But apparently, support for excluded_files() is not provided in conan.tools.scm.git. Besides that, #4023 proposed to use the SCM feature, which is also deprecated.

As of now, I don’t see a chance to migrate this behaviour to conan 2.0 except reimplementing it ourselfs. Is there another solution I’ve overseen? Is there a chance to make excluded_files() available in conan.tools.scm.git or is there a rationale behind removing it? Or asking more general: Will there be a mechanism in exports_sources to not copy files ignored by git?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Oct 7, 2022

Oh, yes, sorry, this should have been done directly for 1.X to allow the migration, I will backport it to 1.54

1reaction
memshardedcommented, Oct 6, 2022

Yes, both approaches are equally valid IMO. In the above I wanted to remove the “magic” of the copy(), so even if it requires a couple of extra lines, it would be good, and it should work too. And it can be much much faster, which is something that for big projects might make a difference. We can document both approaches, as the git.included_files() is now decoupled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git - gitignore Documentation
A gitignore file specifies intentionally untracked files that Git should ... Patterns read from the command line for those commands that support them....
Read more >
git - Gitignore not working
To untrack every file that is now in your .gitignore : First commit any outstanding code changes, and then, run this command: git...
Read more >
.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
Read more >
Ignoring files - GitHub Docs
You can create a .gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make...
Read more >
Don't ignore .gitignore
Here are some basic rules to help you to set up your .gitignore file ... An asterisk ( * ) means any number...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found