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

[JGIT PATCH 1/6] Fix RefUpdate.delete to update the result status

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 12, 2009, 23:54 UTC
Message-ID
<1234482880-1316-2-git-send-email-spearce@spearce.org>
In-Reply-To
<1234482880-1316-1-git-send-email-spearce@spearce.org>

Some applications may want to use getResult() to obtain the status of the delete operation, as perhaps they lost access to the return value. This makes delete() more consistent in use with update().

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../src/org/spearce/jgit/lib/RefUpdate.java        |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java
index 7ad2bab..d1820da 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java
@@ -401,11 +401,11 @@ public Result delete(final RevWalk walk) throws IOException {
 		if (getName().startsWith(Constants.R_HEADS)) {
 			final Ref head = db.readRef(Constants.HEAD);
 			if (head != null && getName().equals(head.getName()))
-				return Result.REJECTED_CURRENT_BRANCH;
+				return result = Result.REJECTED_CURRENT_BRANCH;
 		}
 
 		try {
-			return updateImpl(walk, new DeleteStore());
+			return result = updateImpl(walk, new DeleteStore());
 		} catch (IOException x) {
 			result = Result.IO_FAILURE;
 			throw x;
-- 
1.6.2.rc0.226.gf08f
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 2 of 10 in “Add prune of stale tracking branches to fetch”
  1. 0/6 Add prune of stale tracking branches to fetchShawn O. Pearce, Feb 12, 2009
  2. 1/6 Fix RefUpdate.delete to update the result statusShawn O. Pearce, Feb 12, 2009
  3. 2/6 Add setBoolean, setInt to RepositoryConfigShawn O. Pearce, Feb 12, 2009
  4. 3/6 Add RefSpec.expandFromDestination for reverse mappingsShawn O. Pearce, Feb 12, 2009
  5. 4/6 Add the remote.name.mirror flag to RemoteConfigShawn O. Pearce, Feb 12, 2009
  6. 5/6 Don't pass TagOpt to FetchProcess, get it from the TransportShawn O. Pearce, Feb 12, 2009
  7. 6/6 Teach fetch to prune stale tracking branchesShawn O. Pearce, Feb 12, 2009
  8. Junio C HamanoFeb 13, 2009
  9. Shawn O. PearceFeb 13, 2009
  10. Junio C HamanoFeb 13, 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.