Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Exclude all files from pull request in a directory except specific directory

Avishay Guttman April 28, 2022

Hi,

I'm trying to use the exclude files from diff feature to exclude specific files/directory in a directory, except one directory.

Say I have a directory A with sub directories B,C,D:

- A
    -- B
        -- foo.go
        -- bar.go
    -- C
        -- c.go
    -- D
        -- d.go
  x.go
  y.go

I want to match everything in A (also the files x.go, y.go), except C and it's content. In .gitignore I would do something like this:

root/A/*
!root/A/C
!root/A/C/**

But it doesn't seems to work as a bitbucket exclude pattern. Is there a workaround for this?

 

Thanks in advance,

Avishay 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2022

Hi Avishay and welcome to the community.

I'm afraid that there is no way to negate a pattern in the Excluded files, this is also mentioned in the documentation you linked.

The workaround would be to match all files and directories that you want to be excluded. If the files x.go and y.go are in the A directory, you can exclude the following:

/A/B/**
/A/D/**
/A/y.go
/A/x.go

If the files x.go and y.go are in the root directory and not inside A, as follows:

/A/B/**
/A/D/**
y.go
x.go

Kind regards,
Theodora

Avishay Guttman July 3, 2022

Hi Theodora,

The thing is that the content I want to exclude is generated content (this is usually the kind of content you want to exclude from diff).

Think about the following: you have directory A, and inside a directory C that contains code responsible for generating the rest of the code in A (dirs, files).
So you want to see the code in C in PR, but the reset of the code is generated so you want to exclude it from diff.

Writing the the dirs/files explicitly is not practical as it dynamically changes.

Please consider adding this as a feature request, this pretty common scenario.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 4, 2022

Hi Avishay,

Thank you for the feedback and for explaining your use case.

I went ahead and created a feature request in our issue tracker:

I used your example to explain why this would be a useful feature.

Please make sure to add your vote to that feature request (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features.

You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature request.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events