Thread (7 messages) flat view 7 messages, 4 authors, 2016-06-15

Re: [PATCH 2/2] Don't clean any untracked submodule's .git dir by default in git-clean

From: Paolo Bonzini <hidden>
Date: 2016-06-15 22:47:00

Useful indeed.

Note that 'git clean -n -d ' however will still report the directory as 
being removed.  Also, I'm not sure what happens (and what should happen) 
if an untracked directory foo.git is found.

Probably the best way to fix this is to add an is_dot_git_path function 
to dir.c like this

int
is_dot_git_path (const char *s, int len);
{
   while (len && s[len - 1] == '/')
     len--;
   return len >= 4 && !memcmp (s + len - 4, ".git", 5) &&
          (len == 4 || s[len - 5] == '/');
}

This function is safer if the directory does not have a trailing slash, 
as it might be for the paths in builtin-clean.c for the -n case.  You 
can have some adjustments if you decide do keep foo.git (just removing 
the last && of course).

Thanks!

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help