1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 16:52:59 +01:00

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.
This commit is contained in:
Junio C Hamano 2006-02-27 15:54:36 -08:00
commit 6d5e6fff52
4 changed files with 48 additions and 26 deletions

View file

@ -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, 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; unsigned long size, cnt, lno;
char *result, *cp, *ep; 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_buf[TMPPATHLEN];
char *ourtmp = ourtmp_buf; char *ourtmp = ourtmp_buf;
int working_tree_file = !memcmp(elem->sha1, null_sha1, 20); int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
/* Read the result of merge first */ /* Read the result of merge first */
if (!working_tree_file) { if (!working_tree_file) {
@ -724,7 +726,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
if (header) { if (header) {
shown_header++; shown_header++;
puts(header); printf("%s%c", header, opt->line_termination);
} }
printf("diff --%s ", dense ? "cc" : "combined"); printf("diff --%s ", dense ? "cc" : "combined");
if (quote_c_style(elem->path, NULL, NULL, 0)) 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 "); printf("index ");
for (i = 0; i < num_parent; i++) { for (i = 0; i < num_parent; i++) {
abb = find_unique_abbrev(elem->parent[i].sha1, abb = find_unique_abbrev(elem->parent[i].sha1,
DEFAULT_ABBREV); abbrev);
printf("%s%s", i ? "," : "", abb); printf("%s%s", i ? "," : "", abb);
} }
abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV); abb = find_unique_abbrev(elem->sha1, abbrev);
printf("..%s\n", abb); printf("..%s\n", abb);
if (mode_differs) { 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; inter_name_termination = 0;
if (header) if (header)
puts(header); printf("%s%c", header, line_termination);
for (i = 0; i < num_parent; i++) { for (i = 0; i < num_parent; i++) {
if (p->parent[i].mode) if (p->parent[i].mode)
@ -862,7 +864,7 @@ int show_combined_diff(struct combine_diff_path *p,
default: default:
case DIFF_FORMAT_PATCH: case DIFF_FORMAT_PATCH:
return show_patch_diff(p, num_parent, dense, header); return show_patch_diff(p, num_parent, dense, header, opt);
} }
} }

View file

@ -43,6 +43,11 @@ fetch::
Fetch unfetched revisions from the SVN_URL we are tracking. Fetch unfetched revisions from the SVN_URL we are tracking.
refs/heads/git-svn-HEAD will be updated to the latest revision. 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::
Commit specified commit or tree objects to SVN. This relies on Commit specified commit or tree objects to SVN. This relies on
your imported fetch data being up-to-date. This makes 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:: # Commit only the git commits you want to SVN::
git-svn commit <tree-ish> [<tree-ish_2> ...] git-svn commit <tree-ish> [<tree-ish_2> ...]
# Commit all the git commits from my-branch that don't exist in SVN:: # 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:: # Something is committed to SVN, pull the latest into your branch::
git-svn fetch && git pull . git-svn-HEAD git-svn fetch && git pull . git-svn-HEAD
# Append svn:ignore settings to the default git exclude file: # 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) 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 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 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 ADDITIONAL FETCH ARGUMENTS
-------------------------- --------------------------

View file

@ -162,7 +162,7 @@ class CellRendererGraph(gtk.GenericCellRenderer):
for item in names: for item in names:
names_len += len(item) names_len += len(item)
width = box_size * (cols + 1 ) + names_len width = box_size * (cols + 1 ) + names_len
height = box_size height = box_size
# FIXME I have no idea how to use cell_area properly # FIXME I have no idea how to use cell_area properly
@ -261,11 +261,11 @@ class Commit:
children_sha1 = {} children_sha1 = {}
def __init__(self, commit_lines): def __init__(self, commit_lines):
self.message = "" self.message = ""
self.author = "" self.author = ""
self.date = "" self.date = ""
self.committer = "" self.committer = ""
self.commit_date = "" self.commit_date = ""
self.commit_sha1 = "" self.commit_sha1 = ""
self.parent_sha1 = [ ] self.parent_sha1 = [ ]
self.parse_commit(commit_lines) self.parse_commit(commit_lines)
@ -391,7 +391,7 @@ class DiffWindow:
sourceview.show() 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. """Set the differences showed by this window.
Compares the two trees and populates the window with the Compares the two trees and populates the window with the
differences. differences.
@ -401,7 +401,7 @@ class DiffWindow:
return return
fp = os.popen("git diff-tree -p " + parent_sha1 + " " + commit_sha1) 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() fp.close()
self.window.show() self.window.show()
@ -426,10 +426,11 @@ class GitView:
def __init__(self, with_diff=0): def __init__(self, with_diff=0):
self.with_diff = with_diff 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_border_width(0)
self.window.set_title("Git repository browser") self.window.set_title("Git repository browser")
self.get_encoding()
self.get_bt_sha1() self.get_bt_sha1()
# Use three-quarters of the screen by default # Use three-quarters of the screen by default
@ -468,6 +469,13 @@ class GitView:
self.bt_sha1[sha1].append(name) self.bt_sha1[sha1].append(name)
fp.close() 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): def construct(self):
"""Construct the window contents.""" """Construct the window contents."""
@ -683,7 +691,7 @@ class GitView:
self.revid_label.set_text(revid_label) self.revid_label.set_text(revid_label)
self.committer_label.set_text(committer) self.committer_label.set_text(committer)
self.timestamp_label.set_text(timestamp) 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: for widget in self.parents_widgets:
self.table.remove(widget) self.table.remove(widget)
@ -728,7 +736,7 @@ class GitView:
button.set_relief(gtk.RELIEF_NONE) button.set_relief(gtk.RELIEF_NONE)
button.set_sensitive(True) button.set_sensitive(True)
button.connect("clicked", self._show_clicked_cb, 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) hbox.pack_start(button, expand=False, fill=True)
button.show() button.show()
@ -870,15 +878,15 @@ class GitView:
# Reset nodepostion # Reset nodepostion
if (last_nodepos > 5): if (last_nodepos > 5):
last_nodepos = -1 last_nodepos = -1
# Add the incomplete lines of the last cell in this # Add the incomplete lines of the last cell in this
try: try:
colour = self.colours[commit.commit_sha1] colour = self.colours[commit.commit_sha1]
except KeyError: except KeyError:
self.colours[commit.commit_sha1] = last_colour+1 self.colours[commit.commit_sha1] = last_colour+1
last_colour = self.colours[commit.commit_sha1] last_colour = self.colours[commit.commit_sha1]
colour = self.colours[commit.commit_sha1] colour = self.colours[commit.commit_sha1]
try: try:
node_pos = self.nodepos[commit.commit_sha1] node_pos = self.nodepos[commit.commit_sha1]
@ -910,7 +918,7 @@ class GitView:
self.colours[parent_id] = last_colour+1 self.colours[parent_id] = last_colour+1
last_colour = self.colours[parent_id] last_colour = self.colours[parent_id]
self.nodepos[parent_id] = last_nodepos+1 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], in_line.append((node_pos, self.nodepos[parent_id],
self.colours[parent_id])) self.colours[parent_id]))
@ -946,7 +954,7 @@ class GitView:
try: try:
next_commit = self.commits[index+1] next_commit = self.commits[index+1]
if (next_commit.commit_sha1 == sha1 and pos != int(pos)): 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 # This need to be done only if we modified it
in_line.append((pos, pos-0.5, self.colours[sha1])) in_line.append((pos, pos-0.5, self.colours[sha1]))
continue; continue;
@ -967,10 +975,10 @@ class GitView:
self.treeview.grab_focus() 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.""" """Callback for when the show button for a parent is clicked."""
window = DiffWindow() window = DiffWindow()
window.set_diff(commit_sha1, parent_sha1) window.set_diff(commit_sha1, parent_sha1, encoding)
self.treeview.grab_focus() self.treeview.grab_focus()
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -174,7 +174,7 @@ titleScript='
process_one () { process_one () {
perl -w -e ' perl -w -e '
my ($keep_subject, $num, $signoff, $commsg) = @ARGV; 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); $last_was_signoff);
if ($signoff) { if ($signoff) {
@ -228,6 +228,11 @@ while (<FH>) {
$done_subject = 1; $done_subject = 1;
next; next;
} }
unless ($done_separator) {
print "\n";
$done_separator = 1;
next if (/^$/);
}
$last_was_signoff = 0; $last_was_signoff = 0;
if (/Signed-off-by:/i) { if (/Signed-off-by:/i) {