# What's in git.git

2 messages from 2006-08-28 to 2006-08-28. Participants: Junio C Hamano, Jonas Fonseca.
Thread: https://gitlist.dev/t/5420

## Junio C Hamano, 2006-08-28 07:19

Subject: What's in git.git
Message-ID: <7vodu5qqd3.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vodu5qqd3.fsf%40assigned-by-dhcp.cox.net

```
This is CC'ed to the kernel list as well because the "master"
update is rather large.

On the "maint" front, I've been wanting to cut 1.4.2.1 for some
time, but various time constraints prevented me doing so so far.
I have a vague suspicion that 1.4.3 might happen before that.

Also I have been sort-of waiting for the x86-32 machine at
kernel.org to become available again so that I can do an RPM for
end users, which unfortunately hasn't happened yet.

* The 'maint' branch has these fixes since the last announcement.

   Johannes Schindelin:
      git-mv: special case destination "."
      git-mv: fix off-by-one error
      builtin-mv: readability patch

* The 'master' branch has these since the last announcement.

  - Johannes's reimplementation of merge-recursive in C is in
    'master' for early adopter testing.  Currently it is called
    'merge-recur', so you either (1) invoke it explicitly with
    the -s option to 'git pull' and/or 'git merge', or (2) have
    an environment variable GIT_USE_RECUR_FOR_RECURSIVE set to
    non-empty string, in which case places that call
    'git-merge-recursive' would use 'git-merge-recur' instead.

    This has been tested in 'next' for some time, and Johannes
    ran tests to reproduce all merges in post 2.6.12-rc2 kernel
    history to validate it produces the same result as the
    current merge-recursive.  The only difference is that it is
    about 6x-10x faster and you do not have to have Python
    installed.

    I intend to retire the current merge-recursive.py and
    replace it with merge-recur before 1.4.3 happens.

  - Various calls to memcmp/memcpy/memset with length '20' to
    compare, copy and clear object names have been abstracted
    out to hashcmp/hashcpy/hashclr wrappers, spearheaded by
    David Rientjes.  This would make it easier to migrate the
    code to hashes of other lengths if it is ever needed.

    Obviously migrating the existing data is another story.

  - Updates to git-svn by Eric Wong.

  - git-apply can be given --reject to produce *.rej files,
    instead of failing the whole patch atomically.  It also can
    be given --verbose to report what it is doing.

  - Rene Scharfe helped git-tar-tree find its soulmate
    git-zip-tree.

  - Tilman Sauerbeck taught git-daemon to setuid/setgid before
    serving the clients.

  - Various small fixes and clean-ups by Haavard Skinnemoen, Jakub
    Narebski, Jonas Fonseca, Pierre Habouzit, Rene Scharfe,
    Shawn Pearce, and Tilman Sauerbeck.

  - Various documentation clean-ups by Jonas Fonseca, and Rene
    Scharfe.

  - The internal is readied to be able to say "32 hours ago" in
    "git log" and friends by Linus; we do not have an UI to
    enable it yet.


* The 'next' branch, in addition, has these.

  - Various gitweb updates by Jakub Narebski with help from
    Aneesh Kumar, Luben Tuikov, and Martin Waitz.  The most
    attractive thing these updates have is that we finally got
    rid of having to use temporary files to show diffs.

    I'd like to push this out to "master" soonish.  You can get
    a taste of how it works at the site Jakub maintains

	http://front.fuw.edu.pl/cgi-bin/jnareb/gitweb.cgi

  - Git.pm by Pasky with help from Dennis Stosberg, Eric Wong,
    Johannes, and Pavel Roskin.  During the next round I'd like
    to push this out to "master" to see who screams ;-).

  - upload-pack has a bit of updates still held back.

  - git-daemon is taught to optionally serve git-tar-tree
    output.


* In the 'pu' branch, I have my WIP of a library to walk the
  index, the working tree, and zero or more tree objects in
  parallel.  Its test program does something that vaguely looks
  like diff-index with and without --cached in parallel, but it
  is not polished enough for public testing/consumption yet.

```

## Jonas Fonseca, 2006-08-28 13:52

Subject: [PATCH] Add --relative-date option to the revision interface
Message-ID: <20060828135213.GB32266@diku.dk>
URL: https://gitlist.dev/e/20060828135213.GB32266%40diku.dk
In-Reply-To: <7vodu5qqd3.fsf@assigned-by-dhcp.cox.net>

```
Exposes the infrastructure from 9a8e35e98793af086f05d1ca9643052df9b44a74.

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

Junio C Hamano <junkio@cox.net> wrote Mon, Aug 28, 2006:
>   - The internal is readied to be able to say "32 hours ago" in
>     "git log" and friends by Linus; we do not have an UI to
>     enable it yet.

Since nobody else has posted a patch, here is one.

 Documentation/git-rev-list.txt |    5 +++++
 builtin-rev-list.c             |    2 +-
 builtin-show-branch.c          |    2 +-
 commit.c                       |   20 ++++++++++++++------
 commit.h                       |    2 +-
 log-tree.c                     |    4 +++-
 revision.c                     |    4 ++++
 revision.h                     |    3 ++-
 8 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index dd9fff1..a446a6b 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -128,6 +128,11 @@ OPTIONS
 	After a failed merge, show refs that touch files having a
 	conflict and don't exist on all heads to merge.
 
+--relative-date::
+	Show dates relative to the current time, e.g. "2 hours ago".
+	Only takes effect for dates shown in human-readable format,
+	such as when using "--pretty".
+
 Author
 ------
 Written by Linus Torvalds <torvalds@osdl.org>
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index bc48a3e..ac648e9 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -85,7 +85,7 @@ static void show_commit(struct commit *c
 		static char pretty_header[16384];
 		pretty_print_commit(revs.commit_format, commit, ~0,
 				    pretty_header, sizeof(pretty_header),
-				    revs.abbrev, NULL, NULL);
+				    revs.abbrev, NULL, NULL, revs.relative_date);
 		printf("%s%c", pretty_header, hdr_termination);
 	}
 	fflush(stdout);
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 18786f8..d7de18e 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -261,7 +261,7 @@ static void show_one_commit(struct commi
 	struct commit_name *name = commit->util;
 	if (commit->object.parsed)
 		pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
-				    pretty, sizeof(pretty), 0, NULL, NULL);
+				    pretty, sizeof(pretty), 0, NULL, NULL, 0);
 	else
 		strcpy(pretty, "(unavailable)");
 	if (!strncmp(pretty, "[PATCH] ", 8))
diff --git a/commit.c b/commit.c
index 307883f..3f4bc31 100644
--- a/commit.c
+++ b/commit.c
@@ -482,7 +482,8 @@ static int add_rfc2047(char *buf, const 
 	return bp - buf;
 }
 
-static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf, const char *line)
+static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf,
+			 const char *line, int relative_date)
 {
 	char *date;
 	int namelen;
@@ -522,14 +523,16 @@ static int add_user_info(const char *wha
 	}
 	switch (fmt) {
 	case CMIT_FMT_MEDIUM:
-		ret += sprintf(buf + ret, "Date:   %s\n", show_date(time, tz, 0));
+		ret += sprintf(buf + ret, "Date:   %s\n",
+			       show_date(time, tz, relative_date));
 		break;
 	case CMIT_FMT_EMAIL:
 		ret += sprintf(buf + ret, "Date: %s\n",
 			       show_rfc2822_date(time, tz));
 		break;
 	case CMIT_FMT_FULLER:
-		ret += sprintf(buf + ret, "%sDate: %s\n", what, show_date(time, tz, 0));
+		ret += sprintf(buf + ret, "%sDate: %s\n", what,
+			       show_date(time, tz, relative_date));
 		break;
 	default:
 		/* notin' */
@@ -572,7 +575,10 @@ static int add_merge_info(enum cmit_fmt 
 	return offset;
 }
 
-unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject, const char *after_subject)
+unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
+				  unsigned long len, char *buf, unsigned long space,
+				  int abbrev, const char *subject,
+				  const char *after_subject, int relative_date)
 {
 	int hdr = 1, body = 0;
 	unsigned long offset = 0;
@@ -661,12 +667,14 @@ unsigned long pretty_print_commit(enum c
 			if (!memcmp(line, "author ", 7))
 				offset += add_user_info("Author", fmt,
 							buf + offset,
-							line + 7);
+							line + 7,
+							relative_date);
 			if (!memcmp(line, "committer ", 10) &&
 			    (fmt == CMIT_FMT_FULL || fmt == CMIT_FMT_FULLER))
 				offset += add_user_info("Commit", fmt,
 							buf + offset,
-							line + 10);
+							line + 10,
+							relative_date);
 			continue;
 		}
 
diff --git a/commit.h b/commit.h
index 779ed82..fc13de9 100644
--- a/commit.h
+++ b/commit.h
@@ -52,7 +52,7 @@ enum cmit_fmt {
 };
 
 extern enum cmit_fmt get_commit_format(const char *arg);
-extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject, const char *after_subject);
+extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject, const char *after_subject, int relative_date);
 
 /** Removes the first commit from a list sorted by date, and adds all
  * of its parents.
diff --git a/log-tree.c b/log-tree.c
index 031af88..54cdaa4 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -194,7 +194,9 @@ void show_log(struct rev_info *opt, cons
 	/*
 	 * And then the pretty-printed message itself
 	 */
-	len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev, subject, extra_headers);
+	len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header,
+				  sizeof(this_header), abbrev, subject,
+				  extra_headers, opt->relative_date);
 
 	if (opt->add_signoff)
 		len = append_signoff(this_header, sizeof(this_header), len,
diff --git a/revision.c b/revision.c
index 1d89d72..b588f74 100644
--- a/revision.c
+++ b/revision.c
@@ -816,6 +816,10 @@ int setup_revisions(int argc, const char
 				revs->simplify_history = 0;
 				continue;
 			}
+			if (!strcmp(arg, "--relative-date")) {
+				revs->relative_date = 1;
+				continue;
+			}
 			opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
 			if (opts > 0) {
 				revs->diff = 1;
diff --git a/revision.h b/revision.h
index 0c3b8d9..d289781 100644
--- a/revision.h
+++ b/revision.h
@@ -55,7 +55,8 @@ struct rev_info {
 
 	/* Format info */
 	unsigned int	shown_one:1,
-			abbrev_commit:1;
+			abbrev_commit:1,
+			relative_date:1;
 	unsigned int	abbrev;
 	enum cmit_fmt	commit_format;
 	struct log_info *loginfo;
-- 
1.4.2.g6e47-dirty

-- 
Jonas Fonseca

```
