threads / discuss / 43600

What's in git.git (stable)

Subject: What's in git.git (stable)

## tl;dr

2 messages between Dec 18, 2006 and Dec 18, 2006.

replies: 1people: 1as markdown or json

Junio C Hamano· Dec 18, 2006, 07:26 UTC · lore

I've updated 'master' with a handful topics along with a few fixes:

 - Jakub's gitweb updates;
 - blame A..B's output shows lines attributed to the boundary
   commit with commit SHA-1 prefixed with '^';
 - "branch -m $old $new" renames branch.$old.* configuration
   variables to branch.$new.*;
 - "git add A/B C", when A and C/D used to be tracked files, now
   properly works, it used to result in a bogus index you cannot
   write-tree out;
 - "git show-branch --reflog=<n> <branch>" shows latest n entries
   of the reflog of the branch.
 - "git fetch" between repositories with tons of refs had huge
   performance problem; hopefully fixed.
* The 'master' branch has these since the last announcement.
   Jakub Narebski (8):
      gitweb: Don't use Content-Encoding: header in git_snapshot
      gitweb: Show target of symbolic link in "tree" view
      gitweb: Add generic git_object subroutine to display object of any type
      gitweb: Hyperlink target of symbolic link in "tree" view (if possible)
      gitweb: SHA-1 in commit log message links to "object" view
      gitweb: Do not show difftree for merges in "commit" view
      gitweb: Add title attribute to ref marker with full ref name
      gitweb: Add "next" link to commit view
   Johannes Schindelin (2):
      add a function to rename sections in the config
      git-branch: rename config vars branch.<branch>.*, too
   Junio C Hamano (11):
      git-blame: show lines attributed to boundary commits differently.
      update-index: make D/F conflict error a bit more verbose.
      git-add: remove conflicting entry when adding.
      Fix check_file_directory_conflict().
      Fix mis-mark-up in git-merge-file.txt documentation
      markup fix in svnimport documentation.
      Teach show-branch how to show ref-log data.
      git-fetch: Avoid reading packed refs over and over again
      avoid accessing _all_ loose refs in git-show-ref --verify
      show-ref: fix --quiet --verify
      show-ref: fix --verify --hash=length
   Quy Tonthat (1):
      Documentation: new option -P for git-svnimport
   Shawn Pearce (1):
      Default GIT_COMMITTER_NAME to login name in recieve-pack.
Junio C Hamano· Dec 18, 2006, 22:04 UTC · lore

Re: What's in git.git (stable)

Linus Torvalds <torvalds@osdl.org> writes:
Show 8 quoted lines
> On Sun, 17 Dec 2006, Junio C Hamano wrote:
>> 
>>  - blame A..B's output shows lines attributed to the boundary
>>    commit with commit SHA-1 prefixed with '^';
>
> I wonder if it would make sense to have a flag or mode or something where 
> boundary commit attributions are simply left unattributed (ie just leave 
> that _empty_).
How about this?

-- >8 -- blame: -b (blame.blankboundary) and --root (blame.showroot)

When blame.blankboundary is set (or -b option is given), commit object names are blanked out in the "human readable" output format for boundary commits.

When blame.showroot is not set (or --root is not given), the root commits are treated as boundary commits. The code still attributes the lines to them, but with -b their object names are not shown.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 builtin-blame.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index a250724..211bdb3 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -22,7 +22,9 @@
 static char blame_usage[] =
 "git-blame [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [commit] [--] file\n"
 "  -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
+"  -b                  Show blank SHA-1 for boundary commits (Default: off)\n"
 "  -l, --long          Show long commit SHA1 (Default: off)\n"
+"  --root              Do not treat root commits as boundaries (Default: off)\n"
 "  -t, --time          Show raw timestamp (Default: off)\n"
 "  -f, --show-name     Show original filename (Default: auto)\n"
 "  -n, --show-number   Show original linenumber (Default: off)\n"
@@ -36,6 +38,8 @@ static int longest_author;
 static int max_orig_digits;
 static int max_digits;
 static int max_score_digits;
+static int show_root;
+static int blank_boundary;
 
 #ifndef DEBUG
 #define DEBUG 0
@@ -1095,6 +1099,9 @@ static void assign_blame(struct scoreboard *sb, struct rev_info *revs, int opt)
 			if (commit->object.parsed)
 				mark_parents_uninteresting(commit);
 		}
+		/* treat root commit as boundary */
+		if (!commit->parents && !show_root)
+			commit->object.flags |= UNINTERESTING;
 
 		/* Take responsibility for the remaining entries */
 		for (ent = sb->ent; ent; ent = ent->next)
@@ -1318,8 +1325,12 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 		int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
 
 		if (suspect->commit->object.flags & UNINTERESTING) {
-			length--;
-			putchar('^');
+			if (!blank_boundary) {
+				length--;
+				putchar('^');
+			}
+			else
+				memset(hex, ' ', length);
 		}
 
 		printf("%.*s", length, hex);
@@ -1639,6 +1650,19 @@ static void prepare_blame_range(struct scoreboard *sb,
 		usage(blame_usage);
 }
 
+static int git_blame_config(const char *var, const char *value)
+{
+	if (!strcmp(var, "blame.showroot")) {
+		show_root = git_config_bool(var, value);
+		return 0;
+	}
+	if (!strcmp(var, "blame.blankboundary")) {
+		blank_boundary = git_config_bool(var, value);
+		return 0;
+	}
+	return git_default_config(var, value);
+}
+
 int cmd_blame(int argc, const char **argv, const char *prefix)
 {
 	struct rev_info revs;
@@ -1654,6 +1678,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 	char type[10];
 	const char *bottomtop = NULL;
 
+	git_config(git_blame_config);
 	save_commit_buffer = 0;
 
 	opt = 0;
@@ -1662,6 +1687,10 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 		const char *arg = argv[i];
 		if (*arg != '-')
 			break;
+		else if (!strcmp("-b", arg))
+			blank_boundary = 1;
+		else if (!strcmp("--root", arg))
+			show_root = 1;
 		else if (!strcmp("-c", arg))
 			output_option |= OUTPUT_ANNOTATE_COMPAT;
 		else if (!strcmp("-t", arg))

← back to recent threads