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

[EGIT PATCH] Showing abbreviated commit hash of the versions in Compare editor.

From
RSRoger C. Soares <rogersoares@intelinet.com.br>
Date
Jan 8, 2008, 01:15 UTC
Message-ID
<200801072315.30122.rogersoares@intelinet.com.br>
Signed-off-by: Roger C. Soares <rogersoares@intelinet.com.br>
---
Some more patches, please evaluate.
Don't know what others are working on,
but right now I'm missing a search functionality so
this will probably be my next egit little feature.
cheers
 .../GitCompareFileRevisionEditorInput.java         |   12 ++++++++++++
 .../spearce/egit/ui/internal/GitResourceNode.java  |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java
index eaba1fa..403fdc1 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitCompareFileRevisionEditorInput.java
@@ -152,6 +152,18 @@ public class GitCompareFileRevisionEditorInput extends CompareEditorInput {
 
 	private void initLabels(ICompareInput input) {
 		CompareConfiguration cc = getCompareConfiguration();
+		if(left != null && left instanceof GitResourceNode) {
+			String ci = ((GitResourceNode)left).getContentIdentifier();
+			if(ci != null) {
+				cc.setLeftLabel(ci.substring(0, 7) + "..");
+			}
+		}
+		if(right != null && right instanceof GitResourceNode) {
+			String ci = ((GitResourceNode)right).getContentIdentifier();
+			if(ci != null) {
+				cc.setRightLabel(ci.substring(0, 7) + "..");
+			}
+		}
 		if (getLeftRevision() != null) {
 			String leftLabel = getFileRevisionLabel(getLeftRevision());
 			cc.setLeftLabel(leftLabel);
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java
index e19cef5..f25855a 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java
@@ -21,6 +21,7 @@ import org.spearce.jgit.lib.TreeEntry;
 public class GitResourceNode extends BufferedContent implements IStructureComparator, ITypedElement {
 	TreeEntry entry;
 	GitResourceNode[] children;
+	String contentIdentifier;
 
 	public GitResourceNode(TreeEntry e) {
 		entry = e;
@@ -28,6 +29,7 @@ public class GitResourceNode extends BufferedContent implements IStructureCompar
 
 	public GitResourceNode(IFileRevision file) {
 		this(file instanceof GitCommitFileRevision ? ((GitCommitFileRevision)file).getTreeEntry() : null);
+		contentIdentifier = ((GitCommitFileRevision)file).getContentIdentifier();
 	}
 
 	public Object[] getChildren() {
@@ -100,5 +102,8 @@ public class GitResourceNode extends BufferedContent implements IStructureCompar
 		}
 	}
 
+	public String getContentIdentifier() {
+		return contentIdentifier;
+	}
 }
 
-- 
1.5.3.7
Next: Robin Rosenberg
Message 1 of 9 in “Showing abbreviated commit hash of the versions in Compare editor.”
  1. Showing abbreviated commit hash of the versions in Compare editor.Roger C. Soares, Jan 8, 2008
  2. Robin RosenbergJan 8, 2008
  3. Roger C. SoaresJan 9, 2008
  4. Robin RosenbergJan 10, 2008
  5. Roger C. SoaresJan 12, 2008
  6. Roger C. SoaresJan 12, 2008
  7. Robin RosenbergJan 12, 2008
  8. Roger C. SoaresJan 13, 2008
  9. Robin RosenbergJan 13, 2008

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.