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

[PATCH] cg-diff: Always refresh the cache before diffing

From
Jonas Fonseca <fonseca@diku.dk>
Date
Apr 26, 2005, 23:01 UTC
Message-ID
<20050426230157.GC28560@diku.dk>

Call update-cache --refresh before calling diff-cache so only modified files are included in the diff.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

--- commit 580058cf4cbb6c95e5e84480499ca1c635d99376 tree 57a559984564e31e79db28d9ad62b8ea3a55dda1 parent 74f5ad9d566408b4d352570ccde67ece0f2650a7 author Jonas Fonseca <fonseca@diku.dk> 1114555427 +0200 committer Jonas Fonseca <fonseca@diku.dk> 1114555427 +0200

 cg-diff |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
Index: cg-diff
===================================================================
--- 7a6c485bceed70459c1855ab3c4d8ddfdeeb65d1/cg-diff  (mode:100755 sha1:b0c3e7389c06718c789e40b9a4fdce0afcb17917)
+++ 57a559984564e31e79db28d9ad62b8ea3a55dda1/cg-diff  (mode:100755 sha1:aecb9add527a72238f00c0581bf615625fec8663)
@@ -63,12 +63,14 @@
 		export GIT_INDEX_FILE=$(mktemp -t gitdiff.XXXXXX)
 		cp .git/index $GIT_INDEX_FILE
 		read-tree -m $(tree-id "$id1")
-		update-cache --refresh
 		tree=$(tree-id "$id1")
 	else
 		tree=$(tree-id)
 	fi
 
+	# Ensure to only diff modified files
+	update-cache --refresh
+
 	# FIXME: Update ret based on what did we match. And take "$@"
 	# to account after all.
 	ret=
-- 
Jonas Fonseca
Message 1 of 1 in “cg-diff: Always refresh the cache before diffing”
  1. cg-diff: Always refresh the cache before diffingJonas Fonseca, Apr 26, 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.