From 60ace8790f3cfba4fdc16e71e23c4f9c44ce9b44 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 21 Feb 2006 15:33:49 -0800 Subject: git-add: Add support for --, documentation, and test. This adds support to git-add to allow the common -- to separate command-line options and file names. It adds documentation and a new git-add test case as well. [jc: this should apply to 1.2.X maintenance series, so I reworked git-ls-files --error-unmatch test. ] Signed-off-by: Junio C Hamano --- Documentation/git-add.txt | 7 ++++++- git-add.sh | 4 ++++ t/t3700-add.sh | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 t/t3700-add.sh diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index 89e461402e..7e293834d1 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -7,7 +7,7 @@ git-add - Add files to the index file. SYNOPSIS -------- -'git-add' [-n] [-v] ... +'git-add' [-n] [-v] [--] ... DESCRIPTION ----------- @@ -26,6 +26,11 @@ OPTIONS -v:: Be verbose. +--:: + This option can be used to separate command-line options from + the list of files, (useful when filenames might be mistaken + for command-line options). + DISCUSSION ---------- diff --git a/git-add.sh b/git-add.sh index f719b4b1a8..611f152dac 100755 --- a/git-add.sh +++ b/git-add.sh @@ -14,6 +14,10 @@ while : ; do -v) verbose=--verbose ;; + --) + shift + break + ;; -*) usage ;; diff --git a/t/t3700-add.sh b/t/t3700-add.sh new file mode 100755 index 0000000000..6cd05c3d90 --- /dev/null +++ b/t/t3700-add.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2006 Carl D. Worth +# + +test_description='Test of git-add, including the -- option.' + +. ./test-lib.sh + +test_expect_success \ + 'Test of git-add' \ + 'touch foo && git-add foo' + +test_expect_success \ + 'Post-check that foo is in the index' \ + 'git-ls-files foo | grep foo' + +test_expect_success \ + 'Test that "git-add -- -q" works' \ + 'touch -- -q && git-add -- -q' + +test_done -- cgit v1.2.3 From fab5de7936f0cc086836a38d2de4374c3df223b4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 21 Feb 2006 18:13:32 -0800 Subject: format-patch: pretty-print timestamp correctly. Perl is not C and does not truncate the division result. Arghh! Signed-off-by: Junio C Hamano --- git-format-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-format-patch.sh b/git-format-patch.sh index e54c9e4a94..eb75de4601 100755 --- a/git-format-patch.sh +++ b/git-format-patch.sh @@ -189,7 +189,7 @@ my @month_names = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); sub show_date { my ($time, $tz) = @_; my $minutes = abs($tz); - $minutes = ($minutes / 100) * 60 + ($minutes % 100); + $minutes = int($minutes / 100) * 60 + ($minutes % 100); if ($tz < 0) { $minutes = -$minutes; } -- cgit v1.2.3 From aa064743fa69e2806d5e0af1fab103baa6fa57cd Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 21 Feb 2006 20:28:50 -0800 Subject: git-push: Update documentation to describe the no-refspec behavior. It turns out that the git-push documentation didn't describe what it would do when not given a refspec, (not on the command line, nor in a remotes file). This is fairly important for the user who is trying to understand operations such as: git clone git://something/some/where # hack, hack, hack git push origin I tracked the mystery behavior down to git-send-pack and lifted the relevant portion of its documentation up to git-push, (namely that all refs existing both locally and remotely are updated). Signed-off-by: Carl Worth Signed-off-by: Junio C Hamano --- Documentation/git-push.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 5b891105b2..6f4a48a109 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -43,6 +43,12 @@ to fast forward the remote ref that matches . If the optional plus `+` is used, the remote ref is updated even if it does not result in a fast forward update. + +Note: If no explicit refspec is found, (that is neither +on the command line nor in any Push line of the +corresponding remotes file---see below), then all the +refs that exist both on the local side and on the remote +side are updated. ++ Some short-cut notations are also supported. + * `tag ` means the same as `refs/tags/:refs/tags/`. -- cgit v1.2.3