From e70c6b35749c316f6e97099bd6bdac895c9d6f68 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 27 Feb 2006 12:52:50 +0000 Subject: [PATCH 1/7] combine-diff: Honour --full-index. For some reason, combined diffs don't honour the --full-index flag when emitting patches. Fix this. Signed-off-by: Mark Wooding Signed-off-by: Junio C Hamano --- combine-diff.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/combine-diff.c b/combine-diff.c index d812600d11..984103edce 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) { @@ -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) { @@ -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); } } From 6baf0484efcd29bb5e58ccd5ea0379481d4a83f4 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 27 Feb 2006 12:52:52 +0000 Subject: [PATCH 2/7] combine-diff: Honour -z option correctly. Combined diffs don't null terminate things in the same way as standard diffs. This is presumably wrong. Signed-off-by: Mark Wooding Signed-off-by: Junio C Hamano --- combine-diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/combine-diff.c b/combine-diff.c index 984103edce..a23894d869 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -726,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)) @@ -799,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) From f891cb3fd6b3c2871c1a15e122366e412428204c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 27 Feb 2006 14:09:56 +0100 Subject: [PATCH 3/7] git-format-patch: Always add a blank line between headers and body. If the second line of the commit message isn't empty, git-format-patch needs to add an empty line in order to generate a properly formatted mail. Otherwise git-rebase drops the rest of the commit message. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano --- git-format-patch.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git-format-patch.sh b/git-format-patch.sh index eb75de4601..2bd26395ec 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 () { $done_subject = 1; next; } + unless ($done_separator) { + print "\n"; + $done_separator = 1; + next if (/^$/); + } $last_was_signoff = 0; if (/Signed-off-by:/i) { From 68d55b83a58a68fc1c9cef63f0deccbff3251096 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Mon, 27 Feb 2006 21:25:13 +0530 Subject: [PATCH 4/7] gitview: Fix the encoding related bug Get the encoding information from repository and convert it to utf-8 before passing to gtk.TextBuffer.set_text. gtk.TextBuffer.set_text work only with utf-8 Signed-off-by: Aneesh Kumar K.V Signed-off-by: Junio C Hamano --- contrib/gitview/gitview | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 4e3847d8bf..1d042e3aa7 100755 --- a/contrib/gitview/gitview +++ b/contrib/gitview/gitview @@ -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() @@ -430,6 +430,7 @@ class GitView: 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() @@ -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__": From c447f10f999a7d137aef62f76d765fbc7d24f48a Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Mon, 27 Feb 2006 22:42:07 +0530 Subject: [PATCH 5/7] gitview: Remove trailing white space Do the cleanup using Dave jones vim script Signed-off-by: Aneesh Kumar K.V Signed-off-by: Junio C Hamano --- contrib/gitview/gitview | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview index 1d042e3aa7..048caf6f86 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) @@ -426,7 +426,7 @@ 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") @@ -878,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] @@ -918,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])) @@ -954,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; From b705ba43c6202e3a64fbc28aa7b6b2adff7435ac Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 27 Feb 2006 11:04:02 -0800 Subject: [PATCH 6/7] contrib/git-svn: tell the user to not modify git-svn-HEAD directly As a rule, interface branches to different SCMs should never be modified directly by the user. They are used exclusively for talking to the foreign SCM. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- contrib/git-svn/git-svn.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt index b4b7789dee..b588a2a0ec 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 @@ -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 -------------------------- From 7be737680fbb3dbce4f7ad1bc179a661532cd026 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 27 Feb 2006 12:55:45 -0800 Subject: [PATCH 7/7] contrib/git-svn: correct commit example in manpage Thanks to Nicolas Vilz for noticing this. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- contrib/git-svn/git-svn.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt index b588a2a0ec..b29073997c 100644 --- a/contrib/git-svn/git-svn.txt +++ b/contrib/git-svn/git-svn.txt @@ -159,7 +159,7 @@ Tracking and contributing to an Subversion managed-project: # Commit only the git commits you want to SVN:: git-svn commit [ ...] # 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: