Skip to content

Don't list changed files on the command line#5

Open
kasimon wants to merge 1 commit into
elmar:masterfrom
kasimon:patch-1
Open

Don't list changed files on the command line#5
kasimon wants to merge 1 commit into
elmar:masterfrom
kasimon:patch-1

Conversation

@kasimon

@kasimon kasimon commented Oct 20, 2017

Copy link
Copy Markdown

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

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.
@rda0

rda0 commented Dec 21, 2017

Copy link
Copy Markdown

I think this does not remove deleted entries from the git repository.

@kasimon

kasimon commented Dec 22, 2017

Copy link
Copy Markdown
Author

man git-add:

This adds, modifies, and removes index entries to match the working tree.

@rda0

rda0 commented Dec 22, 2017

Copy link
Copy Markdown

The script does the following:

  • git ls-files *.ldif -> @files_before (store all existing *.ldif files 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.

@kasimon

kasimon commented Jan 2, 2018

Copy link
Copy Markdown
Author

@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.

@rda0

rda0 commented Jan 4, 2018

Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants