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

[PATCH] gitk: Add workaround to handle corrupted author date

From
Steffen Prohaska <prohaska@zib.de>
Date
Dec 2, 2007, 16:36 UTC
Message-ID
<1196613383337-git-send-email-prohaska@zib.de>
In-Reply-To
<5F1A20CC-7427-4E7A-AB95-E89C9FA17951@zib.de>

6e6db85ea9423eea755cf5acf7a563c0d9559063 contains a corrupted author line, which is lacking the time and timezone information.

This commit adds a workaround to handle this situation.  If the
time cannot be parsed, it is assumed to be 0 and the full line
is assumed to be the author's name.
---
 gitk |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

This works around the issue for me. However, I don't think this patch should be applied.

The best was if such a corrupted commit wouldn't enter the repository in the first place. But once it is there, I think git should verify the format of a commit and report an approriate error. gitk could continue to assume well formed commits.

    Steffen
diff --git a/gitk b/gitk
index 1da0b0a..873766c 100755
--- a/gitk
+++ b/gitk
@@ -439,7 +439,12 @@ proc parsecommit {id contents listed} {
 	set tag [lindex $line 0]
 	if {$tag == "author"} {
 	    set audate [lindex $line end-1]
-	    set auname [lrange $line 1 end-2]
+	    if {[catch {formatdate $audate}]} {
+		set audate 0
+		set auname [lrange $line 1 end]
+	    } else {
+		set auname [lrange $line 1 end-2]
+	    }
 	} elseif {$tag == "committer"} {
 	    set comdate [lindex $line end-1]
 	    set comname [lrange $line 1 end-2]
-- 
1.5.3.7.949.g2221a6
Previous: Wincent ColaiutaNext: Junio C Hamano
Message 3 of 18 in “Corrupted (?) commit 6e6db85e confusing gitk”
  1. Steffen ProhaskaDec 2, 2007
  2. Wincent ColaiutaDec 2, 2007
  3. gitk: Add workaround to handle corrupted author dateSteffen Prohaska, Dec 2, 2007
  4. Junio C HamanoDec 2, 2007
  5. Brian DowningDec 2, 2007
  6. Linus TorvaldsDec 2, 2007
  7. Junio C HamanoDec 2, 2007
  8. Linus TorvaldsDec 2, 2007
  9. Junio C HamanoDec 2, 2007
  10. Linus TorvaldsDec 2, 2007
  11. Fix --signoff in builtin-commit differently.Junio C Hamano, Dec 2, 2007
  12. Johannes SchindelinDec 2, 2007
  13. Michael GebetsroitherDec 2, 2007
  14. Junio C HamanoDec 2, 2007
  15. Johannes SchindelinDec 2, 2007
  16. Linus TorvaldsDec 2, 2007
  17. Junio C HamanoDec 2, 2007
  18. Junio C HamanoDec 2, 2007

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.