Commit graph

2255 commits

Author SHA1 Message Date
Junio C Hamano 9920c71825 Merge branch 'tf/prompt-preserve-exit-status'
Using the exit status of the last command in the prompt, e.g.
PS1='$(__git_ps1) $? ', did not work well because the helper
function stomped on the exit status.

* tf/prompt-preserve-exit-status:
  git-prompt: preserve value of $? in all cases
2015-01-14 12:35:49 -08:00
Junio C Hamano e1ef7d177c Merge branch 'rh/hide-prompt-in-ignored-directory'
* rh/hide-prompt-in-ignored-directory:
  git-prompt.sh: allow to hide prompt for ignored pwd
  git-prompt.sh: if pc mode, immediately set PS1 to a plain prompt
2015-01-14 12:34:01 -08:00
Junio C Hamano 1e7ef5d9bf Merge branch 'mm/complete-rebase-autostash'
* mm/complete-rebase-autostash:
  git-completion: add --autostash for 'git rebase'
2015-01-14 12:33:57 -08:00
Junio C Hamano 41753312e1 Merge branch 'sp/subtree-doc'
* sp/subtree-doc:
  subtree: fix AsciiDoc list item continuation
2015-01-14 12:33:46 -08:00
Tony Finch 6babe76496 git-prompt: preserve value of $? in all cases
Signed-off-by: Tony Finch <dot@dotat.at>
Reviewed-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-14 10:11:49 -08:00
Junio C Hamano 487b17de3e Merge branch 'tf/prompt-preserve-exit-status'
Using the exit status of the last command in the prompt, e.g.
PS1='$(__git_ps1) $? ', did not work well because the helper
function stomped on the exit status.

* tf/prompt-preserve-exit-status:
  git-prompt: preserve value of $? inside shell prompt
2015-01-07 13:09:35 -08:00
Junio C Hamano e82f629cf4 Merge branch 'pd/completion-filenames-fix'
The top-of-the-file instruction for completion scripts (in contrib/)
did not name the files correctly.

* pd/completion-filenames-fix:
  Update documentation occurrences of filename .sh
2015-01-07 13:06:37 -08:00
Matthieu Moy d89ad9c1b8 git-completion: add --autostash for 'git rebase'
This option was added in 58794775 (rebase: implement
--[no-]autostash and rebase.autostash, 2013-05-12).

Completion of "--autosquash" has been there, but this was not;
addition of this would require people completing "--autosquash" to
type a bit more than before.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-07 10:42:53 -08:00
Jess Austin 0120b8c85c git-prompt.sh: allow to hide prompt for ignored pwd
Optionally set __git_ps1 to display nothing when present working
directory is ignored, triggered by the new environment variable
GIT_PS1_HIDE_IF_PWD_IGNORED. This environment variable may be
overridden on any repository by setting bash.hideIfPwdIgnored to
"false". In the absence of GIT_PS1_HIDE_IF_PWD_IGNORED this change
has no effect.

Many people manage e.g. dotfiles in their home directory with git.
This causes the prompt generated by __git_ps1 to refer to that "top
level" repo while working in any descendant directory. That can be
distracting, so this patch helps one shut off that noise.

Signed-off-by: Jess Austin <jess.austin@gmail.com>
Signed-off-by: Richard Hansen <rhansen@bbn.com>
Reviewed-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-07 10:30:30 -08:00
Richard Hansen 76b4309400 git-prompt.sh: if pc mode, immediately set PS1 to a plain prompt
At the beginning of __git_ps1, right after determining that the
function is running in pc mode, set PS1 to a plain (undecorated)
prompt.  This makes it possible to simply return early without having
to set PS1 if the prompt should not be decorated.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-07 10:27:53 -08:00
Steffen Prohaska e0a1f09313 subtree: fix AsciiDoc list item continuation
List items must be continued with '+' (see [asciidoc]).

[asciidoc] AsciiDoc user guide 17.7. List Item Continuation
    <http://www.methods.co.nz/asciidoc/userguide.html#X15>

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-01-06 15:03:52 -08:00
Junio C Hamano 35b5a8b769 Merge branch 'jg/prompt-localize-temporary'
"git-prompt" (in contrib/) used a variable from the global scope,
possibly contaminating end-user's namespace.

* jg/prompt-localize-temporary:
  git-prompt.sh: make $f local to __git_eread()
2014-12-22 12:28:20 -08:00
Junio C Hamano 3dadfc7e17 Merge branch 'jk/colors'
"diff-highlight" filter (in contrib/) allows its color output
to be customized via configuration variables.

* jk/colors:
  parse_color: drop COLOR_BACKGROUND macro
  diff-highlight: allow configurable colors
  parse_color: recognize "no$foo" to clear the $foo attribute
  parse_color: support 24-bit RGB values
  parse_color: refactor color storage
2014-12-22 12:27:58 -08:00
Junio C Hamano 2cd20dc3d4 Merge branch 'rt/completion-tag'
* rt/completion-tag:
  completion: add git-tag options
2014-12-22 12:27:24 -08:00
Junio C Hamano 0b5ae7ba68 Merge branch 'ps/new-workdir-into-empty-directory'
"git new-workdir" (in contrib/) can be used to populate an empty
and existing directory now.

* ps/new-workdir-into-empty-directory:
  git-new-workdir: don't fail if the target directory is empty
2014-12-22 12:27:14 -08:00
Tony Finch eb443e3b39 git-prompt: preserve value of $? inside shell prompt
If you have a prompt which displays the command exit status,
__git_ps1 without this change corrupts it, although it has
the correct value in the parent shell:

	~/src/git (master) 0 $ set | grep ^PS1
	PS1='\w$(__git_ps1) $? \$ '
	~/src/git (master) 0 $ false
	~/src/git (master) 0 $ echo $?
	1
	~/src/git (master) 0 $

There is a slightly ugly workaround:

	~/src/git (master) 0 $ set | grep ^PS1
	PS1='\w$(x=$?; __git_ps1; exit $x) $? \$ '
	~/src/git (master) 0 $ false
	~/src/git (master) 1 $

This change makes the workaround unnecessary.

Signed-off-by: Tony Finch <dot@dotat.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-22 11:58:56 -08:00
Peter van der Does 0e5ed7cca3 Update documentation occurrences of filename .sh
Documentation in the completion scripts for Bash and Zsh state the wrong filenames.

Signed-off-by: Peter van der Does <peter@avirtualhome.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-15 09:37:14 -08:00
Justin Guenther 9dd70e0a0d git-prompt.sh: make $f local to __git_eread()
This function uses (non-local) $f to store the value of its first parameter.
This can interfere with the user's environment.

Signed-off-by: Justin Guenther <jguenther@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-12 15:13:37 -08:00
Ralf Thielow 85ed2f3206 completion: add git-tag options
Add completion for git-tag options including
all options that are currently shown in "git tag -h".

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-04 12:10:26 -08:00
Paul Smith e32afab7b0 git-new-workdir: don't fail if the target directory is empty
Allow new workdirs to be created in an empty directory (similar to "git
clone").  Provide more error checking and clean up on failure.

Signed-off-by: Paul Smith <paul@mad-scientist.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-03 12:49:24 -08:00
Paolo Bonzini 8d81408435 git-send-email: add --transfer-encoding option
The thread at http://thread.gmane.org/gmane.comp.version-control.git/257392
details problems when applying patches with "git am" in a repository with
CRLF line endings.  In the example in the thread, the repository originated
from "git-svn" so it is not possible to use core.eol and friends on it.

Right now, the best option is to use "git am --keep-cr".  However, when
a patch create new files, the patch application process will reject the
new file because it finds a "/dev/null\r" string instead of "/dev/null".

The problem is that SMTP transport is CRLF-unsafe.  Sending a patch by
email is the same as passing it through "dos2unix | unix2dos".  The newly
introduced CRLFs are normally transparent because git-am strips them. The
keepcr=true setting preserves them, but it is mostly working by chance
and it would be very problematic to have a "git am" workflow in a
repository with mixed LF and CRLF line endings.

The MIME solution to this is the quoted-printable transfer enconding.
This is not something that we want to enable by default, since it makes
received emails horrible to look at.  However, it is a very good match
for projects that store CRLF line endings in the repository.

The only disadvantage of quoted-printable is that quoted-printable
patches fail to apply if the maintainer uses "git am --keep-cr".  This
is because the decoded patch will have two carriage returns at the end
of the line.  Therefore, add support for base64 transfer encoding too,
which makes received emails downright impossible to look at outside
a MUA, but really just works.

The patch covers all bases, including users that still live in the late
80s, by also providing a 7bit content transfer encoding that refuses
to send emails with non-ASCII character in them.  And finally, "8bit"
will add a Content-Transfer-Encoding header but otherwise do nothing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-25 14:00:15 -08:00
Jeff King bca45fbc1f diff-highlight: allow configurable colors
Until now, the highlighting colors were hard-coded in the
script (as "reverse" and "noreverse"), and you had to edit
the script to change them. This patch teaches diff-highlight
to read from color.diff-highlight.* to set them.

In addition, it expands the possiblities considerably by
adding two features:

  1. Old/new lines can be colored independently (so you can
     use a color scheme that complements existing line
     coloring).

  2. Normal, unhighlighted parts of the lines can be colored,
     too. Technically this can be done by separately
     configuring color.diff.old/new and matching it to your
     diff-highlight colors. But you may want a different
     look for your highlighted diffs versus your regular
     diffs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-20 12:43:16 -08:00
Junio C Hamano bd51886f30 Merge branch 'js/diff-highlight-avoid-sigpipe'
* js/diff-highlight-avoid-sigpipe:
  diff-highlight: exit when a pipe is broken
2014-11-10 11:26:09 -08:00
John Szakmeister 251e7dad51 diff-highlight: exit when a pipe is broken
While using diff-highlight with other tools, I have discovered that Python
ignores SIGPIPE by default.  Unfortunately, this also means that tools
attempting to launch a pager under Python--and don't realize this is
happening--means that the subprocess inherits this setting.  In this case, it
means diff-highlight will be launched with SIGPIPE being ignored.  Let's work
with those broken scripts by restoring the default SIGPIPE handler.

Signed-off-by: John Szakmeister <john@szakmeister.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-04 13:18:35 -08:00
Thomas Ackermann f745acb028 Documentation: typofixes
In addition to fixing trivial and obvious typos, be careful about
the following points:

 - Spell ASCII, URL and CRC in ALL CAPS;
 - Spell Linux as Capitalized;
 - Do not omit periods in "i.e." and "e.g.".

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-04 13:14:44 -08:00
Junio C Hamano c1777a2970 Merge branch 'oc/mergetools-beyondcompare'
* oc/mergetools-beyondcompare:
  mergetool: rename bc3 to bc
2014-10-29 10:08:04 -07:00
Junio C Hamano 693f62ff68 Merge branch 'js/completion-hide-not-a-repo'
Some internal error messages leaked out of the bash completion when
typing "git cmd <TAB>" and the machinery tried to complete
refnames.

* js/completion-hide-not-a-repo:
  completion: silence "fatal: Not a git repository" error
2014-10-21 13:28:50 -07:00
Junio C Hamano f13f9b0eab mergetool: rename bc3 to bc
Beyond Compare version 4 works the same way as version 3, so rename
the existing "bc3" adaptor to just "bc", while keeping "bc3" as a
backward compatible wrapper.

Noticed-by: Olivier Croquette <ocroquette@free.fr>
Helped-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-21 11:25:30 -07:00
Junio C Hamano 9c6be8b5ab Merge branch 'ss/contrib-subtree-contacts'
* ss/contrib-subtree-contacts:
  contacts: add a Makefile to generate docs and install
  subtree: add an install-html target
2014-10-20 12:25:16 -07:00
Junio C Hamano 98349e5364 Merge branch 'jc/completion-no-chdir'
* jc/completion-no-chdir:
  completion: use "git -C $there" instead of (cd $there && git ...)
2014-10-16 14:16:49 -07:00
Sebastian Schuberth 2ea40f01c5 contacts: add a Makefile to generate docs and install
Also add a gitignore file for generated files.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-15 15:18:27 -07:00
Sebastian Schuberth 4d24d5202c subtree: add an install-html target
Also adjust ignore rules accordingly.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-15 15:17:08 -07:00
John Szakmeister 8f7ff5b2fe completion: silence "fatal: Not a git repository" error
It is possible that a user is trying to run a git command and fail
to realize that they are not in a git repository or working tree.
When trying to complete an operation, __git_refs would fall to a
degenerate case and attempt to use "git for-each-ref", which would
emit the error.

Hide this error message coming from "git for-each-ref".

Signed-off-by: John Szakmeister <john@szakmeister.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-14 13:06:13 -07:00
Junio C Hamano fca416a41e completion: use "git -C $there" instead of (cd $there && git ...)
We have had "git -C $there" to first go to a different directory
and run a Git command without changing the arguments for quite some
time.  Use it instead of (cd $there && git ...) in the completion
script.

This allows us to lose the work-around for misfeatures of modern
interactive-minded shells that make "cd" unusable in scripts (e.g.
end users' $CDPATH taking us to unexpected places in any POSIX
shell, and chpwd functions spewing unwanted output in zsh).

Based on Øystein Walle's idea, which was raised during the
discussion on the solution by Brandon Turner for a problem zsh users
had with RVM which mucks with chpwd_functions in users' environments
(https://github.com/wayneeseguin/rvm/issues/3076).

As $root variable, which is used to direct where to chdir to, is set
to "." based on if $2 to __git_index_files is set (not if it is empty),
the only caller of the function is fixed not to pass the optional $2
when it does not want us to switch to a different directory.  Otherwise
we would end up doing "git -C '' command...", which would not work.

Maybe we would want "git -C '' command..." to mean "do not chdir
anywhere", but that is a spearate topic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-09 15:06:08 -07:00
David Aguilar 2ca0b197b8 completion: add --show-signature for log and show
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-07 12:00:48 -07:00
Junio C Hamano 8ec959fbce Merge branch 'jk/prompt-stash-could-be-packed' into maint
* jk/prompt-stash-could-be-packed:
  git-prompt: do not look for refs/stash in $GIT_DIR
2014-09-19 14:05:11 -07:00
Junio C Hamano b6de2dcb80 Merge branch 'tb/complete-diff-ignore-blank-lines'
* tb/complete-diff-ignore-blank-lines:
  completion: Add --ignore-blank-lines for diff
2014-09-19 11:38:38 -07:00
Junio C Hamano a60f434e20 Merge branch 'mb/build-contrib-svn-fe'
* mb/build-contrib-svn-fe:
  contrib/svn-fe: fix Makefile
2014-09-19 11:38:32 -07:00
Junio C Hamano 49feda62bd Merge branch 'jk/contrib-subtree-make-all'
* jk/contrib-subtree-make-all:
  subtree: make "all" default target of Makefile
2014-09-11 10:33:27 -07:00
Junio C Hamano 64014894cf Merge branch 'jk/prompt-stash-could-be-packed'
The prompt script checked $GIT_DIR/ref/stash file to see if there
is a stash, which was a no-no.

* jk/prompt-stash-could-be-packed:
  git-prompt: do not look for refs/stash in $GIT_DIR
2014-09-09 12:54:08 -07:00
Thomas Braun c254516737 completion: Add --ignore-blank-lines for diff
Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-09-03 12:23:10 -07:00
Maxim Bublis da011cb0e7 contrib/svn-fe: fix Makefile
Fixes several problems:
  * include config.mak.uname, config.mak.autogen and config.mak
    in order to use settings for prefix and other such things;
  * link xdiff/lib.a as it is a requirement for libgit.a;
  * fix CFLAGS, LDFLAGS and EXTLIBS for Linux and Mac OS X.

Signed-off-by: Maxim Bublis <satori@yandex-team.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-08-28 15:41:28 -07:00
Jeff King 0fa7f01635 git-prompt: do not look for refs/stash in $GIT_DIR
Since dd0b72c (bash prompt: use bash builtins to check stash
state, 2011-04-01), git-prompt checks whether we have a
stash by looking for $GIT_DIR/refs/stash. Generally external
programs should never do this, because they would miss
packed-refs.

That commit claims that packed-refs does not pack
refs/stash, but that is not quite true. It does pack the
ref, but due to a bug, fails to prune the ref. When we fix
that bug, we would want to be doing the right thing here.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-08-25 12:21:17 -07:00
Jeff King 960160b061 subtree: make "all" default target of Makefile
You should be able to run "make" in contrib/subtree with no
arguments and get the "all" target. This was broken by 8e2a5cc
(contrib/subtree/Makefile: use GIT-VERSION-FILE, 2014-05-06), which
put the rule for GIT-VERSION-FILE higher in the file.

We can fix this by putting an empty "all::" target at the top of the
file, just like our main Makefile does, and document that fact.
That fixes this instance and future-proofs against it happening
again.

Reported-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-08-18 10:20:36 -07:00
Stefan Beller 663d096c24 various contrib: Fix links in man pages
Inspired by 2147fa7e (2014-07-31 git-push: fix link in man page),
I grepped through the whole tree searching for 'gitlink:' occurrences.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-08-07 09:43:21 -07:00
Junio C Hamano 0d9cb2d14e Merge branch 'jk/more-push-completion'
* jk/more-push-completion:
  completion: complete `git push --force-with-lease=`
  completion: add some missing options to `git push`
  completion: complete "unstuck" `git push --recurse-submodules`
2014-07-30 14:21:14 -07:00
Junio C Hamano 16737445a9 Merge branch 'cc/replace-graft'
"git replace" learned a "--graft" option to rewrite parents of a
commit.

* cc/replace-graft:
  replace: add test for --graft with a mergetag
  replace: check mergetags when using --graft
  replace: add test for --graft with signed commit
  replace: remove signature when using --graft
  contrib: add convert-grafts-to-replace-refs.sh
  Documentation: replace: add --graft option
  replace: add test for --graft
  replace: add --graft option
  replace: cleanup redirection style in tests
2014-07-27 15:14:18 -07:00
John Keeping aaf7253f84 completion: complete git push --force-with-lease=
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-22 13:30:30 -07:00
John Keeping 9e8a6a9433 completion: add some missing options to git push
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-22 13:23:39 -07:00
John Keeping 3a224ff2bb completion: complete "unstuck" git push --recurse-submodules
Since the argument to `--recurse-submodules` is mandatory, it does not
need to be stuck to the option with `=`.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-22 13:21:07 -07:00