* [PATCH 20/25] git-reset: Use $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-reset.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
33cc93a9e686c0daa64e430bf44b441809fd1025
diff --git a/git-reset.sh b/git-reset.sh
index 72ef303..58600fc 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -2,7 +2,7 @@
. git-sh-setup
usage () {
- die 'Usage: git reset [--mixed | --soft | --hard] [<commit-ish>]'
+ die 'usage: $0 [--mixed | --soft | --hard] [<commit-ish>]'
}
tmp=/var/tmp/reset.$$
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 19/25] git-request-pull: Print usage message to stderr.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-request-pull.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
342b45c20724b86b1b12c3f588d6aff12c1ceb11
diff --git a/git-request-pull.sh b/git-request-pull.sh
index ae6cd27..e199a91 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -6,9 +6,9 @@
usage()
{
- echo "$0 <commit> <url> [ <head> ]"
- echo " Summarizes the changes since <commit> to the standard output,"
- echo " and includes <url> in the message generated."
+ echo >&2 "usage: $0 <commit> <url> [<head>]"
+ echo >&2 ' Summarizes the changes since <commit> to the standard output,'
+ echo >&2 ' and includes <url> in the message generated.'
exit 1
}
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 0/25] Usage message clean-up
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: freku045
This patch series is supposed to clean-up usage strings in *.sh and
*.perl. I have gone through most of the scripts, but have left the
following programs for various reasons.
No obvious fix:
git-log.sh
git-parse-remote.sh
git-rebase.sh
Still todo:
git-archimport.perl
git-cvsexportcommit.perl
git-cvsimport.perl
git-svnimport.perl
git-applymbox.sh
git-applypatch.sh
git-fmt-merge-msg.perl
cmd-rename.sh
git-ls-remote.sh
git-merge-octopus.sh
git-merge-one-file.sh
git-merge-ours.sh
git-merge-resolve.sh
git-merge-stupid.sh
git-octopus.sh
git-parse-remote.sh
I have tried to follow the following rules:
* Any unrecognised options should make the script die with the usage
message.
* -h and --help makes the script die with the usage message.
* The message is printed to stderr.
* The message is of the form "usage: $0 options"
I am not convinced that the last bullet point is the best way to do
things. Using "$0" is probably best for Git developers but using "git
program-name" is probably least confusing for users, especially if we
are going to move the git-* binaries away from /usr/bin. Another
option is "basename $0". What do you think?
--
Documentation/git-revert.txt | 2 +
git-bisect.sh | 2 +
git-branch.sh | 2 +
git-checkout.sh | 2 +
git-cherry.sh | 18 ++++++++++--
git-clone.sh | 2 +
git-commit.sh | 2 +
git-count-objects.sh | 11 +++++++
git-fetch.sh | 8 +++++
git-format-patch.sh | 3 +-
git-grep.sh | 11 ++++++-
git-lost-found.sh | 12 +++++++-
git-merge.sh | 2 +
git-mv.perl | 10 ++++++-
git-prune.sh | 2 +
git-pull.sh | 3 +-
git-push.sh | 2 +
git-relink.perl | 10 +++----
git-repack.sh | 7 ++++-
git-request-pull.sh | 6 ++--
git-reset.sh | 2 +
git-revert.sh | 4 +--
git-send-email.perl | 62 +++++++++++++++++++++++-------------------
git-status.sh | 12 +++++++-
git-tag.sh | 10 +------
git-verify-tag.sh | 10 +++----
26 files changed, 142 insertions(+), 75 deletions(-)
- Fredrik
^ permalink raw reply
* [PATCH 17/25] git-relink: Print usage message to stderr.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-relink.perl | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
c8f3a2016fcd16470507af70bf4de17de3881f6f
diff --git a/git-relink.perl b/git-relink.perl
index f6b4f6a..816e238 100755
--- a/git-relink.perl
+++ b/git-relink.perl
@@ -163,11 +163,11 @@ sub link_two_files($$) {
sub usage() {
- print("Usage: $0 [--safe] <dir> [<dir> ...] <master_dir> \n");
- print("All directories should contain a .git/objects/ subdirectory.\n");
- print("Options\n");
- print("\t--safe\t" .
+ print STDERR "usage: $0 [--safe] <dir> [<dir>...] <master_dir>\n";
+ print STDERR "All directories should contain a .git/objects/ subdirectory.\n";
+ print STDERR "Options\n";
+ print STDERR "\t--safe\t" .
"Stops if two objects with the same hash exist but " .
- "have different sizes. Default is to warn and continue.\n");
+ "have different sizes. Default is to warn and continue.\n";
exit(1);
}
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 10/25] git-grep: Print usage message on '-h' and '--help'.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-grep.sh | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
b375c3ad7c6ce4d6cda208c61828f8ff72cb7d53
diff --git a/git-grep.sh b/git-grep.sh
index 44c1613..e6acc41 100755
--- a/git-grep.sh
+++ b/git-grep.sh
@@ -3,6 +3,11 @@
# Copyright (c) Linus Torvalds, 2005
#
+usage () {
+ echo >&2 "usage: $0 <option>... <pattern> [pathspec*]"
+ exit 1
+}
+
pattern=
flags=()
git_flags=()
@@ -26,6 +31,9 @@ while : ; do
shift
break
;;
+ -h|--h|--he|--hel|--help)
+ usage
+ ;;
-*)
flags=("${flags[@]}" "$1")
;;
@@ -40,8 +48,7 @@ while : ; do
shift
done
[ "$pattern" ] || {
- echo >&2 "usage: 'git grep <pattern> [pathspec*]'"
- exit 1
+ usage
}
git-ls-files -z "${git_flags[@]}" "$@" |
xargs -0 grep "${flags[@]}" -e "$pattern"
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 5/25] git-clone: Use $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-clone.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
028cbc161562fae23c9797564c8d50da6c082941
diff --git a/git-clone.sh b/git-clone.sh
index 699205e..d07e4d9 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -9,7 +9,7 @@
unset CDPATH
usage() {
- echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]"
+ echo >&2 "usage: $0 [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]"
exit 1
}
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 24/25] git-verify-tag: Clean-up usage message.
From: freku045 @ 2005-12-10 19:38 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-verify-tag.sh | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
54db71ed3add0583463d77645e840ef61c8c6d9c
diff --git a/git-verify-tag.sh b/git-verify-tag.sh
index 1f44da5..aff7c68 100755
--- a/git-verify-tag.sh
+++ b/git-verify-tag.sh
@@ -1,14 +1,14 @@
#!/bin/sh
-GIT_DIR=`git-rev-parse --git-dir` || exit $?
+. git-sh-setup
-die () {
- echo >&2 "$*"
- exit 1
+usage () {
+ echo >&2 "usage: $0 [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]"
+ die "$@"
}
type="$(git-cat-file -t "$1" 2>/dev/null)" ||
- die "$1: no such object."
+ usage "$1: no such object."
test "$type" = tag ||
die "$1: cannot verify a non-tag object of type $type."
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 18/25] git-repack: Print usage message on unrecognized option.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-repack.sh | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
3616296531a068dcbe5a39f8864ddde3b3067969
diff --git a/git-repack.sh b/git-repack.sh
index 430ddc5..9752032 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -4,7 +4,11 @@
#
. git-sh-setup
-
+
+usage () {
+ die "usage: $0 [-a] [-d] [-l] [-n]"
+}
+
no_update_info= all_into_one= remove_redundant= local=
while case "$#" in 0) break ;; esac
do
@@ -13,6 +17,7 @@ do
-a) all_into_one=t ;;
-d) remove_redundant=t ;;
-l) local=t ;;
+ -*) usage ;;
*) break ;;
esac
shift
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 22/25] git-status: Print usage message on incorrect invocation.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-status.sh | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
5bce9bb1977eea80398f894880340f10bdc9a2eb
diff --git a/git-status.sh b/git-status.sh
index 2dda0c5..4ba6cc2 100755
--- a/git-status.sh
+++ b/git-status.sh
@@ -2,7 +2,17 @@
#
# Copyright (c) 2005 Linus Torvalds
#
-GIT_DIR=$(git-rev-parse --git-dir) || exit
+
+. git-sh-setup
+
+usage () {
+ die "usage: $0"
+}
+
+if [ "$#" != "0" ]
+then
+ usage
+fi
report () {
header="#
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 23/25] git-tag: Clean-up usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-tag.sh | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
3a3150d9fbd640ffb269fc49a322c04466e700f5
diff --git a/git-tag.sh b/git-tag.sh
index 2435a75..f4a0150 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -1,16 +1,10 @@
#!/bin/sh
# Copyright (c) 2005 Linus Torvalds
-GIT_DIR=`git-rev-parse --git-dir` || exit $?
+. git-sh-setup
usage () {
- echo >&2 "Usage: git-tag [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]"
- exit 1
-}
-
-die () {
- echo >&2 "$*"
- exit 1
+ die "usage: $0 [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]"
}
annotate=
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 21/25] git-send-email: Usage message clean-up.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-send-email.perl | 62 ++++++++++++++++++++++++++++-----------------------
1 files changed, 34 insertions(+), 28 deletions(-)
38fde073a59d00a19111a30e8f804c4e784835e7
diff --git a/git-send-email.perl b/git-send-email.perl
index ec1428d..5f6b729 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -27,6 +27,38 @@ use Email::Valid;
sub unique_email_list(@);
sub cleanup_compose_files();
+sub usage {
+ print <<EOT;
+$0 [options] <file | directory> [... file | directory ]
+Options:
+ --from Specify the "From:" line of the email to be sent.
+
+ --to Specify the primary "To:" line of the email.
+
+ --compose Use \$EDITOR to edit an introductory message for the
+ patch series.
+
+ --subject Specify the initial "Subject:" line.
+ Only necessary if --compose is also set. If --compose
+ is not set, this will be prompted for.
+
+ --in-reply-to Specify the first "In-Reply-To:" header line.
+ Only used if --compose is also set. If --compose is not
+ set, this will be prompted for.
+
+ --chain-reply-to If set, the replies will all be to the previous
+ email sent, rather than to the first email sent.
+ Defaults to on.
+
+ --smtp-server If set, specifies the outgoing SMTP server to use.
+ Defaults to localhost.
+EOT
+
+ print $_[0], "\n" if defined $_[0];
+
+ exit(1);
+}
+
# Constants (essentially)
my $compose_filename = ".msg.$$";
@@ -51,6 +83,7 @@ my $rc = GetOptions("from=s" => \$from,
"chain-reply-to!" => \$chain_reply_to,
"smtp-server=s" => \$smtp_server,
"compose" => \$compose,
+ "help|h" => sub { usage; },
);
# Now, let's fill any that aren't set in with defaults:
@@ -187,34 +220,7 @@ for my $f (@ARGV) {
if (@files) {
print $_,"\n" for @files;
} else {
- print <<EOT;
-git-send-email [options] <file | directory> [... file | directory ]
-Options:
- --from Specify the "From:" line of the email to be sent.
-
- --to Specify the primary "To:" line of the email.
-
- --compose Use \$EDITOR to edit an introductory message for the
- patch series.
-
- --subject Specify the initial "Subject:" line.
- Only necessary if --compose is also set. If --compose
- is not set, this will be prompted for.
-
- --in-reply-to Specify the first "In-Reply-To:" header line.
- Only used if --compose is also set. If --compose is not
- set, this will be prompted for.
-
- --chain-reply-to If set, the replies will all be to the previous
- email sent, rather than to the first email sent.
- Defaults to on.
-
- --smtp-server If set, specifies the outgoing SMTP server to use.
- Defaults to localhost.
-
-Error: Please specify a file or a directory on the command line.
-EOT
- exit(1);
+ usage "Error: Please specify a file or a directory on the command line.";
}
# Variables we set as part of the loop over files
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 12/25] git-lost-found: Print usage message on incorrect invocation.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-lost-found.sh | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
2b2c389a8816f40cfa5b562203988b0c0b2269c5
diff --git a/git-lost-found.sh b/git-lost-found.sh
index 2beec2a..757e51f 100755
--- a/git-lost-found.sh
+++ b/git-lost-found.sh
@@ -1,6 +1,16 @@
#!/bin/sh
-GIT_DIR=`git-rev-parse --git-dir` || exit $?
+. git-sh-setup
+
+usage () {
+ die "usage: $0"
+}
+
+if [ "$#" != "0" ]
+then
+ usage
+fi
+
laf="$GIT_DIR/lost-found"
rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 13/25] git-merge: Print $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-merge.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
ea22e6b3b15294ae1c6f367b109ee3f969b115c8
diff --git a/git-merge.sh b/git-merge.sh
index a221daa..f7aca19 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -9,7 +9,7 @@ LF='
'
usage () {
- die "git-merge [-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+"
+ die "usage: $0 [-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+"
}
all_strategies='recursive octopus resolve stupid ours'
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 6/25] git-commit: Use $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-commit.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
2b859132aeae56504c0d7aaa99436dce9dac2117
diff --git a/git-commit.sh b/git-commit.sh
index 3d250ec..1893f98 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -6,7 +6,7 @@
. git-sh-setup
usage () {
- die 'git commit [-a] [-s] [-v | --no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-e] [<path>...]'
+ die "usage: $0 [-a] [-s] [-v | --no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-e] [<path>...]"
}
all= logfile= use_commit= no_edit= log_given= log_message= verify=t signoff=
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 9/25] git-format-patch: Use the 'die'-function where appropriate.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-format-patch.sh | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
78267845f0e0d20f23448692bf3ff967faf5fea7
diff --git a/git-format-patch.sh b/git-format-patch.sh
index 1eebe85..4ecbf49 100755
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
@@ -10,7 +10,7 @@ LANG=C LC_ALL=C
export LANG LC_ALL
usage () {
- echo >&2 "usage: $0"' [-n] [-o dir | --stdout] [--keep-subject] [--mbox]
+ die "usage: $0"' [-n] [-o dir | --stdout] [--keep-subject] [--mbox]
[--check] [--signoff] [-<diff options>...]
[--help]
( from..to ... | upstream [ our-head ] )
@@ -30,7 +30,6 @@ When --mbox is specified, the output is
UNIX mailbox format, and can be concatenated together for processing
with applymbox.
'
- exit 1
}
diff_opts=
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 4/25] git-cherry: Print the usage message if we get an unknown option.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-cherry.sh | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
10b829123619b4b3c398398726c830db87f7525a
diff --git a/git-cherry.sh b/git-cherry.sh
index 867522b..c21cf65 100755
--- a/git-cherry.sh
+++ b/git-cherry.sh
@@ -5,7 +5,8 @@
. git-sh-setup
-usage="usage: $0 "'[-v] <upstream> [<head>]
+usage () {
+ die "usage: $0 "'[-v] <upstream> [<head>]
__*__*__*__*__> <upstream>
/
@@ -18,8 +19,19 @@ compared against the change each commit
it is shown on the standard output with prefix "+". Otherwise
it is shown with prefix "-".
'
+}
-case "$1" in -v) verbose=t; shift ;; esac
+while [ "$#" != "0" ]; do
+ case "$1" in
+ "-v")
+ verbose=t;
+ shift
+ ;;
+ -*)
+ usage
+ ;;
+ esac
+done
case "$#,$1" in
1,*..*)
@@ -35,7 +47,7 @@ case "$#" in
2) upstream=`git-rev-parse --verify "$1"` &&
ours=`git-rev-parse --verify "$2"` || exit
;;
-*) echo >&2 "$usage"; exit 1 ;;
+*) usage ;;
esac
# Note that these list commits in reverse order;
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 3/25] git-checkout: Use $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-checkout.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
480ea8310be08611c841ae428c57003ac48c1827
diff --git a/git-checkout.sh b/git-checkout.sh
index 4cf30e2..2fcd766 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -2,7 +2,7 @@
. git-sh-setup
usage () {
- die "usage: git checkout [-f] [-b <new_branch>] [<branch>] [<paths>...]"
+ die "usage: $0 [-f] [-b <new_branch>] [<branch>] [<paths>...]"
}
old=$(git-rev-parse HEAD)
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 1/25] git-bisect: Use $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-bisect.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
fdaaf0b14e5df17cbeef9e89ff85f33e3dcaa4d6
diff --git a/git-bisect.sh b/git-bisect.sh
index 05dae8a..6ec35ab 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -12,7 +12,7 @@ sq() {
}
usage() {
- echo >&2 'usage: git bisect [start|bad|good|next|reset|visualize]
+ echo >&2 'usage: $0 [start|bad|good|next|reset|visualize]
git bisect start [<pathspec>] reset bisect state and start bisection.
git bisect bad [<rev>] mark <rev> a known-bad revision.
git bisect good [<rev>...] mark <rev>... known-good revisions.
--
0.99.9.GIT
^ permalink raw reply related
* [PATCH 2/25] git-branch: Use $0 instead of program name in usage message.
From: freku045 @ 2005-12-10 19:37 UTC (permalink / raw)
To: git; +Cc: Fredrik Kuivinen
In-Reply-To: <1134243476675-git-send-email-freku045@student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
git-branch.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
57d5239afe20cda3f902d2deab4cd3777f82eca6
diff --git a/git-branch.sh b/git-branch.sh
index 5306b27..90a1b5b 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -8,7 +8,7 @@ die () {
}
usage () {
- echo >&2 "usage: $(basename $0)"' [-d <branch>] | [[-f] <branch> [start-point]]
+ echo >&2 "usage: $0"' [-d <branch>] | [[-f] <branch> [start-point]]
If no arguments, show available branches and mark current branch with a star.
If one argument, create a new branch <branchname> based off of current HEAD.
--
0.99.9.GIT
^ permalink raw reply related
* Latest cogito broken with bash-3.1
From: Marcel Holtmann @ 2005-12-10 13:18 UTC (permalink / raw)
To: git
Hi Petr,
I have a Ubuntu Dapper running and since their update to the latest bash
version the cg-commit command (and maybe others) is broken. It reports:
GNU bash, version 3.1.0(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
The cogito is the latest from kernel.org and when calling cg-commit it
fails with this message:
cg-commit: line 200: syntax error near unexpected token `('
cg-commit: line 200: ` eval commitfiles=($(cat $filter | path_xargs git-diff-index -r -m HEAD -- | \'
I played a little bit with it and it seems all the eval statements are
broken with this bash version. I have no clue how to fix this, but maybe
you do.
Regards
Marcel
^ permalink raw reply
* Re: as promised, docs: git for the confused
From: linux @ 2005-12-10 10:56 UTC (permalink / raw)
To: junkio, linux; +Cc: git
In-Reply-To: <7v7jadwfdj.fsf@assigned-by-dhcp.cox.net>
> I do not necessarily agree with this claim that merging is the
> whole story about index. As the steps in the hello/example
> tutorial demonstrate, index is used to build up what you will
> commit incrementally, and you can use this facility to view your
> changes incrementally.
>
> Your workflow could be like this:
(Good example)
> This is sometimes very useful, and I suspect your comment about
> "commit -a will take care of everything, so you do not need to
> know about update-index" is coming from your ignoring this
> aspect of update-index.
Well, yes and no. I'm quite aware that the index can be used that way,
but I'm less certain it's a good idea.
I have often wished for a very lightweight "snapshot" feature that I could
(say) put in a Makefile at the end of every successful compile. I don't
want to share those snapshots with the world, and I'll delete them next
"real" commit, but they'll help me recover if I fumble-finger something.
Think of it as an undo feature. (With, of course, additional features
like the ability to see diffs between various stages.)
You can use the index as a one-level undo feature in a similar way.
Or maybe, since it's manual, its like hitting save from an editor.
Either way, the fact that it's only one level means that I have to
think about what I'm throwing away when I use it, which is somewhat
annoying.
Add that to the fact that it's unlike other version control systems
(including cogito) which go straight from the working directory into
the history, and I thought it better do downplay it.
Certainly I think that people will *usually* just "git-commit -a" to
commit their current version. Edit, compile, test, commit. Except in
unusual cases, I want the commit to reflect what I just tested.
Using git-update-index in the meantime is an optional extra.
^ permalink raw reply
* Re: as promised, docs: git for the confused
From: Junio C Hamano @ 2005-12-10 8:00 UTC (permalink / raw)
To: linux; +Cc: git
In-Reply-To: <20051209054401.4016.qmail@science.horizon.com>
linux@horizon.com writes:
> Like other version control systems, git has a current version (referred
> to as HEAD) in its object database, you make changes in the working
> directory, and then commit them, which appends a new version and makes
> that the new HEAD.
>
> However, there's also this "index" thing interposed. As "man git"
> explains, you can have one version of the file in the HEAD, a second
> in the index, and a third in the working directory. That's weird
> and confusing - why does git allow that? Why isn't the index just an
> implementation detail that caches the HEAD until you commit a new one?
>
> The answer is merging, which does all its work in the index. Being a
> toolkit, git has to pass partial merges around between its various
> tools, which means keeping track of multiple files all competing for
> the same name. Neither the object database nor the working directory
> let you have multiple files with the same name.
I do not necessarily agree with this claim that merging is the
whole story about index. As the steps in the hello/example
tutorial demonstrate, index is used to build up what you will
commit incrementally, and you can use this facility to view your
changes incrementally.
Your workflow could be like this:
$ git checkout
$ hack away
$ git diff ;# what have I done so far?
$ git diff HEAD ;# this one shows the same as the above.
$ git update-index frotz ;# now I am satisfied with my progress so far.
$ hack away further
$ git diff ;# what have I done since my last "satisfactory checkpoint"?
$ git diff HEAD ;# changes since the last commit -- this is
# different from the above, and gives a lot
# more output
$ git update-index nitfol ;# I am happy with what I've done
# to this file as well.
$ hack away further
$ git diff ;# changes since the checkpoint
$ git update-index frotz nitfol
$ git diff HEAD ;# final pre-commit review
$ git commit
You could view updating the index as "checking in" and making a
commit as "casting your cumulative check-ins in stone". You can
make "check in" as many times as you want, and there is "git
reset --mixed" to uncheckin the index changes. And by doing
intermediate "checkins" to index file, you can limit what "git
diff" shows only to changes since your last checkpoint, as
opposed to all the changes you have made since your last commit.
This is sometimes very useful, and I suspect your comment about
"commit -a will take care of everything, so you do not need to
know about update-index" is coming from your ignoring this
aspect of update-index.
^ permalink raw reply
* Re: [PATCH] Allow updating the index from a pipe
From: Daniel Barkalow @ 2005-12-10 7:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vbqzpxwg2.fsf@assigned-by-dhcp.cox.net>
On Fri, 9 Dec 2005, Junio C Hamano wrote:
> Daniel Barkalow <barkalow@iabervon.org> writes:
>
> > In order to allow the index to be modified in simple ways without
> > having a working tree, this adds an option to git-update-index which
> > updates a single path with a mode of 100644 and reads the content from
> > stdin.
>
> I wonder ...
>
> Could you do this with existing hash-object with update-index
> --cache-info (or --index-info) please? If you do not want a
> temporary file and prefer piping contents into a command,
> extending hash-object would be preferable.
Sure; I lost track of what hash-object was called at some point and
thought it had been removed. I'll do a patch to extend that to take stdin
when I get a chance.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH] Allow updating the index from a pipe
From: Junio C Hamano @ 2005-12-10 7:06 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0512100145500.25300@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
> In order to allow the index to be modified in simple ways without
> having a working tree, this adds an option to git-update-index which
> updates a single path with a mode of 100644 and reads the content from
> stdin.
I wonder ...
Could you do this with existing hash-object with update-index
--cache-info (or --index-info) please? If you do not want a
temporary file and prefer piping contents into a command,
extending hash-object would be preferable.
^ permalink raw reply
* [PATCH] Allow updating the index from a pipe
From: Daniel Barkalow @ 2005-12-10 6:57 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
In order to allow the index to be modified in simple ways without
having a working tree, this adds an option to git-update-index which
updates a single path with a mode of 100644 and reads the content from
stdin. Somebody should probably give the option a better name.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
This is for a git-backed wiki I'm writing, which doesn't want to use a
working tree when preparing changes, but wants to work entirely with pipes
and index files.
Documentation/git-update-index.txt | 7 ++++++
cache.h | 1 +
sha1_file.c | 27 ++++++++++++++++++++++++
update-index.c | 40 +++++++++++++++++++++++++++++++++++-
4 files changed, 74 insertions(+), 1 deletions(-)
7883add98deb548c7c10681ae3d71b7a7d949a9a
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index e4678cd..d35340a 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -14,6 +14,7 @@ SYNOPSIS
[--cacheinfo <mode> <object> <file>]\*
[--chmod=(+|-)x]
[--info-only] [--index-info]
+ [--name=<file>]
[-z] [--stdin]
[--verbose]
[--] [<file>]\*
@@ -87,6 +88,12 @@ OPTIONS
read list of paths from the standard input. Paths are
separated by LF (i.e. one path per line) by default.
+--name=<file>::
+ Instead of taking a list of paths, only operate on a single
+ path, and get the content from the standard input instead of
+ from the file system. The mode for the file will be 100644
+ (regular non-executable file).
+
--verbose::
Report what is being added and removed from index.
diff --git a/cache.h b/cache.h
index 86fc250..1b30f44 100644
--- a/cache.h
+++ b/cache.h
@@ -144,6 +144,7 @@ extern int ce_match_stat(struct cache_en
extern int ce_modified(struct cache_entry *ce, struct stat *st);
extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type);
+extern int index_pipe(unsigned char *sha1, int fd, const char *type);
extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
diff --git a/sha1_file.c b/sha1_file.c
index 111a71d..0073187 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1528,6 +1528,33 @@ int has_sha1_file(const unsigned char *s
return find_sha1_file(sha1, &st) ? 1 : 0;
}
+int index_pipe(unsigned char *sha1, int fd, const char *type)
+{
+ unsigned long size = 4096;
+ char *buf = malloc(size);
+ int iret, ret;
+ unsigned long off = 0;
+ do {
+ iret = read(fd, buf + off, size - off);
+ if (iret > 0) {
+ off += iret;
+ if (off == size) {
+ size *= 2;
+ buf = realloc(buf, size);
+ }
+ }
+ } while (iret > 0);
+ if (iret < 0) {
+ free(buf);
+ return -1;
+ }
+ if (!type)
+ type = "blob";
+ ret = write_sha1_file(buf, off, type, sha1);
+ free(buf);
+ return ret;
+}
+
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type)
{
unsigned long size = st->st_size;
diff --git a/update-index.c b/update-index.c
index 11b7f6a..f3d79af 100644
--- a/update-index.c
+++ b/update-index.c
@@ -24,6 +24,8 @@ static int info_only;
static int force_remove;
static int verbose;
+static char *single_name = NULL;
+
/* Three functions to allow overloaded pointer return; see linux/err.h */
static inline void *ERR_PTR(long error)
{
@@ -117,6 +119,33 @@ static int add_file_to_cache(const char
return 0;
}
+
+static int add_stdin_to_cache(const char *path)
+{
+ int size, namelen, option;
+ struct cache_entry *ce;
+ struct stat st;
+
+ namelen = strlen(path);
+ size = cache_entry_size(namelen);
+ ce = xmalloc(size);
+ memset(ce, 0, size);
+ memcpy(ce->name, path, namelen);
+ ce->ce_mode = create_ce_mode(0100644);
+ ce->ce_flags = create_ce_flags(namelen, 0);
+
+ st.st_size = 0;
+
+ if (index_pipe(ce->sha1, 0, NULL))
+ return -1;
+ option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
+ option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
+ if (add_cache_entry(ce, option))
+ return error("%s: cannot add to the index - missing --add option?",
+ path);
+ return 0;
+}
+
/*
* "refresh" does not calculate a new sha1 file or bring the
* cache up-to-date for mode/content changes. But what it
@@ -396,7 +425,7 @@ static void read_index_info(int line_ter
}
static const char update_index_usage[] =
-"git-update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--cacheinfo] [--chmod=(+|-)x] [--info-only] [--force-remove] [--stdin] [--index-info] [--ignore-missing] [-z] [--verbose] [--] <file>...";
+"git-update-index [-q] [--add] [--replace] [--remove] [--unmerged] [--refresh] [--cacheinfo] [--chmod=(+|-)x] [--info-only] [--force-remove] [--stdin] [--index-info] [--ignore-missing] [--name=<file>] [-z] [--verbose] [--] <file>...";
int main(int argc, const char **argv)
{
@@ -464,6 +493,10 @@ int main(int argc, const char **argv)
die("git-update-index: %s cannot chmod %s", path, argv[i]);
continue;
}
+ if (!strncmp(path, "--name=", strlen("--name="))) {
+ single_name = strdup(path + strlen("--name="));
+ continue;
+ }
if (!strcmp(path, "--info-only")) {
info_only = 1;
continue;
@@ -499,6 +532,8 @@ int main(int argc, const char **argv)
usage(update_index_usage);
die("unknown option %s", path);
}
+ if (single_name)
+ die("--name=<file> is incompatible with filenames");
update_one(path, prefix, prefix_length);
}
if (read_from_stdin) {
@@ -511,6 +546,9 @@ int main(int argc, const char **argv)
update_one(buf.buf, prefix, prefix_length);
}
}
+ if (single_name) {
+ add_stdin_to_cache(single_name);
+ }
if (active_cache_changed) {
if (write_cache(newfd, active_cache, active_nr) ||
commit_index_file(&cache_file))
--
0.99.9.GIT
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox