Use the full path to git-sh-setup and git-parse-remote when
sourcing them.  Do not rely on the no longer existent "git runstatus"
helper.  Teach "git commit --dry-run" a --color option like runstatus
knew.

These changes aren't intended for upstream, at least yet; they just
give a chance to more easily play around with the scripts from
contrib.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 debian/changelog                                   |    4 +
 ...0011-contrib-use-full-path-to-git-sh-setup.diff |  225 ++++++++++++++++++++
 ...-contrib-use-full-path-to-git-parse-remote.diff |   57 +++++
 .../diff/0013-commit-status-add-color-option.diff  |   67 ++++++
 ...mmit-use-commit-dry-run-in-place-of-runsta.diff |   37 ++++
 5 files changed, 390 insertions(+), 0 deletions(-)
 create mode 100644 debian/diff/0011-contrib-use-full-path-to-git-sh-setup.diff
 create mode 100644 
debian/diff/0012-contrib-use-full-path-to-git-parse-remote.diff
 create mode 100644 debian/diff/0013-commit-status-add-color-option.diff
 create mode 100644 
debian/diff/0014-scripted-commit-use-commit-dry-run-in-place-of-runsta.diff

diff --git a/debian/changelog b/debian/changelog
index f95c1ec..c1b4d3f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,10 @@ git (1:1.7.5.1-2~exp0.1) experimental; urgency=low
   * debian/control: package git: Suggests: packages used by programs
     in contrib/ (libgtk2-perl, python, cpio, python-gtk2,
     python-pango, python-gobject, python-cairo).
+  * debian/diff/:
+    - 0011..0014: new; tweak contrib scripts to be usable in the
+      absence of some ancient commands and without including
+      $(git --exec-path) in $PATH.
 
  -- Jonathan Nieder <jrnie...@gmail.com>  Fri, 06 May 2011 23:30:29 -0500
 
diff --git a/debian/diff/0011-contrib-use-full-path-to-git-sh-setup.diff 
b/debian/diff/0011-contrib-use-full-path-to-git-sh-setup.diff
new file mode 100644
index 0000000..626e761
--- /dev/null
+++ b/debian/diff/0011-contrib-use-full-path-to-git-sh-setup.diff
@@ -0,0 +1,225 @@
+From 00c30a76432bcd6ca93b3d0616eb4e3623bcb939 Mon Sep 17 00:00:00 2001
+From: Jonathan Nieder <jrnie...@gmail.com>
+Date: Sat, 7 May 2011 01:11:35 -0500
+Subject: contrib: use full path to git-sh-setup
+
+Allow scripts from contrib/ to be run in place even though
+git-sh-setup is not on the $PATH any more.
+
+Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
+---
+ contrib/examples/git-checkout.sh   |    2 +-
+ contrib/examples/git-clean.sh      |    2 +-
+ contrib/examples/git-commit.sh     |    2 +-
+ contrib/examples/git-fetch.sh      |    2 +-
+ contrib/examples/git-gc.sh         |    2 +-
+ contrib/examples/git-merge.sh      |    2 +-
+ contrib/examples/git-notes.sh      |    2 +-
+ contrib/examples/git-reset.sh      |    2 +-
+ contrib/examples/git-resolve.sh    |    2 +-
+ contrib/examples/git-revert.sh     |    2 +-
+ contrib/examples/git-tag.sh        |    2 +-
+ contrib/examples/git-verify-tag.sh |    2 +-
+ contrib/git-resurrect.sh           |    2 +-
+ contrib/remotes2config.sh          |    2 +-
+ contrib/rerere-train.sh            |    2 +-
+ 15 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/contrib/examples/git-checkout.sh 
b/contrib/examples/git-checkout.sh
+index 1a7689a..fd90f37 100755
+--- a/contrib/examples/git-checkout.sh
++++ b/contrib/examples/git-checkout.sh
+@@ -12,7 +12,7 @@ m           merge local modifications into the new branch
+ q,quiet     be quiet
+ "
+ SUBDIRECTORY_OK=Sometimes
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ require_work_tree
+ 
+ old_name=HEAD
+diff --git a/contrib/examples/git-clean.sh b/contrib/examples/git-clean.sh
+index 01c95e9..715a9eb 100755
+--- a/contrib/examples/git-clean.sh
++++ b/contrib/examples/git-clean.sh
+@@ -20,7 +20,7 @@ x remove ignored files as well
+ X remove only ignored files"
+ 
+ SUBDIRECTORY_OK=Yes
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ require_work_tree
+ 
+ ignored=
+diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh
+index 23ffb02..1b80c8e 100755
+--- a/contrib/examples/git-commit.sh
++++ b/contrib/examples/git-commit.sh
+@@ -6,7 +6,7 @@
+ USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F 
<logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] 
[--template <file>] [[-i | -o] <path>...]'
+ SUBDIRECTORY_OK=Yes
+ OPTIONS_SPEC=
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ require_work_tree
+ 
+ git rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t
+diff --git a/contrib/examples/git-fetch.sh b/contrib/examples/git-fetch.sh
+index a314273..fc28b57 100755
+--- a/contrib/examples/git-fetch.sh
++++ b/contrib/examples/git-fetch.sh
+@@ -3,7 +3,7 @@
+ 
+ USAGE='<fetch-options> <repository> <refspec>...'
+ SUBDIRECTORY_OK=Yes
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ set_reflog_action "fetch $*"
+ cd_to_toplevel ;# probably unnecessary...
+ 
+diff --git a/contrib/examples/git-gc.sh b/contrib/examples/git-gc.sh
+index 1597e9f..5ef329d 100755
+--- a/contrib/examples/git-gc.sh
++++ b/contrib/examples/git-gc.sh
+@@ -6,7 +6,7 @@
+ 
+ USAGE='[--prune]'
+ SUBDIRECTORY_OK=Yes
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ no_prune=:
+ while test $# != 0
+diff --git a/contrib/examples/git-merge.sh b/contrib/examples/git-merge.sh
+index 7b922c3..caff208 100755
+--- a/contrib/examples/git-merge.sh
++++ b/contrib/examples/git-merge.sh
+@@ -23,7 +23,7 @@ m,message=           message to be used for the merge commit 
(if any)
+ "
+ 
+ SUBDIRECTORY_OK=Yes
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ require_work_tree
+ cd_to_toplevel
+ 
+diff --git a/contrib/examples/git-notes.sh b/contrib/examples/git-notes.sh
+index e642e47..96991fb 100755
+--- a/contrib/examples/git-notes.sh
++++ b/contrib/examples/git-notes.sh
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ 
+ USAGE="(edit [-F <file> | -m <msg>] | show) [commit]"
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ test -z "$1" && usage
+ ACTION="$1"; shift
+diff --git a/contrib/examples/git-reset.sh b/contrib/examples/git-reset.sh
+index bafeb52..b59fe31 100755
+--- a/contrib/examples/git-reset.sh
++++ b/contrib/examples/git-reset.sh
+@@ -4,7 +4,7 @@
+ #
+ USAGE='[--mixed | --soft | --hard]  [<commit-ish>] [ [--] <paths>...]'
+ SUBDIRECTORY_OK=Yes
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ set_reflog_action "reset $*"
+ require_work_tree
+ 
+diff --git a/contrib/examples/git-resolve.sh b/contrib/examples/git-resolve.sh
+index 8f98142..9806d09 100755
+--- a/contrib/examples/git-resolve.sh
++++ b/contrib/examples/git-resolve.sh
+@@ -10,7 +10,7 @@ echo 'WARNING: Please use git-merge or git-pull instead.' >&2
+ sleep 2
+ 
+ USAGE='<head> <remote> <merge-message>'
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ dropheads() {
+       rm -f -- "$GIT_DIR/MERGE_HEAD" \
+diff --git a/contrib/examples/git-revert.sh b/contrib/examples/git-revert.sh
+index 6bf155c..19a4341 100755
+--- a/contrib/examples/git-revert.sh
++++ b/contrib/examples/git-revert.sh
+@@ -21,7 +21,7 @@ case "$0" in
+ esac
+ 
+ SUBDIRECTORY_OK=Yes ;# we will cd up
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ require_work_tree
+ cd_to_toplevel
+ 
+diff --git a/contrib/examples/git-tag.sh b/contrib/examples/git-tag.sh
+index 2c15bc9..b20f9a1 100755
+--- a/contrib/examples/git-tag.sh
++++ b/contrib/examples/git-tag.sh
+@@ -3,7 +3,7 @@
+ 
+ USAGE='[-n [<num>]] -l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d | -v] 
[-m <msg>] <tagname> [<head>]'
+ SUBDIRECTORY_OK='Yes'
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ message_given=
+ annotate=
+diff --git a/contrib/examples/git-verify-tag.sh 
b/contrib/examples/git-verify-tag.sh
+index 0902a5c..bd0ca7a 100755
+--- a/contrib/examples/git-verify-tag.sh
++++ b/contrib/examples/git-verify-tag.sh
+@@ -2,7 +2,7 @@
+ 
+ USAGE='<tag>'
+ SUBDIRECTORY_OK='Yes'
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ verbose=
+ while test $# != 0
+diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh
+index a4ed4c3..02eeb63 100755
+--- a/contrib/git-resurrect.sh
++++ b/contrib/git-resurrect.sh
+@@ -22,7 +22,7 @@ m,merges             scan for merges into other branches 
(slow)
+ t,merge-targets      scan for merges of other branches into <name>
+ n,dry-run            don't recreate the branch"
+ 
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ search_reflog () {
+         sed -ne 's~^\([^ ]*\) .*\tcheckout: moving from '"$1"' .*~\1~p' \
+diff --git a/contrib/remotes2config.sh b/contrib/remotes2config.sh
+index 1cda19f..26a812d 100755
+--- a/contrib/remotes2config.sh
++++ b/contrib/remotes2config.sh
+@@ -2,7 +2,7 @@
+ 
+ # Use this tool to rewrite your .git/remotes/ files into the config.
+ 
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ 
+ if [ -d "$GIT_DIR"/remotes ]; then
+       echo "Rewriting $GIT_DIR/remotes" >&2
+diff --git a/contrib/rerere-train.sh b/contrib/rerere-train.sh
+index 2cfe1b9..52ad9e4 100755
+--- a/contrib/rerere-train.sh
++++ b/contrib/rerere-train.sh
+@@ -7,7 +7,7 @@ USAGE="$me rev-list-args"
+ 
+ SUBDIRECTORY_OK=Yes
+ OPTIONS_SPEC=
+-. git-sh-setup
++. "$(git --exec-path)/git-sh-setup"
+ require_work_tree
+ cd_to_toplevel
+ 
+-- 
+1.7.5
+
diff --git a/debian/diff/0012-contrib-use-full-path-to-git-parse-remote.diff 
b/debian/diff/0012-contrib-use-full-path-to-git-parse-remote.diff
new file mode 100644
index 0000000..5d4db79
--- /dev/null
+++ b/debian/diff/0012-contrib-use-full-path-to-git-parse-remote.diff
@@ -0,0 +1,57 @@
+From 9c74fce7a2a926d01f940350c4d1f7fa3b32c218 Mon Sep 17 00:00:00 2001
+From: Jonathan Nieder <jrnie...@gmail.com>
+Date: Sat, 7 May 2011 01:45:40 -0500
+Subject: contrib: use full path to git-parse-remote
+
+Another step toward allowing scripts from contrib/ to be tried out
+as is even though git-sh-setup does not lie on the $PATH any more.
+
+Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
+---
+ contrib/examples/git-clone.sh     |    2 +-
+ contrib/examples/git-fetch.sh     |    2 +-
+ contrib/examples/git-ls-remote.sh |    2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/contrib/examples/git-clone.sh b/contrib/examples/git-clone.sh
+index 547228e..e656c0f 100755
+--- a/contrib/examples/git-clone.sh
++++ b/contrib/examples/git-clone.sh
+@@ -360,7 +360,7 @@ yes)
+               if test -f "$GIT_DIR/TMP_ALT"
+               then
+                   ( cd "$D" &&
+-                    . git-parse-remote &&
++                    . "$(git --exec-path)/git-parse-remote" &&
+                     resolve_alternates "$repo" <"$GIT_DIR/TMP_ALT" ) |
+                   while read alt
+                   do
+diff --git a/contrib/examples/git-fetch.sh b/contrib/examples/git-fetch.sh
+index fc28b57..423251b 100755
+--- a/contrib/examples/git-fetch.sh
++++ b/contrib/examples/git-fetch.sh
+@@ -7,7 +7,7 @@ SUBDIRECTORY_OK=Yes
+ set_reflog_action "fetch $*"
+ cd_to_toplevel ;# probably unnecessary...
+ 
+-. git-parse-remote
++. "$(git --exec-path)/git-parse-remote"
+ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
+ 
+diff --git a/contrib/examples/git-ls-remote.sh 
b/contrib/examples/git-ls-remote.sh
+index fec70bb..d2a0784 100755
+--- a/contrib/examples/git-ls-remote.sh
++++ b/contrib/examples/git-ls-remote.sh
+@@ -44,7 +44,7 @@ case ",$heads,$tags," in
+ ,,,) heads=heads tags=tags other=other ;;
+ esac
+ 
+-. git-parse-remote
++. "$(git --exec-path)/git-parse-remote"
+ peek_repo="$(get_remote_url "$@")"
+ shift
+ 
+-- 
+1.7.5
+
diff --git a/debian/diff/0013-commit-status-add-color-option.diff 
b/debian/diff/0013-commit-status-add-color-option.diff
new file mode 100644
index 0000000..f49ff33
--- /dev/null
+++ b/debian/diff/0013-commit-status-add-color-option.diff
@@ -0,0 +1,67 @@
+From 24a316ff72063ce1430231c9774f7aeb576779ce Mon Sep 17 00:00:00 2001
+From: Jonathan Nieder <jrnie...@gmail.com>
+Date: Sat, 7 May 2011 01:33:52 -0500
+Subject: commit/status: add --color option
+
+The ancient "git runstatus" supported a --color / --nocolor option to
+turn on or off colored output.  Nowadays there is a "[color] status"
+configuration variable controlling the same but no commandline option
+(aside from -c) to override it in a particular invocation; let's bring
+back --color to take fill that gap.
+
+In the -v case, it controls whether the diff is colored, too.
+
+Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
+---
+ builtin/commit.c |    7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git a/builtin/commit.c b/builtin/commit.c
+index 67757e9..32b4a6e 100644
+--- a/builtin/commit.c
++++ b/builtin/commit.c
+@@ -104,6 +104,7 @@ static char *cleanup_arg;
+ static enum commit_whence whence;
+ static int use_editor = 1, initial_commit, include_status = 1;
+ static int show_ignored_in_status;
++static int use_color_in_status = -1;
+ static const char *only_include_assumed;
+ static struct strbuf message;
+ 
+@@ -155,6 +156,7 @@ static struct option builtin_commit_options[] = {
+       OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
+       OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
+       OPT_BOOLEAN(0, "dry-run", &dry_run, "show what would be committed"),
++      OPT__COLOR(&use_color_in_status, "use colored output"),
+       OPT_SET_INT(0, "short", &status_format, "show status concisely",
+                   STATUS_FORMAT_SHORT),
+       OPT_BOOLEAN(0, "branch", &status_show_branch, "show branch 
information"),
+@@ -1067,6 +1069,8 @@ static int parse_and_validate_options(int argc, const 
char *argv[],
+       else if (interactive && argc > 0)
+               die(_("Paths with --interactive does not make sense."));
+ 
++      if (use_color_in_status != -1)
++              s->use_color = diff_use_color_default = use_color_in_status;
+       if (null_termination && status_format == STATUS_FORMAT_LONG)
+               status_format = STATUS_FORMAT_PORCELAIN;
+       if (status_format != STATUS_FORMAT_LONG)
+@@ -1168,6 +1172,7 @@ int cmd_status(int argc, const char **argv, const char 
*prefix)
+                           STATUS_FORMAT_PORCELAIN),
+               OPT_BOOLEAN('z', "null", &null_termination,
+                           "terminate entries with NUL"),
++              OPT__COLOR(&use_color_in_status, "use colored output"),
+               { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
+                 "mode",
+                 "show untracked files, optional modes: all, normal, no. 
(Default: all)",
+@@ -1196,6 +1201,8 @@ int cmd_status(int argc, const char **argv, const char 
*prefix)
+       handle_untracked_files_arg(&s);
+       if (show_ignored_in_status)
+               s.show_ignored_files = 1;
++      if (use_color_in_status != -1)
++              s.use_color = diff_use_color_default = use_color_in_status;
+       if (*argv)
+               s.pathspec = get_pathspec(prefix, argv);
+ 
+-- 
+1.7.5
+
diff --git 
a/debian/diff/0014-scripted-commit-use-commit-dry-run-in-place-of-runsta.diff 
b/debian/diff/0014-scripted-commit-use-commit-dry-run-in-place-of-runsta.diff
new file mode 100644
index 0000000..743443e
--- /dev/null
+++ 
b/debian/diff/0014-scripted-commit-use-commit-dry-run-in-place-of-runsta.diff
@@ -0,0 +1,37 @@
+From 4c90ea8f735658c0a17ffaf7f3a6d8ec822d021a Mon Sep 17 00:00:00 2001
+From: Jonathan Nieder <jrnie...@gmail.com>
+Date: Sat, 7 May 2011 01:15:47 -0500
+Subject: scripted commit: use "commit --dry-run" in place of runstatus
+
+git runstatus was retired with v1.5.4-rc0~78^2~30 (Port git commit
+to C., 2007-11-08).  The modern way to get its output is using the
+--dry-run option to the built-in commit.
+
+Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
+---
+ contrib/examples/git-commit.sh |    8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh
+index 1b80c8e..942cfde 100755
+--- a/contrib/examples/git-commit.sh
++++ b/contrib/examples/git-commit.sh
+@@ -54,9 +54,13 @@ run_status () {
+       if test "$status_only" = "t" -o "$use_status_color" = "t"; then
+               color=
+       else
+-              color=--nocolor
++              color=--no-color
+       fi
+-      git runstatus ${color} \
++
++      # In ancient times, this used a "git runstatus" helper.
++      # Now that functionality is in git commit --dry-run, hence
++      # the funny self-reference.
++      git commit --dry-run ${color} \
+               ${verbose:+--verbose} \
+               ${amend:+--amend} \
+               ${untracked_files:+--untracked}
+-- 
+1.7.5
+
-- 
1.7.5.1.668.gce6e7.dirty




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to