Skip to content

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

Open
kasimon wants to merge 1 commit intoelmar:masterfrom
kasimon:patch-1
Open

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

Conversation

@kasimon
Copy link

@kasimon kasimon commented Oct 20, 2017

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
Copy link

rda0 commented Dec 21, 2017

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

@kasimon
Copy link
Author

kasimon commented Dec 22, 2017

man git-add:

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

@rda0
Copy link

rda0 commented Dec 22, 2017

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
Copy link
Author

kasimon commented Jan 2, 2018

@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
Copy link

rda0 commented Jan 4, 2018

@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