https://github.com/git/git
Revision 070d276cc15494184d2004d506e663f0cb791d44 authored by Junio C Hamano on 16 June 2015, 21:33:44 UTC, committed by Junio C Hamano on 16 June 2015, 21:33:44 UTC
The clean/smudge interface did not work well when filtering an
empty contents (failed and then passed the empty input through).
It can be argued that a filter that produces anything but empty for
an empty input is nonsense, but if the user wants to do strange
things, then why not?

* jh/filter-empty-contents:
  sha1_file: pass empty buffer to index empty file
2 parent s 659d4c8 + f6a1e1e
Raw File
Tip revision: 070d276cc15494184d2004d506e663f0cb791d44 authored by Junio C Hamano on 16 June 2015, 21:33:44 UTC
Merge branch 'jh/filter-empty-contents' into maint
Tip revision: 070d276
unsetenv.c
#include "../git-compat-util.h"

void gitunsetenv (const char *name)
{
#if !defined(__MINGW32__)
     extern char **environ;
#endif
     int src, dst;
     size_t nmln;

     nmln = strlen(name);

     for (src = dst = 0; environ[src]; ++src) {
	  size_t enln;
	  enln = strlen(environ[src]);
	  if (enln > nmln) {
               /* might match, and can test for '=' safely */
	       if (0 == strncmp (environ[src], name, nmln)
		   && '=' == environ[src][nmln])
		    /* matches, so skip */
		    continue;
	  }
	  environ[dst] = environ[src];
	  ++dst;
     }
     environ[dst] = NULL;
}
back to top