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

Re: [PATCH] Handle rename of case only, for Windows

From
Tim Abell <tim@timwise.co.uk>
Date
Jan 30, 2011, 16:53 UTC
Message-ID
<1296406435.8170.1418006125@webmail.messagingengine.com>
In-Reply-To
<4D44CB60.8000506@lsrfire.ath.cx>
> +			struct stat src_st;
> +			lstat(src, &src_st);

Shouldn't you check the return value of this call? OK, the source probably always exists, but still. Oh, we actually know that because that's the first lstat() call in this for loop. You can reuse its result instead of calling the function again.

Thanks for your feedback, you are undoubtedly right about checking the return value, I hadn't though of that. Just out of interest I tried moving a file with git mv that i'd removed from the filesystem. Here's the result, so at least it's not dying horribly:
  $ rm foo.txt
  $ git status
  # On branch master
  # Changed but not updated:
  #   (use "git add/rm <file>..." to update what will be committed)
  #   (use "git checkout -- <file>..." to discard changes in working directory)
  #
  #       deleted:    foo.txt
  #
  no changes added to commit (use "git add" and/or "git commit -a")
  $ git mv foo.txt bar.txt
  fatal: bad source, source=foo.txt, destination=bar.txt
--
What do I need to do from here to make my patch acceptable/useful to git's maintainers?
Thanks
Tim Abell
Previous: René ScharfeNext: Jonathan Nieder
Message 3 of 5 in “Handle rename of case only, for Windows”
  1. Handle rename of case only, for WindowsTim Abell, Jan 29, 2011
  2. René ScharfeJan 30, 2011
  3. Tim AbellJan 30, 2011
  4. Jonathan NiederJan 30, 2011
  5. Ramsay JonesFeb 10, 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.