Pull Metadata does not honor .forceignore

Issue #2635 resolved
Adam Stepanek created an issue

Hi Scott,

I have a connection to sandbox with Use Source Tracking checked. After pulling the metadata using Pull Metadata I receive a bunch of changes to profile metadata despite having those ignored in .forceignore. I thought that the .forceignore should apply to both pull/push.

.forceignore

# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm

...

force-app/main/default/profiles

...

Here is the output of the retrieve command.

Command line
============
/usr/local/lib/sf/bin/sf project retrieve start -o adam.stepanek@c----vas -c --json

Working directory
=================
/Users/adam/IdeaProjects/salesforce

Environment variables
=====================
SF_JSON_TO_STDOUT = true
SF_AUTOUPDATE_DISABLE = true
SF_ENABLE_MULTIUDX = true
SF_TOOL = IlluminatedCloud

Duration
========
55 s 113 ms

Exit code
=========
0

Output
======
{
  "status": 0.0,
  "result": {
    "done": true,
    "fileProperties": [
      ...
      {
        "createdById": "0056N000000uagXQAQ",
        "createdByName": "Ma----lík",
        "createdDate": "2022-11-30T10:01:14.000Z",
        "fileName": "unpackaged/profiles/Auction Profile.profile",
        "fullName": "Auction Profile",
        "id": "00eMI000000GatxYAC",
        "lastModifiedById": "005MI00000BnIQVYA3",
        "lastModifiedByName": "Mo----ziul",
        "lastModifiedDate": "2024-07-24T11:42:45.000Z",
        "type": "Profile"
      },
      ...

Please let me know if I need to set anything else.

Comments (4)

  1. Scott Wells repo owner
    • changed status to open

    Adam, this would actually be a CLI behavior. For Pull Metadata, IC2 just runs sf project retrieve start (as shown in your provided command output), and the CLI is what applies .forceignore filtering. The IC2-specific Use .forceignore option is really more about whether that same filtering occurs in the IDE proper for its own native deploy/retrieve/delete and subscription management features.

    This .forceignore entry has worked well for me:

    **/profiles/**
    

    If that doesn't work for you, you might reproduce the behavior directly from the command-line using the same command that IC2 is executing and log a bug in the CLI public issue tracker:

    https://github.com/forcedotcom/cli/issues

  2. Scott Wells repo owner

    I'm going to resolve this here since I'm 99% certain it's either a .forceignore configuration issue or a CLI issue, but if you do find that it's specific to IC2, please reopen with those details.

  3. Adam Stepanek reporter

    Thanks for directing me to the right way. Changed .forceignore as you suggested and it looks working as you said. Just for the record, the documentation says that there are different patterns for pull and push, which does not look true. The push pattern, same as you suggested, works for the pull as well.

  4. Scott Wells repo owner

    Interesting. I hadn’t seen that. I’ve only been using these wildcard patterns and they seem to work well for all purposes.

  5. Log in to comment