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

[JGIT PATCH] Update Index (refresh) doesn't do anything obvious

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Jun 22, 2009, 19:27 UTC
Message-ID
<1245698829-28347-1-git-send-email-robin.rosenberg@dewire.com>

The bug reported against EGit is reall an JGit bug and is quite easy to fix, which is why I do it rather than drop the GitIndex usage and replace with DirCache.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/jgit/lib/GitIndex.java         |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
index 21b495a..6484535 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
@@ -468,7 +468,7 @@ public boolean update(File f) throws IOException {
 			if (modified) {
 				size = (int) f.length();
 				ObjectWriter writer = new ObjectWriter(db);
-				ObjectId newsha1 = sha1 = writer.writeBlob(f);
+				ObjectId newsha1 = writer.writeBlob(f);
 				if (!newsha1.equals(sha1))
 					modified = true;
 				sha1 = newsha1;
@@ -491,7 +491,7 @@ public boolean update(File f, byte[] newContent) throws IOException {
 			boolean modified = false;
 			size = newContent.length;
 			ObjectWriter writer = new ObjectWriter(db);
-			ObjectId newsha1 = sha1 = writer.writeBlob(newContent);
+			ObjectId newsha1 = writer.writeBlob(newContent);
 			if (!newsha1.equals(sha1))
 				modified = true;
 			sha1 = newsha1;
-- 
1.6.3.2.199.g7340d
Message 1 of 1 in “Update Index (refresh) doesn't do anything obvious”
  1. Update Index (refresh) doesn't do anything obviousRobin Rosenberg, Jun 22, 2009

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.