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

Re: [PATCH] cleans up builtin-mv

From
DRDavid Rientjes <rientjes@google.com>
Date
Aug 18, 2006, 06:12 UTC
Message-ID
<Pine.LNX.4.63.0608172301520.25827@chino.corp.google.com>
In-Reply-To
<Pine.LNX.4.63.0608172230470.25827@chino.corp.google.com>
On Thu, 17 Aug 2006, David Rientjes wrote:
> Cleans up builtin-mv by removing a needless check of source's length, 
> redefinition of source's length, and misuse of strlen call that was 
> already assigned.
> 

I'm not sure when this command had been added to the tree because it definitely was not included six months ago in a git tree I use everyday. It seems to me like this would more appropriately be handled by a simple shell script that would be much simpler to implement and could not possibly be slower than this implementation.

This patch is a small fraction of what could be changed in this implementation and I don't doubt it will undergo a complete rewrite in the future. I think the problems with it have compounded on top of itself over time which doesn't make a lot of sense since it appears to be a relatively new addition.

For example:
	(length = strlen(source[i])) >= 0

was _completely_ unnecessary since the previous instruction was a call to lstat(source[i], ...) which would return ENOENT if source[i] was empty. strlen(source[i]) was assigned to a variable later in the function, this time called "len" instead. There was also an additional call to strlen(source[i]) on its own even though the len variable was within scope.

This code is _utterly_ unsatisfactory.
		David
Previous: David RientjesNext: Johannes Schindelin
Message 2 of 8 in “cleans up builtin-mv”
  1. cleans up builtin-mvDavid Rientjes, Aug 18, 2006
  2. David RientjesAug 18, 2006
  3. Johannes SchindelinAug 18, 2006
  4. David RientjesAug 18, 2006
  5. Josef WeidendorferAug 18, 2006
  6. David RientjesAug 18, 2006
  7. Junio C HamanoAug 18, 2006
  8. Johannes SchindelinAug 19, 2006

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.