aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/blameview/blameview.perl2
-rwxr-xr-xcontrib/completion/git-completion.bash2
-rw-r--r--contrib/emacs/git.el24
-rwxr-xr-xcontrib/examples/git-resolve.sh112
-rwxr-xr-xcontrib/fast-import/import-tars.perl9
5 files changed, 137 insertions, 12 deletions
diff --git a/contrib/blameview/blameview.perl b/contrib/blameview/blameview.perl
index a9a509feb..1dec00137 100755
--- a/contrib/blameview/blameview.perl
+++ b/contrib/blameview/blameview.perl
@@ -41,7 +41,7 @@ $fileview->set_rules_hint(1);
$fileview->signal_connect (row_activated => sub {
my ($sl, $path, $column) = @_;
my $row_ref = $sl->get_row_data_from_path ($path);
- system("blameview @$row_ref[0] $fn &");
+ system("blameview @$row_ref[0]~1 $fn &");
});
my $commitwindow = Gtk2::ScrolledWindow->new();
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5d3d40205..7c0340348 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -269,7 +269,6 @@ __git_commands ()
cvsimport) : import;;
cvsserver) : daemon;;
daemon) : daemon;;
- diff-stages) : nobody uses it;;
fast-import) : import;;
fsck-objects) : plumbing;;
fetch-pack) : plumbing;;
@@ -298,7 +297,6 @@ __git_commands ()
reflog) : plumbing;;
repo-config) : plumbing;;
rerere) : plumbing;;
- resolve) : dead dont use;;
rev-list) : plumbing;;
rev-parse) : plumbing;;
runstatus) : plumbing;;
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 24629eb3e..13d198229 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -75,10 +75,11 @@ then to `add-log-mailing-address' and then to `user-mail-address'."
:type '(choice (const :tag "Default" nil)
(string :tag "Email")))
-(defcustom git-commits-coding-system 'utf-8
+(defcustom git-commits-coding-system nil
"Default coding system for the log message of git commits."
:group 'git
- :type 'coding-system)
+ :type '(choice (const :tag "From repository config" nil)
+ (coding-system)))
(defcustom git-append-signed-off-by nil
"Whether to append a Signed-off-by line to the commit message before editing."
@@ -236,6 +237,15 @@ and returns the process output as a string."
(and (fboundp 'user-mail-address) (user-mail-address))
(and (boundp 'user-mail-address) user-mail-address)))
+(defun git-get-commits-coding-system ()
+ "Return the coding system to use for commits."
+ (let ((repo-config (git-config "i18n.commitencoding")))
+ (or git-commits-coding-system
+ (and repo-config
+ (fboundp 'locale-charset-to-coding-system)
+ (locale-charset-to-coding-system repo-config))
+ 'utf-8)))
+
(defun git-escape-file-name (name)
"Escape a file name if necessary."
(if (string-match "[\n\t\"\\]" name)
@@ -327,7 +337,7 @@ and returns the process output as a string."
"Call git-commit-tree with buffer as input and return the resulting commit SHA1."
(let ((author-name (git-get-committer-name))
(author-email (git-get-committer-email))
- author-date log-start log-end args)
+ author-date log-start log-end args coding-system-for-write)
(when head
(push "-p" args)
(push head args))
@@ -350,12 +360,12 @@ and returns the process output as a string."
(push "-p" args)
(push (match-string 1) args))))
(setq log-start (point-min)))
- (setq log-end (point-max)))
+ (setq log-end (point-max))
+ (setq coding-system-for-write buffer-file-coding-system))
(git-get-string-sha1
(with-output-to-string
(with-current-buffer standard-output
- (let ((coding-system-for-write git-commits-coding-system)
- (env `(("GIT_AUTHOR_NAME" . ,author-name)
+ (let ((env `(("GIT_AUTHOR_NAME" . ,author-name)
("GIT_AUTHOR_EMAIL" . ,author-email)
("GIT_COMMITTER_NAME" . ,(git-get-committer-name))
("GIT_COMMITTER_EMAIL" . ,(git-get-committer-email)))))
@@ -888,6 +898,7 @@ and returns the process output as a string."
(let ((buffer (get-buffer-create "*git-commit*"))
(merge-heads (git-get-merge-heads))
(dir default-directory)
+ (coding-system (git-get-commits-coding-system))
(sign-off git-append-signed-off-by))
(with-current-buffer buffer
(when (eq 0 (buffer-size))
@@ -912,6 +923,7 @@ and returns the process output as a string."
(git-get-committer-name) (git-get-committer-email)))))))
(log-edit #'git-do-commit nil #'git-log-edit-files buffer)
(setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
+ (setq buffer-file-coding-system coding-system)
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t)))
(defun git-find-file ()
diff --git a/contrib/examples/git-resolve.sh b/contrib/examples/git-resolve.sh
new file mode 100755
index 000000000..36b90e384
--- /dev/null
+++ b/contrib/examples/git-resolve.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Linus Torvalds
+#
+# Resolve two trees.
+#
+
+echo 'WARNING: This command is DEPRECATED and will be removed very soon.' >&2
+echo 'WARNING: Please use git-merge or git-pull instead.' >&2
+sleep 2
+
+USAGE='<head> <remote> <merge-message>'
+. git-sh-setup
+
+dropheads() {
+ rm -f -- "$GIT_DIR/MERGE_HEAD" \
+ "$GIT_DIR/LAST_MERGE" || exit 1
+}
+
+head=$(git-rev-parse --verify "$1"^0) &&
+merge=$(git-rev-parse --verify "$2"^0) &&
+merge_name="$2" &&
+merge_msg="$3" || usage
+
+#
+# The remote name is just used for the message,
+# but we do want it.
+#
+if [ -z "$head" -o -z "$merge" -o -z "$merge_msg" ]; then
+ usage
+fi
+
+dropheads
+echo $head > "$GIT_DIR"/ORIG_HEAD
+echo $merge > "$GIT_DIR"/LAST_MERGE
+
+common=$(git-merge-base $head $merge)
+if [ -z "$common" ]; then
+ die "Unable to find common commit between" $merge $head
+fi
+
+case "$common" in
+"$merge")
+ echo "Already up-to-date. Yeeah!"
+ dropheads
+ exit 0
+ ;;
+"$head")
+ echo "Updating $(git-rev-parse --short $head)..$(git-rev-parse --short $merge)"
+ git-read-tree -u -m $head $merge || exit 1
+ git-update-ref -m "resolve $merge_name: Fast forward" \
+ HEAD "$merge" "$head"
+ git-diff-tree -p $head $merge | git-apply --stat
+ dropheads
+ exit 0
+ ;;
+esac
+
+# We are going to make a new commit.
+git var GIT_COMMITTER_IDENT >/dev/null || exit
+
+# Find an optimum merge base if there are more than one candidates.
+LF='
+'
+common=$(git-merge-base -a $head $merge)
+case "$common" in
+?*"$LF"?*)
+ echo "Trying to find the optimum merge base."
+ G=.tmp-index$$
+ best=
+ best_cnt=-1
+ for c in $common
+ do
+ rm -f $G
+ GIT_INDEX_FILE=$G git-read-tree -m $c $head $merge \
+ 2>/dev/null || continue
+ # Count the paths that are unmerged.
+ cnt=`GIT_INDEX_FILE=$G git-ls-files --unmerged | wc -l`
+ if test $best_cnt -le 0 -o $cnt -le $best_cnt
+ then
+ best=$c
+ best_cnt=$cnt
+ if test "$best_cnt" -eq 0
+ then
+ # Cannot do any better than all trivial merge.
+ break
+ fi
+ fi
+ done
+ rm -f $G
+ common="$best"
+esac
+
+echo "Trying to merge $merge into $head using $common."
+git-update-index --refresh 2>/dev/null
+git-read-tree -u -m $common $head $merge || exit 1
+result_tree=$(git-write-tree 2> /dev/null)
+if [ $? -ne 0 ]; then
+ echo "Simple merge failed, trying Automatic merge"
+ git-merge-index -o git-merge-one-file -a
+ if [ $? -ne 0 ]; then
+ echo $merge > "$GIT_DIR"/MERGE_HEAD
+ die "Automatic merge failed, fix up by hand"
+ fi
+ result_tree=$(git-write-tree) || exit 1
+fi
+result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge)
+echo "Committed merge $result_commit"
+git-update-ref -m "resolve $merge_name: In-index merge" \
+ HEAD "$result_commit" "$head"
+git-diff-tree -p $head $result_commit | git-apply --stat
+dropheads
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index 990c9e70b..5585a8b2c 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -25,11 +25,14 @@ foreach my $tar_file (@ARGV)
my $tar_name = $1;
if ($tar_name =~ s/\.(tar\.gz|tgz)$//) {
- open(I, '-|', 'gzcat', $tar_file) or die "Unable to gzcat $tar_file: $!\n";
+ open(I, '-|', 'gunzip', '-c', $tar_file)
+ or die "Unable to gunzip -c $tar_file: $!\n";
} elsif ($tar_name =~ s/\.(tar\.bz2|tbz2)$//) {
- open(I, '-|', 'bzcat', $tar_file) or die "Unable to bzcat $tar_file: $!\n";
+ open(I, '-|', 'bunzip2', '-c', $tar_file)
+ or die "Unable to bunzip2 -c $tar_file: $!\n";
} elsif ($tar_name =~ s/\.tar\.Z$//) {
- open(I, '-|', 'zcat', $tar_file) or die "Unable to zcat $tar_file: $!\n";
+ open(I, '-|', 'uncompress', '-c', $tar_file)
+ or die "Unable to uncompress -c $tar_file: $!\n";
} elsif ($tar_name =~ s/\.tar$//) {
open(I, $tar_file) or die "Unable to open $tar_file: $!\n";
} else {