diff options
author | Junio C Hamano <junkio@cox.net> | 2006-02-27 15:54:36 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-27 15:54:36 -0800 |
commit | 6d5e6fff52968443018af56e2966cf5866130a4e (patch) | |
tree | 447b7edc52a7c702b60b69d0644a39dac0f417b3 | |
parent | bfea9fc499360124f7c34ff8fe52a286e9629165 (diff) | |
parent | f3a4ec48e402a7b49d410bdcb23470e9723788b0 (diff) | |
download | git-6d5e6fff52968443018af56e2966cf5866130a4e.tar.gz git-6d5e6fff52968443018af56e2966cf5866130a4e.tar.xz |
Merge branch 'master' into next
* master:
Merge part of kh/svnimport branch into master
contrib/git-svn: correct commit example in manpage
contrib/git-svn: tell the user to not modify git-svn-HEAD directly
gitview: Remove trailing white space
gitview: Fix the encoding related bug
git-format-patch: Always add a blank line between headers and body.
combine-diff: Honour -z option correctly.
combine-diff: Honour --full-index.
-rw-r--r-- | combine-diff.c | 14 | ||||
-rw-r--r-- | contrib/git-svn/git-svn.txt | 11 | ||||
-rwxr-xr-x | contrib/gitview/gitview | 42 | ||||
-rwxr-xr-x | git-format-patch.sh | 7 |
4 files changed, 48 insertions, 26 deletions
diff --git a/combine-diff.c b/combine-diff.c index d812600d1..a23894d86 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -621,7 +621,8 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt, } static int show_patch_diff(struct combine_diff_path *elem, int num_parent, - int dense, const char *header) + int dense, const char *header, + struct diff_options *opt) { unsigned long size, cnt, lno; char *result, *cp, *ep; @@ -631,6 +632,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, char ourtmp_buf[TMPPATHLEN]; char *ourtmp = ourtmp_buf; int working_tree_file = !memcmp(elem->sha1, null_sha1, 20); + int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV; /* Read the result of merge first */ if (!working_tree_file) { @@ -724,7 +726,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, if (header) { shown_header++; - puts(header); + printf("%s%c", header, opt->line_termination); } printf("diff --%s ", dense ? "cc" : "combined"); if (quote_c_style(elem->path, NULL, NULL, 0)) @@ -735,10 +737,10 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent, printf("index "); for (i = 0; i < num_parent; i++) { abb = find_unique_abbrev(elem->parent[i].sha1, - DEFAULT_ABBREV); + abbrev); printf("%s%s", i ? "," : "", abb); } - abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV); + abb = find_unique_abbrev(elem->sha1, abbrev); printf("..%s\n", abb); if (mode_differs) { @@ -797,7 +799,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, const cha inter_name_termination = 0; if (header) - puts(header); + printf("%s%c", header, line_termination); for (i = 0; i < num_parent; i++) { if (p->parent[i].mode) @@ -862,7 +864,7 @@ int show_combined_diff(struct combine_diff_path *p, default: case DIFF_FORMAT_PATCH: - return show_patch_diff(p, num_parent, dense, header); + return show_patch_diff(p, num_parent, dense, header, opt); } } diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt index b4b7789de..b29073997 100644 --- a/contrib/git-svn/git-svn.txt +++ b/contrib/git-svn/git-svn.txt @@ -43,6 +43,11 @@ fetch:: Fetch unfetched revisions from the SVN_URL we are tracking. refs/heads/git-svn-HEAD will be updated to the latest revision. + Note: You should never attempt to modify the git-svn-HEAD branch + outside of git-svn. Instead, create a branch from git-svn-HEAD + and work on that branch. Use the 'commit' command (see below) + to write git commits back to git-svn-HEAD. + commit:: Commit specified commit or tree objects to SVN. This relies on your imported fetch data being up-to-date. This makes @@ -154,7 +159,7 @@ Tracking and contributing to an Subversion managed-project: # Commit only the git commits you want to SVN:: git-svn commit <tree-ish> [<tree-ish_2> ...] # Commit all the git commits from my-branch that don't exist in SVN:: - git commit git-svn-HEAD..my-branch + git-svn commit git-svn-HEAD..my-branch # Something is committed to SVN, pull the latest into your branch:: git-svn fetch && git pull . git-svn-HEAD # Append svn:ignore settings to the default git exclude file: @@ -179,7 +184,9 @@ SVN repositories via one git repository. Simply set the GIT_SVN_ID environment variable to a name other other than "git-svn" (the default) and git-svn will ignore the contents of the $GIT_DIR/git-svn directory and instead do all of its work in $GIT_DIR/$GIT_SVN_ID for that -invocation. +invocation. The interface branch will be $GIT_SVN_ID-HEAD, instead of +git-svn-HEAD. Any $GIT_SVN_ID-HEAD branch should never be modified +by the user outside of git-svn commands. ADDITIONAL FETCH ARGUMENTS -------------------------- diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 4e3847d8b..048caf6f8 100755 --- a/contrib/gitview/gitview +++ b/contrib/gitview/gitview @@ -162,7 +162,7 @@ class CellRendererGraph(gtk.GenericCellRenderer): for item in names: names_len += len(item) - width = box_size * (cols + 1 ) + names_len + width = box_size * (cols + 1 ) + names_len height = box_size # FIXME I have no idea how to use cell_area properly @@ -261,11 +261,11 @@ class Commit: children_sha1 = {} def __init__(self, commit_lines): - self.message = "" + self.message = "" self.author = "" - self.date = "" - self.committer = "" - self.commit_date = "" + self.date = "" + self.committer = "" + self.commit_date = "" self.commit_sha1 = "" self.parent_sha1 = [ ] self.parse_commit(commit_lines) @@ -391,7 +391,7 @@ class DiffWindow: sourceview.show() - def set_diff(self, commit_sha1, parent_sha1): + def set_diff(self, commit_sha1, parent_sha1, encoding): """Set the differences showed by this window. Compares the two trees and populates the window with the differences. @@ -401,7 +401,7 @@ class DiffWindow: return fp = os.popen("git diff-tree -p " + parent_sha1 + " " + commit_sha1) - self.buffer.set_text(fp.read()) + self.buffer.set_text(unicode(fp.read(), encoding).encode('utf-8')) fp.close() self.window.show() @@ -426,10 +426,11 @@ class GitView: def __init__(self, with_diff=0): self.with_diff = with_diff - self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(0) self.window.set_title("Git repository browser") + self.get_encoding() self.get_bt_sha1() # Use three-quarters of the screen by default @@ -468,6 +469,13 @@ class GitView: self.bt_sha1[sha1].append(name) fp.close() + def get_encoding(self): + fp = os.popen("git repo-config --get i18n.commitencoding") + self.encoding=string.strip(fp.readline()) + fp.close() + if (self.encoding == ""): + self.encoding = "utf-8" + def construct(self): """Construct the window contents.""" @@ -683,7 +691,7 @@ class GitView: self.revid_label.set_text(revid_label) self.committer_label.set_text(committer) self.timestamp_label.set_text(timestamp) - self.message_buffer.set_text(message) + self.message_buffer.set_text(unicode(message, self.encoding).encode('utf-8')) for widget in self.parents_widgets: self.table.remove(widget) @@ -728,7 +736,7 @@ class GitView: button.set_relief(gtk.RELIEF_NONE) button.set_sensitive(True) button.connect("clicked", self._show_clicked_cb, - commit.commit_sha1, parent_id) + commit.commit_sha1, parent_id, self.encoding) hbox.pack_start(button, expand=False, fill=True) button.show() @@ -870,15 +878,15 @@ class GitView: # Reset nodepostion if (last_nodepos > 5): - last_nodepos = -1 + last_nodepos = -1 # Add the incomplete lines of the last cell in this try: colour = self.colours[commit.commit_sha1] except KeyError: self.colours[commit.commit_sha1] = last_colour+1 - last_colour = self.colours[commit.commit_sha1] - colour = self.colours[commit.commit_sha1] + last_colour = self.colours[commit.commit_sha1] + colour = self.colours[commit.commit_sha1] try: node_pos = self.nodepos[commit.commit_sha1] @@ -910,7 +918,7 @@ class GitView: self.colours[parent_id] = last_colour+1 last_colour = self.colours[parent_id] self.nodepos[parent_id] = last_nodepos+1 - last_nodepos = self.nodepos[parent_id] + last_nodepos = self.nodepos[parent_id] in_line.append((node_pos, self.nodepos[parent_id], self.colours[parent_id])) @@ -946,7 +954,7 @@ class GitView: try: next_commit = self.commits[index+1] if (next_commit.commit_sha1 == sha1 and pos != int(pos)): - # join the line back to the node point + # join the line back to the node point # This need to be done only if we modified it in_line.append((pos, pos-0.5, self.colours[sha1])) continue; @@ -967,10 +975,10 @@ class GitView: self.treeview.grab_focus() - def _show_clicked_cb(self, widget, commit_sha1, parent_sha1): + def _show_clicked_cb(self, widget, commit_sha1, parent_sha1, encoding): """Callback for when the show button for a parent is clicked.""" window = DiffWindow() - window.set_diff(commit_sha1, parent_sha1) + window.set_diff(commit_sha1, parent_sha1, encoding) self.treeview.grab_focus() if __name__ == "__main__": diff --git a/git-format-patch.sh b/git-format-patch.sh index eb75de460..2bd26395e 100755 --- a/git-format-patch.sh +++ b/git-format-patch.sh @@ -174,7 +174,7 @@ titleScript=' process_one () { perl -w -e ' my ($keep_subject, $num, $signoff, $commsg) = @ARGV; -my ($signoff_pattern, $done_header, $done_subject, $signoff_seen, +my ($signoff_pattern, $done_header, $done_subject, $done_separator, $signoff_seen, $last_was_signoff); if ($signoff) { @@ -228,6 +228,11 @@ while (<FH>) { $done_subject = 1; next; } + unless ($done_separator) { + print "\n"; + $done_separator = 1; + next if (/^$/); + } $last_was_signoff = 0; if (/Signed-off-by:/i) { |