Don't list changed files on the command line
For very large change sets, listing them on the command line exceeds the maximum command line length. This change lets git pick up the changed files instead.
Fixes #4
I think this does not remove deleted entries from the git repository.
man git-add:
This adds, modifies, and removes index entries to match the working tree.
The script does the following:
git ls-files *.ldif->@files_before(store all existing*.ldiffiles in array)- dump ldap database ->
@filelist(store ldif files from dump in array) @files_before = @files_before - @filelist(will now only contain the files not in the database anymore)git add @filelist(stage new/changed ldifs)git rm @files_before(remove all ldifs which do not exist in LDAP anymore)
The last part with git rm removes the ldif files which are still in the working tree but not in the LDAP database anymore. If you just use git add -A these files will not be touched, because they did not change and they will also not be removed. Another side effect would be, that any files in the repository's tree would be staged and committed.
@rda0 Got it, thanks for the detailed explanation. So an xargs-like solution would be needed that splits up the command invocations if the resulting string exceeds a certain length.
@kasimon You are welcome. Yes this would be one solution. Another solution, which I propose in #6, is to add the files in multiple chunks. I did not test the xargs-solution, but it may be interesting to compare the performance.