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

Convert .acignore to .gitignore #123

Open
veljkosbbb opened this issue Mar 9, 2022 · 3 comments
Open

Convert .acignore to .gitignore #123

veljkosbbb opened this issue Mar 9, 2022 · 3 comments
Assignees
Labels

Comments

@veljkosbbb
Copy link

Hi,

is there already implemented method/script that converts automatically or at least partially .acignore file to .gitignore file?
Can you please give us details how this could be achieved?

Thanks a lot!

@fatfreddie fatfreddie self-assigned this Mar 20, 2022
@fatfreddie
Copy link
Collaborator

Hi @veljkosbbb,

Sorry for taking so long to reply. Your question is a good one and I'll do my best to give you a good answer. My answer will be biased by personal experience. My knowledge of AccuRev (AR) is getting rusty, since my company converted to Git many years ago. Back then I was highly motivated to remove AR from my life and I have done my best to forget about it since. That said I kind of like the challenge, so here are my thoughts.

It seems to me the subject of ignore files is necessarily subjective and opinionated. Each project can use a different way to describe the set of file patterns that are ignored. Some will create a single top-level ignore file that defines patterns that apply globally. Some will create a set of ignore files in each subdirectory with patterns that apply locally. Some will use a mixture of the two: a generic, top-level ignore file along with a few speciflc, lower-level ignore files where it makes more sense. Generally the more complex a repository the more complex the solution. The thing to notice is that all ignore patterns taken together define an abstract pattern space. This pattern space is constructed by parsing input files, can be modified using abstract rules, and written to output files. This isn't a problem limited to AccuRev and Git but we must avoid getting overcomplicated by limiting our scope.

On reflection, I think we can define two requirements

Requirement 1: Convert a top-level .acignore file into a top-level .gitignore file.

  • Assume the workspace is correctly checked out.
  • Recognise simple patterns that can be written without modification
  • Recognise .acignore-specific patterns and convert into equivalent .gitignore patterns
  • Recognise exception (!) patterns and convert to equivalent .gitignore patterns
  • Recognise pattern precidence and sort .gitignore patterns appropriately
  • Every file that would be ignored by AccuRev through the use of top-level .acignore patterns must be ignored by Git through the use of a top-level .gitignore patterns.

Requirement 2: Convert a lower-level .acignore file into a lower-level .gitignore file.

  • Everything from Requirement 1
  • Assume all higher level .acignore files have been correctly converted to higher-level .gitignore files
  • Recognise local .acignore patterns and convert to local .gitignore patterns that have the same effect. It's possible a simple, lower-level .acignore pattern doesn't have a mapping to a simple, lower-level .gitignore pattern.

I would start by trying to satisfy Requirement 1 and then work on Requirement 2, if needed.

Has this helped? Maybe you have some example .acignore files that we could take a look at, together. I'm afraid anything I can dream up would be near useless.

@fatfreddie
Copy link
Collaborator

Ping @veljkosbbb

1 similar comment
@fatfreddie
Copy link
Collaborator

Ping @veljkosbbb

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