1

I have a bunch of .properties files structured in sub-directories inside a parent directory. I.e, the structure is this:

MainDir
     |
Dir1    Dir2   Dir3
  |      |      |
 files   files  files

In each Dir, there are a bunch of .properties files, one for each locale (e.g: translation_en.properties)

I want to compare the content of these files to a git repository, which has the same exact structure. The problem is that the keys inside the files in the git got disordered, and thus comparing the two (using FC, Comp or http://winmerge.org/) results in many differences. I don't care about the order of the key:value in the .properties files, only whether the key:value pairs are identical. How can I check this? I thought about ordering both resources by the same logic, and then running a compare. How can this be achieved?

tome
  • 1,136
  • 2
  • 8
  • 25

1 Answers1

0

You could add a smudge script (a content filter driver) which would sort the content of those .properties file on checkout of the git repo.
That way, you would be able to compare that checked out content with your initial set of properties files.

https://i.stack.imgur.com/eEQvR.png

(image from "Customizing Git Attributes" from the Git Book)

You can see how those filters are declared in "Can git automatically switch between spaces and tabs?".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I would prefer an offline solution if possible – tome Sep 22 '14 at 09:44
  • @user3836205 to compare the content of a git repo, you need to clone said git repo. But with my solution, that cloned content will be directly comparable with your local content. – VonC Sep 22 '14 at 10:20