git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] Allow git mv FileA fILEa on case ignore file systems

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Mar 19, 2011, 18:20 UTC
Message-ID
<AANLkTimfk8bb-V8Br+KKpoLbA3G3y9HxyfjA=NrsgR0v@mail.gmail.com>
In-Reply-To
<201103191528.34646.tboegi@web.de>
2011/3/19 Torsten Bögershausen <tboegi@web.de>:
Show 10 quoted lines
> diff --git a/compat/win32/same-file.c b/compat/win32/same-file.c
> new file mode 100644
> index 0000000..bb1a791
> --- /dev/null
> +++ b/compat/win32/same-file.c
> @@ -0,0 +1,26 @@
> +#include "../../git-compat-util.h"
> +#include "../win32.h"
> +
> +int win_is_same_file(const char *a, const char *b)

The compat/win32-folder is usually used to provide implementations of POSIX APIs lacking on Windows. I don't think this is appropriate functionality to be put there...

Show 10 quoted lines
> +{
> +       BY_HANDLE_FILE_INFORMATION hia, hib;
> +       HANDLE h;
> +
> +       h = CreateFile(a, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
> +       if (INVALID_HANDLE_VALUE == h)
> +               return 0;
> +       if (!(GetFileInformationByHandle(h,&hia)))
> +               return 0;
> +  CloseHandle(h);
Indentation-slip?
Show 8 quoted lines
> +
> +       h = CreateFile(b, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
> +       if (INVALID_HANDLE_VALUE == h)
> +               return 0;
> +       if (!(GetFileInformationByHandle(h,&hib)))
> +               return 0;
> +  CloseHandle(h);
> +
Same as above...?
Show 14 quoted lines
> +#if defined (WIN32) || defined(__CYGWIN__)
> +/* MinGW or MSVC or cygwin */
> +int win_is_same_file(const char *a, const char *b);
> +#define is_same_file(a,b) win_is_same_file((a),(b))
> +#else
> +static inline int is_same_file(const char *a, const char *b)
> +{
> +       struct stat sta, stb;
> +       if (lstat(a, &sta) ||
> +           lstat(b, &stb))
> +               return 0;
> +       return sta.st_ino && sta.st_dev == stb.st_dev && sta.st_ino == stb.st_ino;
> +}
> +#endif

This isn't how we usually do things like this. We usually define stuff in compat/mingw.h (which should really be called compat/win32.h instead, since it's used by our MSVC builds as well. But that's a different discussion), and check if it's defined near the bottom of git-compat-util.h.

Previous: Torsten BögershausenNext: Piotr Krukowiecki
Message 2 of 8 in “Allow git mv FileA fILEa on case ignore file systems”
  1. Allow git mv FileA fILEa on case ignore file systemsTorsten Bögershausen, Mar 19, 2011
  2. Erik Faye-LundMar 19, 2011
  3. Piotr KrukowieckiMar 19, 2011
  4. Junio C HamanoMar 20, 2011
  5. Torsten BögershausenApr 10, 2011
  6. Junio C HamanoApr 11, 2011
  7. Torsten BögershausenApr 11, 2011
  8. Johannes SixtApr 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.