[PATCH 00/24] Let 'git <command> -h' show usage without a git dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:

> So I think the right approach is something like how you handled http-push;
> namely, check if the sole argument is "-h", and if so show help and exit.

I took a more aggressive approach with some commands.  As long as it
was obviously safe and not too complicated to implement, I let -h work
wherever other options work.

Tested with

git_home=$(pwd)
while read a b
do
	cmd=${a#git-}
	test "$cmd" = "$a" && continue
	echo "$cmd"
	( cd /tmp && "$git_home/git" "$cmd" -h 2>&1 | head -1 )
done |
less

and the test suite.

Thoughts?

Jonathan Nieder (24):
  Retire fetch--tool helper to contrib/examples
  Show usage string for 'git grep -h'
  Show usage string for 'git cherry -h'
  Show usage string for 'git commit-tree -h'
  Show usage string for 'git merge-ours -h'
  Show usage string for 'git show-ref -h'
  check-ref-format: update usage string
  Show usage string for 'git check-ref-format -h'
  Show usage string for 'git fast-import -h'
  Show usage string for 'git get-tar-commit-id -h'
  Show usage string for 'git imap-send -h'
  Show usage string for 'git mailsplit -h'
  Show usage string for 'git merge-one-file -h'
  Show usage string for 'git rev-parse -h'
  Show usage string for 'git show-index -h'
  Show usage string for 'git unpack-file -h'
  Show usage string for 'git stripspace -h'
  merge: do not setup worktree twice
  Let 'git http-fetch -h' show usage outside any git repository
  http-fetch: add missing initialization of argv0_path
  Let 'git <command> -h' show usage without a git dir
  Let usage() take a printf-style format
  merge-{recursive,subtree}: use usage() to print usage
  diff --no-index: make the usage string less scary

 Documentation/git-show-ref.txt                     |    3 +-
 Makefile                                           |    1 -
 builtin-check-ref-format.c                         |    9 +++++++-
 builtin-commit-tree.c                              |    2 +-
 builtin-grep.c                                     |    7 ++++++
 builtin-log.c                                      |    9 ++++++++
 builtin-mailsplit.c                                |    2 +
 builtin-merge-ours.c                               |    6 +++++
 builtin-merge-recursive.c                          |    2 +-
 builtin-merge.c                                    |    1 -
 builtin-mv.c                                       |    8 +++---
 builtin-read-tree.c                                |    4 +-
 builtin-reflog.c                                   |    3 ++
 builtin-rerere.c                                   |    3 ++
 builtin-rev-parse.c                                |   10 +++++++++
 builtin-show-ref.c                                 |   10 +++++++-
 builtin-stripspace.c                               |    4 ++-
 builtin-tar-tree.c                                 |    6 +++++
 builtin.h                                          |    1 -
 .../examples/builtin-fetch--tool.c                 |    0
 diff-no-index.c                                    |    2 +-
 fast-import.c                                      |    3 ++
 git-compat-util.h                                  |    2 +-
 git-merge-one-file.sh                              |   12 ++++++++++
 git.c                                              |   22 ++++++++++---------
 http-fetch.c                                       |   21 ++++++++++++------
 imap-send.c                                        |    5 ++++
 index-pack.c                                       |    3 ++
 pack-redundant.c                                   |    3 ++
 show-index.c                                       |    5 ++++
 unpack-file.c                                      |    2 +-
 usage.c                                            |   14 ++++++++----
 32 files changed, 143 insertions(+), 42 deletions(-)
 rename builtin-fetch--tool.c => contrib/examples/builtin-fetch--tool.c (100%)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]