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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]