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

[PATCH] cg-diff fixed to work with BSD xargs

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Aug 30, 2005, 10:00 UTC
Message-ID
<11253960093915-git-send-email-martin@catalyst.net.nz>

Calls to cg-diff without filename parameters were dependent on GNU xargs traits. BSD xargs is hardcoded to do --no-run-if-empty -- so if the filter is effectively empty we avoid calling xargs.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---
 cg-diff |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
7b1d159f557ee06a0358217cdc29c2a2b2ee52fc
diff --git a/cg-diff b/cg-diff
--- a/cg-diff
+++ b/cg-diff
@@ -155,7 +155,11 @@ if [ "$id2" = " " ]; then
 	# FIXME: Update ret based on what did we match. And take "$@"
 	# to account after all.
 	ret=
-	cat $filter | xargs git-diff-cache -r -p $tree | colorize | pager
+	if [ -s $filter ]; then
+		cat $filter | xargs git-diff-cache -r -p $tree | colorize | pager  
+	else
+		git-diff-cache -r -p $tree | colorize | pager
+	fi
 
 	rm $filter
 
Next: Junio C Hamano
Message 1 of 9 in “cg-diff fixed to work with BSD xargs”
  1. cg-diff fixed to work with BSD xargsMartin Langhoff, Aug 30, 2005
  2. Junio C HamanoAug 30, 2005
  3. Petr BaudisSep 20, 2005
  4. Matthias UrlichsSep 21, 2005
  5. Petr BaudisSep 21, 2005
  6. Matthias UrlichsSep 21, 2005
  7. Petr BaudisSep 21, 2005
  8. Matthias UrlichsSep 21, 2005
  9. Martin LanghoffSep 21, 2005

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.